OpenCV  4.5.5
Open Source Computer Vision
Public Member Functions | Protected Attributes | List of all members
cv::gapi::ie::Params< Net > Class Template Reference

This structure provides functions that fill inference parameters for "OpenVINO Toolkit" model. More...

#include <opencv2/gapi/infer/ie.hpp>

Public Member Functions

 Params (const std::string &model, const std::string &weights, const std::string &device)
 Class constructor. More...
 
 Params (const std::string &model, const std::string &device)
 
GBackend backend () const
 
Params< Net > & cfgBatchSize (const size_t size)
 Specifies the inference batch size. More...
 
ParamscfgContextParams (const cv::util::any &ctx_cfg)
 Specifies configuration for RemoteContext in InferenceEngine. More...
 
ParamscfgContextParams (cv::util::any &&ctx_cfg)
 
Params< Net > & cfgInputLayers (const typename PortCfg< Net >::In &layer_names)
 Specifies sequence of network input layers names for inference. More...
 
Params< Net > & cfgInputReshape (const std::map< std::string, std::vector< std::size_t >> &reshape_table)
 Specifies new input shapes for the network inputs. More...
 
Params< Net > & cfgInputReshape (std::map< std::string, std::vector< std::size_t >> &&reshape_table)
 
Params< Net > & cfgInputReshape (const std::string &layer_name, const std::vector< size_t > &layer_dims)
 
Params< Net > & cfgInputReshape (std::string &&layer_name, std::vector< size_t > &&layer_dims)
 
Params< Net > & cfgInputReshape (const std::unordered_set< std::string > &layer_names)
 
Params< Net > & cfgInputReshape (std::unordered_set< std::string > &&layer_names)
 
ParamscfgNumRequests (size_t nireq)
 Specifies number of asynchronous inference requests. More...
 
Params< Net > & cfgOutputLayers (const typename PortCfg< Net >::Out &layer_names)
 Specifies sequence of network output layers names for inference. More...
 
Params< Net > & constInput (const std::string &layer_name, const cv::Mat &data, TraitAs hint=TraitAs::TENSOR)
 Specifies a constant input. More...
 
cv::util::any params () const
 
ParamspluginConfig (const IEConfig &cfg)
 Specifies OpenVINO plugin configuration. More...
 
ParamspluginConfig (IEConfig &&cfg)
 
std::string tag () const
 

Protected Attributes

detail::ParamDesc desc
 

Detailed Description

template<typename Net>
class cv::gapi::ie::Params< Net >

This structure provides functions that fill inference parameters for "OpenVINO Toolkit" model.

Constructor & Destructor Documentation

◆ Params() [1/2]

template<typename Net >
cv::gapi::ie::Params< Net >::Params ( const std::string &  model,
const std::string &  weights,
const std::string &  device 
)
inline

Class constructor.

Constructs Params based on model information and specifies default values for other inference description parameters. Model is loaded and compiled using "OpenVINO Toolkit".

Parameters
modelPath to topology IR (.xml file).
weightsPath to weights (.bin file).
devicetarget device to use.

◆ Params() [2/2]

