OpenCV  4.10.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
cv::gapi::ov::Params< Net > Struct Template Reference

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

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

Collaboration diagram for cv::gapi::ov::Params< Net >:

Public Member Functions

 Params (const std::string &blob_path, const std::string &device)
 
 Params (const std::string &model_path, const std::string &bin_path, const std::string &device)
 Class constructor.
 
GBackend backend () const
 
Params< Net > & cfgInputLayers (const std::vector< std::string > &layer_names)
 Specifies sequence of network input layers names for inference.
 
Params< Net > & cfgInputModelLayout (detail::AttrMap< std::string > layout_map)
 
Params< Net > & cfgInputModelLayout (std::string layout)
 Specifies model layout for an input layer.
 
Params< Net > & cfgInputTensorLayout (detail::AttrMap< std::string > layout_map)
 
Params< Net > & cfgInputTensorLayout (std::string layout)
 Specifies tensor layout for an input layer.
 
Params< Net > & cfgMean (detail::AttrMap< std::vector< float > > mean_map)
 
Params< Net > & cfgMean (std::vector< float > mean_values)
 Specifies mean values for preprocessing.
 
Params< Net > & cfgNumRequests (const size_t nireq)
 Specifies number of asynchronous inference requests.
 
Params< Net > & cfgOutputLayers (const std::vector< std::string > &layer_names)
 Specifies sequence of network output layers names for inference.
 
Params< Net > & cfgOutputModelLayout (detail::AttrMap< std::string > layout_map)
 
Params< Net > & cfgOutputModelLayout (std::string layout)
 Specifies model layout for an output layer.
 
Params< Net > & cfgOutputTensorLayout (detail::AttrMap< std::string > layout_map)
 
Params< Net > & cfgOutputTensorLayout (std::string layout)
 Specifies tensor layout for an output layer.
 
Params< Net > & cfgOutputTensorPrecision (detail::AttrMap< int > precision_map)
 
Params< Net > & cfgOutputTensorPrecision (int precision)
 Specifies tensor precision for an output layer.
 
Params< Net > & cfgPluginConfig (const detail::ParamDesc::PluginConfigT &config)
 Specifies OpenVINO plugin configuration.
 
Params< Net > & cfgReshape (detail::AttrMap< std::vector< size_t > > new_shape_map)
 
Params< Net > & cfgReshape (std::vector< size_t > new_shape)
 Specifies the new shape for input layers.
 
Params< Net > & cfgResize (detail::AttrMap< int > interpolation)
 
Params< Net > & cfgResize (int interpolation)
 Specifies resize interpolation algorithm.
 
Params< Net > & cfgScale (detail::AttrMap< std::vector< float > > scale_map)
 
Params< Net > & cfgScale (std::vector< float > scale_values)
 Specifies scale values for preprocessing.
 
cv::util::any params () const
 
std::string tag () const
 

Protected Attributes

detail::ParamDesc m_desc
 

Detailed Description

