Skip to content

Commit 28c064f

Browse files
Merge pull request opencv#19487 from TolyaTalamanov:at/support-nireq-option
[G-API] Support multiple asynchronous requests * Support nireq option * Disable tests to check CI * Fix bug with hanging * WA to green CI * Snapshot * Simplify RequestPool * Add default values to id * Fix win warning
1 parent c7f0381 commit 28c064f

File tree

5 files changed

+376
-287
lines changed

5 files changed

+376
-287
lines changed

modules/gapi/include/opencv2/gapi/infer/ie.hpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ namespace detail {
6767
Kind kind;
6868
bool is_generic;
6969
IEConfig config;
70+
71+
// NB: Number of asyncrhonious infer requests
72+
size_t nireq;
7073
};
7174
} // namespace detail
7275

@@ -91,7 +94,8 @@ template<typename Net> class Params {
9194
, std::tuple_size<typename Net::OutArgs>::value // num_out
9295
, detail::ParamDesc::Kind::Load
9396
, false
94-
, {}} {
97+
, {}
98+
, 1u} {
9599
};
96100

97101
Params(const std::string &model,
@@ -101,7 +105,8 @@ template<typename Net> class Params {
101105
, std::tuple_size<typename Net::OutArgs>::value // num_out
102106
, detail::ParamDesc::Kind::Import
103107
, false
104-
, {}} {
108+
, {}
109+
, 1u} {
105110
};
106111

107112
Params<Net>& cfgInputLayers(const typename PortCfg<Net>::In &ll) {
@@ -137,6 +142,12 @@ template<typename Net> class Params {
137142
return *this;
138143
}
139144

145+
Params& cfgNumRequests(size_t nireq) {
146+
GAPI_Assert(nireq > 0 && "Number of infer requests must be greater than zero!");
147+
desc.nireq = nireq;
148+
return *this;
149+
}
150+
140151
// BEGIN(G-API's network parametrization API)
141152
GBackend backend() const { return cv::gapi::ie::backend(); }
142153
std::string tag() const { return Net::tag(); }
@@ -154,13 +165,13 @@ class Params<cv::gapi::Generic> {
154165
const std::string &model,
155166
const std::string &weights,
156167
const std::string &device)
157-
: desc{ model, weights, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Load, true, {}}, m_tag(tag) {
168+
: desc{ model, weights, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Load, true, {}, 1u}, m_tag(tag) {
158169
};
159170

160171
Params(const std::string &tag,
161172
const std::string &model,
162173
const std::string &device)
163-
: desc{ model, {}, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Import, true, {}}, m_tag(tag) {
174+
: desc{ model, {}, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Import, true, {}, 1u}, m_tag(tag) {
164175
};
165176

166177
Params& pluginConfig(IEConfig&& cfg) {

0 commit comments

Comments
 (0)