OpenCV  4.10.0
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::gapi::onnx::Params< cv::gapi::Generic > Class Reference

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

Public Member Functions

 Params (const std::string &tag, const std::string &model_path)
 Class constructor.
GBackend backend () const
void cfgAddExecutionProvider (ep::CoreML &&ep)
void cfgAddExecutionProvider (ep::CUDA &&ep)
void cfgAddExecutionProvider (ep::DirectML &&ep)
void cfgAddExecutionProvider (ep::OpenVINO &&ep)
void cfgAddExecutionProvider (ep::TensorRT &&ep)
void cfgDisableMemPattern ()
Params< cv::gapi::Generic > & cfgInputLayers (const typename PortCfg< cv::gapi::Generic >::In &layer_names)
 Specifies sequence of network input layers names for inference.
Params< cv::gapi::Generic > & cfgMeanStd (const typename PortCfg< cv::gapi::Generic >::NormCoefs &m, const typename PortCfg< cv::gapi::Generic >::NormCoefs &s)
 Specifies mean value and standard deviation for preprocessing.
void cfgMeanStdDev (const std::string &layer, const cv::Scalar &m, const cv::Scalar &s)
void cfgNormalize (const std::string &layer, bool flag)
Params< cv::gapi::Generic > & cfgOutputLayers (const typename PortCfg< cv::gapi::Generic >::Out &layer_names)
 Specifies sequence of output layers names for inference.
Params< cv::gapi::Generic > & cfgPostProc (const std::vector< cv::GMatDesc > &out_metas, const PostProc &remap_function)
 Configures graph output and provides the post processing function from user.
Params< cv::gapi::Generic > & constInput (const std::string &layer_name, const cv::Mat &data, TraitAs hint=TraitAs::TENSOR)
 Sets a constant input.
cv::util::any params () const
std::string tag () const

Protected Attributes

detail::ParamDesc desc
std::string m_tag

Constructor & Destructor Documentation

◆ Params()

cv::gapi::onnx::Params< cv::gapi::Generic >::Params ( const std::string & tag,
const std::string & model_path )
inline

Class constructor.

Constructs Params based on input information and sets default values for other inference description parameters.

Parameters
tagstring tag of the network for which these parameters are intended.
model_pathpath to model file (.onnx file).

Member Function Documentation

◆ backend()

GBackend cv::gapi::onnx::Params< cv::gapi::Generic >::backend ( ) const
inline

◆ cfgAddExecutionProvider() [1/5]

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgAddExecutionProvider ( ep::CoreML && ep)
inline

◆ cfgAddExecutionProvider() [2/5]

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgAddExecutionProvider ( ep::CUDA && ep)
inline

◆ cfgAddExecutionProvider() [3/5]

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgAddExecutionProvider ( ep::DirectML && ep)
inline

◆ cfgAddExecutionProvider() [4/5]

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgAddExecutionProvider ( ep::OpenVINO && ep)
inline

◆ cfgAddExecutionProvider() [5/5]

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgAddExecutionProvider ( ep::TensorRT && ep)
inline

◆ cfgDisableMemPattern()

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgDisableMemPattern ( )
inline

◆ cfgInputLayers()

Params< cv::gapi::Generic > & cv::gapi::onnx::Params< cv::gapi::Generic >::cfgInputLayers ( const typename PortCfg< cv::gapi::Generic >::In & layer_names)
inline

Specifies sequence of network input layers names for inference.

The function is used to associate data of graph inputs with input layers of network topology. Number of names has to match the number of network inputs. If a network has only one input layer, there is no need to call it as the layer is associated with input automatically but this doesn't prevent you from doing it yourself. Count of names has to match to number of network inputs.

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
the reference on modified object.

◆ cfgMeanStd()

Params< cv::gapi::Generic > & cv::gapi::onnx::Params< cv::gapi::Generic >::cfgMeanStd ( const typename PortCfg< cv::gapi::Generic >::NormCoefs & m,
const typename PortCfg< cv::gapi::Generic >::NormCoefs & s )
inline

Specifies mean value and standard deviation for preprocessing.

The function is used to set mean value and standard deviation for preprocessing of input data.

Parameters
mstd::array<cv::Scalar, N> where N is the number of inputs as defined in the G_API_NET. Contains mean values.
sstd::array<cv::Scalar, N> where N is the number of inputs as defined in the G_API_NET. Contains standard deviation values.
Returns
the reference on modified object.

◆ cfgMeanStdDev()

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgMeanStdDev ( const std::string & layer,
const cv::Scalar & m,
const cv::Scalar & s )
inline
See also
onnx::Params::cfgMeanStdDev.

◆ cfgNormalize()

void cv::gapi::onnx::Params< cv::gapi::Generic >::cfgNormalize ( const std::string & layer,
bool flag )
inline

◆ cfgOutputLayers()

Params< cv::gapi::Generic > & cv::gapi::onnx::Params< cv::gapi::Generic >::cfgOutputLayers ( const typename PortCfg< cv::gapi::Generic >::Out & layer_names)
inline

Specifies sequence of output layers names for inference.

The function is used to associate data of graph outputs with output layers of network topology. If a network has only one output layer, there is no need to call it as the layer is associated with output automatically but this doesn't prevent you from doing it yourself. Count of names has to match to number of network outputs or you can set your own output but for this case you have to additionally use cfgPostProc function.

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
the reference on modified object.

◆ cfgPostProc()

Params< cv::gapi::Generic > & cv::gapi::onnx::Params< cv::gapi::Generic >::cfgPostProc ( const std::vector< cv::GMatDesc > & out_metas,
const PostProc & remap_function )
inline

Configures graph output and provides the post processing function from user.

The function is used when you work with networks with dynamic outputs. Since we can't know dimensions of inference result needs provide them for construction of graph output. This dimensions can differ from inference result. So you have to provide PostProc function that gets information from inference result and fill output which is constructed by dimensions from out_metas.

Parameters
out_metasOut meta information about your output (type, dimension).
remap_functionPost processing function, which has two parameters. First is onnx result, second is graph output. Both parameters is std::map that contain pair of layer's name and cv::Mat.
Returns
the reference on modified object.

◆ constInput()

Params< cv::gapi::Generic > & cv::gapi::onnx::Params< cv::gapi::Generic >::constInput ( const std::string & layer_name,
const cv::Mat & data,
TraitAs hint = TraitAs::TENSOR )
inline

Sets a constant input.

The function is used to set constant input. This input has to be a prepared tensor since preprocessing is disabled for this case. You should provide name of 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.
hintType of input (TENSOR).
Returns
the reference on modified object.

◆ params()

◆ tag()

std::string cv::gapi::onnx::Params< cv::gapi::Generic >::tag ( ) const
inline

Member Data Documentation

◆ desc

◆ m_tag

std::string cv::gapi::onnx::Params< cv::gapi::Generic >::m_tag
protected

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