template<typename Net >
cv::gapi::ie::Params< Net >::Params ( const std::string &  model,
const std::string &  device 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Use this constructor to work with pre-compiled network. Model is imported from a pre-compiled blob.

Parameters
modelPath to model.
devicetarget device to use.

Member Function Documentation

◆ backend()

template<typename Net >
GBackend cv::gapi::ie::Params< Net >::backend ( ) const
inline

◆ cfgBatchSize()

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgBatchSize ( const size_t  size)
inline

Specifies the inference batch size.

The function is used to specify inference batch size. Follow https://docs.openvinotoolkit.org/latest/classInferenceEngine_1_1CNNNetwork.html#a8e9d19270a48aab50cb5b1c43eecb8e9 for additional information

Parameters
sizebatch size which will be used.
Returns
reference to this parameter structure.

◆ cfgContextParams() [1/2]

template<typename Net >
Params& cv::gapi::ie::Params< Net >::cfgContextParams ( const cv::util::any ctx_cfg)
inline

Specifies configuration for RemoteContext in InferenceEngine.

When RemoteContext is configured the backend imports the networks using the context. It also expects cv::MediaFrames to be actually remote, to operate with blobs via the context.

Parameters
ctx_cfgcv::util::any value which holds InferenceEngine::ParamMap.
Returns
reference to this parameter structure.

◆ cfgContextParams() [2/2]

template<typename Net >
Params& cv::gapi::ie::Params< Net >::cfgContextParams ( cv::util::any &&  ctx_cfg)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Function with an rvalue parameter.

Parameters
ctx_cfgcv::util::any value which holds InferenceEngine::ParamMap.
Returns
reference to this parameter structure.

◆ cfgInputLayers()

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputLayers ( const typename PortCfg< Net >::In &  layer_names)
inline

Specifies sequence of network input layers names for inference.

The function is used to associate cv::gapi::infer<> inputs with the model inputs. Number of names has to match the number of network inputs as defined in G_API_NET(). In case a network has only single input layer, there is no need to specify name manually.

Parameters
layer_namesstd::array<std::string, N> where N is the number of inputs as defined in the G_API_NET. Contains names of input layers.
Returns
reference to this parameter structure.

◆ cfgInputReshape() [1/6]

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputReshape ( const std::map< std::string, std::vector< std::size_t >> &  reshape_table)
inline

Specifies new input shapes for the network inputs.

The function is used to specify new input shapes for the network inputs. Follow https://docs.openvinotoolkit.org/latest/classInferenceEngine_1_1networkNetwork.html for additional information.

Parameters
reshape_tableMap of pairs: name of corresponding data and its dimension.
Returns
reference to this parameter structure.

◆ cfgInputReshape() [2/6]

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputReshape ( std::map< std::string, std::vector< std::size_t >> &&  reshape_table)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ cfgInputReshape() [3/6]

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputReshape ( const std::string &  layer_name,
const std::vector< size_t > &  layer_dims 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
layer_nameName of layer.
layer_dimsNew dimensions for this layer.
Returns
reference to this parameter structure.

◆ cfgInputReshape() [4/6]

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputReshape ( std::string &&  layer_name,
std::vector< size_t > &&  layer_dims 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ cfgInputReshape() [5/6]

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputReshape ( const std::unordered_set< std::string > &  layer_names)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
layer_namesset of names of network layers that will be used for network reshape.
Returns
reference to this parameter structure.

◆ cfgInputReshape() [6/6]

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgInputReshape ( std::unordered_set< std::string > &&  layer_names)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
layer_namesrvalue set of the selected layers will be reshaped automatically its input image size.
Returns
reference to this parameter structure.

◆ cfgNumRequests()

template<typename Net >
Params& cv::gapi::ie::Params< Net >::cfgNumRequests ( size_t  nireq)
inline

Specifies number of asynchronous inference requests.

Parameters
nireqNumber of inference asynchronous requests.
Returns
reference to this parameter structure.

◆ cfgOutputLayers()

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::cfgOutputLayers ( const typename PortCfg< Net >::Out &  layer_names)
inline

Specifies sequence of network output layers names for inference.

The function is used to associate cv::gapi::infer<> outputs with the model outputs. Number of names has to match the number of network outputs as defined in G_API_NET(). In case a network has only single output layer, there is no need to specify name manually.

Parameters
layer_namesstd::array<std::string, N> where N is the number of outputs as defined in the G_API_NET. Contains names of output layers.
Returns
reference to this parameter structure.

◆ constInput()

template<typename Net >
Params<Net>& cv::gapi::ie::Params< Net >::constInput ( const std::string &  layer_name,
const cv::Mat data,
TraitAs  hint = TraitAs::TENSOR 
)
inline

Specifies a constant input.

The function is used to set a constant input. This input has to be a preprocessed tensor if its type is TENSOR. Need to provide name of the network layer which will receive provided data.

Parameters
layer_nameName of network layer.
datacv::Mat that contains data which will be associated with network layer.
hintInput type
See also
cv::gapi::ie::TraitAs.
Returns
reference to this parameter structure.

◆ params()

template<typename Net >
cv::util::any cv::gapi::ie::Params< Net >::params ( ) const
inline

◆ pluginConfig() [1/2]

template<typename Net >
Params& cv::gapi::ie::Params< Net >::pluginConfig ( const IEConfig cfg)
inline

Specifies OpenVINO plugin configuration.

The function is used to set configuration for OpenVINO plugin. Some parameters can be different for each plugin. Please follow https://docs.openvinotoolkit.org/latest/index.html to check information about specific plugin.

Parameters
cfgMap of pairs: (config parameter name, config parameter value).
Returns
reference to this parameter structure.

◆ pluginConfig() [2/2]

template<typename Net >
Params& cv::gapi::ie::Params< Net >::pluginConfig ( IEConfig &&  cfg)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Function with a rvalue parameter.

Parameters
cfgrvalue map of pairs: (config parameter name, config parameter value).
Returns
reference to this parameter structure.

◆ tag()

template<typename Net >
std::string cv::gapi::ie::Params< Net >::tag ( ) const
inline

Member Data Documentation

◆ desc

template<typename Net >
detail::ParamDesc cv::gapi::ie::Params< Net >::desc
protected

The documentation for this class was generated from the following file: