1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #20925 from TolyaTalamanov:at/enable-2d-inputs-giebackend

[G-API] Enable 2D inputs for GIEBackend

* Enable 2D inputs

* Fix typo
This commit is contained in:
Anatoliy Talamanov
2021-11-16 15:52:42 +03:00
committed by GitHub
parent b19697e3ac
commit c7df82460c
4 changed files with 133 additions and 21 deletions
+10 -7
View File
@@ -80,7 +80,10 @@ struct ParamDesc {
// NB: An optional config to setup RemoteContext for IE
cv::util::any context_config;
size_t batch_size;
// NB: batch_size can't be equal to 1 by default, because some of models
// have 2D (Layout::NC) input and if the first dimension not equal to 1
// net.setBatchSize(1) will overwrite it.
cv::optional<size_t> batch_size;
};
} // namespace detail
@@ -123,7 +126,7 @@ public:
, {}
, 1u
, {}
, 1u} {
, {}} {
};
/** @overload
@@ -145,7 +148,7 @@ public:
, {}
, 1u
, {}
, 1u} {
, {}} {
};
/** @brief Specifies sequence of network input layers names for inference.
@@ -329,7 +332,7 @@ public:
@return reference to this parameter structure.
*/
Params<Net>& cfgBatchSize(const size_t size) {
desc.batch_size = size;
desc.batch_size = cv::util::make_optional(size);
return *this;
}
@@ -367,7 +370,7 @@ public:
const std::string &device)
: desc{ model, weights, device, {}, {}, {}, 0u, 0u,
detail::ParamDesc::Kind::Load, true, {}, {}, {}, 1u,
{}, 1u},
{}, {}},
m_tag(tag) {
};
@@ -385,7 +388,7 @@ public:
const std::string &device)
: desc{ model, {}, device, {}, {}, {}, 0u, 0u,
detail::ParamDesc::Kind::Import, true, {}, {}, {}, 1u,
{}, 1u},
{}, {}},
m_tag(tag) {
};
@@ -454,7 +457,7 @@ public:
/** @see ie::Params::cfgBatchSize */
Params& cfgBatchSize(const size_t size) {
desc.batch_size = size;
desc.batch_size = cv::util::make_optional(size);
return *this;
}