template<typename Net>
struct cv::gapi::ov::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::ov::Params< Net >::Params ( const std::string &  model_path,
const std::string &  bin_path,
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
model_pathPath to a model.
bin_pathPath to a data file. For IR format (*.bin): If path is empty, will try to read a bin file with the same name as xml. If the bin file with the same name is not found, will load IR without weights. For PDPD (*.pdmodel) and ONNX (*.onnx) formats bin_path isn't used.
devicetarget device to use.

◆ Params() [2/2]

template<typename Net >
cv::gapi::ov::Params< Net >::Params ( const std::string &  blob_path,
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
blob_pathpath to the compiled model (*.blob).
devicetarget device to use.

Member Function Documentation

◆ backend()

template<typename Net >
GBackend cv::gapi::ov::Params< Net >::backend ( ) const
inline
Here is the call graph for this function:

◆ cfgInputLayers()

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgInputLayers ( const std::vector< std::string > &  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.

◆ cfgInputModelLayout() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgInputModelLayout ( detail::AttrMap< std::string >  layout_map)
inline

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

Parameters
layout_mapMap of pairs: name of corresponding input layer and its model layout ("NCHW", "NHWC", etc)
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgInputModelLayout() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgInputModelLayout ( std::string  layout)
inline

Specifies model layout for an input layer.

The function is used to set model layout for an input layer.

Parameters
layoutModel layout ("NCHW", "NHWC", etc) will be applied to all input layers.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgInputTensorLayout() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgInputTensorLayout ( detail::AttrMap< std::string >  layout_map)
inline

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

Parameters
layout_mapMap of pairs: name of corresponding input layer and its tensor layout represented in std::string ("NCHW", "NHWC", etc)
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgInputTensorLayout() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgInputTensorLayout ( std::string  layout)
inline

Specifies tensor layout for an input layer.

The function is used to set tensor layout for an input layer.

Parameters
layoutTensor layout ("NCHW", "NWHC", etc) will be applied to all input layers.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgMean() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgMean ( detail::AttrMap< std::vector< float > >  mean_map)
inline

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

Parameters
mean_mapMap of pairs: name of corresponding input layer and its mean values.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgMean() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgMean ( std::vector< float >  mean_values)
inline

Specifies mean values for preprocessing.

The function is used to set mean values for input layer preprocessing.

Parameters
mean_valuesFloat vector contains mean values
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgNumRequests()

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

Specifies number of asynchronous inference requests.

Parameters
nireqNumber of inference asynchronous requests.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgOutputLayers()

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputLayers ( const std::vector< std::string > &  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.

◆ cfgOutputModelLayout() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputModelLayout ( detail::AttrMap< std::string >  layout_map)
inline

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

Parameters
layout_mapMap of pairs: name of corresponding output layer and its model layout ("NCHW", "NHWC", etc)
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgOutputModelLayout() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputModelLayout ( std::string  layout)
inline

Specifies model layout for an output layer.

The function is used to set model layout for an output layer.

Parameters
layoutModel layout ("NCHW", "NHWC", etc) will be applied to all output layers.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgOutputTensorLayout() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputTensorLayout ( detail::AttrMap< std::string >  layout_map)
inline

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

Parameters
layout_mapMap of pairs: name of corresponding output layer and its tensor layout represented in std::string ("NCHW", "NHWC", etc)
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgOutputTensorLayout() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputTensorLayout ( std::string  layout)
inline

Specifies tensor layout for an output layer.

The function is used to set tensor layout for an output layer.

Parameters
layoutTensor layout ("NCHW", "NWHC", etc) will be applied to all output layers.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgOutputTensorPrecision() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputTensorPrecision ( detail::AttrMap< int >  precision_map)
inline

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

Parameters
precision_mapMap of pairs: name of corresponding output layer and its precision in OpenCV format (CV_8U, CV_32F, ...)
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgOutputTensorPrecision() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgOutputTensorPrecision ( int  precision)
inline

Specifies tensor precision for an output layer.

The function is used to set tensor precision for an output layer..

Parameters
precisionPrecision in OpenCV format (CV_8U, CV_32F, ...) will be applied to all output layers.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgPluginConfig()

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgPluginConfig ( const detail::ParamDesc::PluginConfigT config)
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
configMap of pairs: (config parameter name, config parameter value).
Returns
reference to this parameter structure.

◆ cfgReshape() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgReshape ( detail::AttrMap< std::vector< size_t > >  new_shape_map)
inline

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

Parameters
new_shape_mapMap of pairs: name of corresponding output layer and its new shape.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgReshape() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgReshape ( std::vector< size_t >  new_shape)
inline

Specifies the new shape for input layers.

The function is used to set new shape for input layers.

Parameters
new_shapeNew shape will be applied to all input layers.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgResize() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgResize ( detail::AttrMap< int >  interpolation)
inline

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

Parameters
interpolationMap of pairs: name of corresponding input layer and its resize algorithm.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgResize() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgResize ( int  interpolation)
inline

Specifies resize interpolation algorithm.

The function is used to configure resize preprocessing for input layer.

Parameters
interpolationResize interpolation algorithm. Supported algorithms: INTER_NEAREST, INTER_LINEAR, INTER_CUBIC.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgScale() [1/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgScale ( detail::AttrMap< std::vector< float > >  scale_map)
inline

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

Parameters
scale_mapMap of pairs: name of corresponding input layer and its mean values.
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ cfgScale() [2/2]

template<typename Net >
Params< Net > & cv::gapi::ov::Params< Net >::cfgScale ( std::vector< float >  scale_values)
inline

Specifies scale values for preprocessing.

The function is used to set scale values for input layer preprocessing.

Parameters
scale_valuesFloat vector contains scale values
Returns
reference to this parameter structure.
Here is the call graph for this function:

◆ params()

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

◆ tag()

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

Member Data Documentation

◆ m_desc

template<typename Net >
detail::ParamDesc cv::gapi::ov::Params< Net >::m_desc
protected

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