mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Merge pull request #20169 from TolyaTalamanov:at/doc-generic-type
[G-API] Generic type documentation * Put doc about generic type * Fix comments to review
This commit is contained in:
parent
d9ed9a9a83
commit
bdc8e9118b
@ -531,7 +531,11 @@ typename Net::Result infer(Args&&... args) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Special network type
|
||||
* @brief Generic network type: input and output layers are configured dynamically at runtime
|
||||
*
|
||||
* Unlike the network types defined with G_API_NET macro, this one
|
||||
* doesn't fix number of network inputs and outputs at the compilation stage
|
||||
* thus providing user with an opportunity to program them in runtime.
|
||||
*/
|
||||
struct Generic { };
|
||||
|
||||
|
@ -196,9 +196,24 @@ protected:
|
||||
detail::ParamDesc desc;
|
||||
};
|
||||
|
||||
/*
|
||||
* @brief This structure provides functions for generic network type that
|
||||
* fill inference parameters.
|
||||
* @see struct Generic
|
||||
*/
|
||||
template<>
|
||||
class Params<cv::gapi::Generic> {
|
||||
public:
|
||||
/** @brief Class constructor.
|
||||
|
||||
Constructs Params based on model information and sets default values for other
|
||||
inference description parameters. Model is loaded and compiled using OpenVINO Toolkit.
|
||||
|
||||
@param tag string tag of the network for which these parameters are intended.
|
||||
@param model path to topology IR (.xml file).
|
||||
@param weights path to weights (.bin file).
|
||||
@param device target device to use.
|
||||
*/
|
||||
Params(const std::string &tag,
|
||||
const std::string &model,
|
||||
const std::string &weights,
|
||||
@ -206,22 +221,34 @@ public:
|
||||
: desc{ model, weights, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Load, true, {}, {}, {}, 1u}, m_tag(tag) {
|
||||
};
|
||||
|
||||
/** @overload
|
||||
|
||||
This constructor for pre-compiled networks. Model is imported from pre-compiled
|
||||
blob.
|
||||
|
||||
@param tag string tag of the network for which these parameters are intended.
|
||||
@param model path to model.
|
||||
@param device target device to use.
|
||||
*/
|
||||
Params(const std::string &tag,
|
||||
const std::string &model,
|
||||
const std::string &device)
|
||||
: desc{ model, {}, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Import, true, {}, {}, {}, 1u}, m_tag(tag) {
|
||||
};
|
||||
|
||||
Params& pluginConfig(IEConfig&& cfg) {
|
||||
desc.config = std::move(cfg);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @see ie::Params::pluginConfig. */
|
||||
Params& pluginConfig(const IEConfig& cfg) {
|
||||
desc.config = cfg;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params& pluginConfig(IEConfig&& cfg) {
|
||||
desc.config = std::move(cfg);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @see ie::Params::constInput. */
|
||||
Params& constInput(const std::string &layer_name,
|
||||
const cv::Mat &data,
|
||||
TraitAs hint = TraitAs::TENSOR) {
|
||||
@ -229,37 +256,44 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @see ie::Params::cfgNumRequests. */
|
||||
Params& cfgNumRequests(size_t nireq) {
|
||||
GAPI_Assert(nireq > 0 && "Number of infer requests must be greater than zero!");
|
||||
desc.nireq = nireq;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Params& cfgInputReshape(std::map<std::string, std::vector<std::size_t>> && reshape_table) {
|
||||
desc.reshape_table = std::move(reshape_table);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @see ie::Params::cfgInputReshape */
|
||||
Params& cfgInputReshape(const std::map<std::string, std::vector<std::size_t>>&reshape_table) {
|
||||
desc.reshape_table = reshape_table;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params& cfgInputReshape(std::map<std::string, std::vector<std::size_t>> && reshape_table) {
|
||||
desc.reshape_table = std::move(reshape_table);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params& cfgInputReshape(std::string && layer_name, std::vector<size_t> && layer_dims) {
|
||||
desc.reshape_table.emplace(layer_name, layer_dims);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params& cfgInputReshape(const std::string & layer_name, const std::vector<size_t>&layer_dims) {
|
||||
desc.reshape_table.emplace(layer_name, layer_dims);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params& cfgInputReshape(std::unordered_set<std::string> && layer_names) {
|
||||
desc.layer_names_to_reshape = std::move(layer_names);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
Params& cfgInputReshape(const std::unordered_set<std::string>&layer_names) {
|
||||
desc.layer_names_to_reshape = layer_names;
|
||||
return *this;
|
||||
|
Loading…
Reference in New Issue
Block a user