OpenCV  4.10.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
cv::dnn Namespace Reference

Namespaces

namespace  accessor
 
namespace  details
 

Classes

struct  _Range
 
class  AbsLayer
 
class  AccumLayer
 
class  AcoshLayer
 
class  AcosLayer
 
class  ActivationLayer
 
class  ActivationLayerInt8
 
class  ArgLayer
 ArgMax/ArgMin layer. More...
 
class  AsinhLayer
 
class  AsinLayer
 
class  AtanhLayer
 
class  AtanLayer
 
class  AttentionLayer
 
class  BackendNode
 Derivatives of this class encapsulates functions of certain backends. More...
 
class  BackendWrapper
 Derivatives of this class wraps cv::Mat for different backends and targets. More...
 
class  BaseConvolutionLayer
 
class  BatchNormLayer
 
class  BatchNormLayerInt8
 
class  BlankLayer
 
class  BNLLLayer
 
class  CeilLayer
 
class  CeluLayer
 
class  ChannelsPReLULayer
 
class  ClassificationModel
 This class represents high-level API for classification models. More...
 
class  CompareLayer
 
class  ConcatLayer
 
class  ConstLayer
 
class  ConvolutionLayer
 
class  ConvolutionLayerInt8
 
class  CorrelationLayer
 
class  CoshLayer
 
class  CosLayer
 
class  CropAndResizeLayer
 
class  CropLayer
 
class  CumSumLayer
 
class  DataAugmentationLayer
 
class  DeconvolutionLayer
 
class  DepthToSpaceLayer
 
class  DequantizeLayer
 
class  DetectionModel
 This class represents high-level API for object detection networks. More...
 
class  DetectionOutputLayer
 Detection output layer. More...
 
class  Dict
 This class implements name-value dictionary, values are instances of DictValue. More...
 
struct  DictValue
 This struct stores the scalar value (or array) of one of the following type: double, cv::String or int64. More...
 
class  EinsumLayer
 This function performs array summation based on the Einstein summation convention. The function allows for concise expressions of various mathematical operations using subscripts. More...
 
class  EltwiseLayer
 Element wise operation on inputs. More...
 
class  EltwiseLayerInt8
 
class  ELULayer
 
class  ErfLayer
 
class  ExpandLayer
 
class  ExpLayer
 
class  FlattenLayer
 
class  FloorLayer
 
class  FlowWarpLayer
 
class  GatherElementsLayer
 GatherElements layer GatherElements takes two inputs data and indices of the same rank r >= 1 and an optional attribute axis and works such that: output[i][j][k] = data[index[i][j][k]][j][k] if axis = 0 and r = 3 output[i][j][k] = data[i][index[i][j][k]][k] if axis = 1 and r = 3 output[i][j][k] = data[i][j][index[i][j][k]] if axis = 2 and r = 3. More...
 
class  GatherLayer
 Gather layer. More...
 
class  GeluApproximationLayer
 
class  GeluLayer
 
class  GemmLayer
 
class  GroupNormLayer
 
class  GRULayer
 GRU recurrent one-layer. More...
 
class  HardSigmoidLayer
 
class  HardSwishLayer
 
struct  Image2BlobParams
 Processing params of image to blob. More...
 
class  InnerProductLayer
 
class  InnerProductLayerInt8
 
class  InstanceNormLayer
 
class  InterpLayer
 Bilinear resize layer from https://github.com/cdmh/deeplab-public-ver2. More...
 
class  KeypointsModel
 This class represents high-level API for keypoints models. More...
 
class  Layer
 This interface class allows to build new Layers - are building blocks of networks. More...
 
class  LayerFactory
 Layer factory allows to create instances of registered layers. More...
 
class  LayerNormLayer
 
class  LayerParams
 This class provides all data needed to initialize layer. More...
 
class  LogLayer
 
class  LRNLayer
 
class  LSTMLayer
 LSTM recurrent layer. More...
 
class  MatMulLayer
 
class  MaxUnpoolLayer
 
class  MishLayer
 
class  Model
 This class is presented high-level API for neural networks. More...
 
class  MVNLayer
 
class  NaryEltwiseLayer
 
class  Net
 This class allows to create and manipulate comprehensive artificial neural networks. More...
 
class  NormalizeBBoxLayer
 \( L_p \) - normalization layer. More...
 
class  NotLayer
 
class  PaddingLayer
 Adds extra values for specific axes. More...
 
class  PermuteLayer
 
class  PoolingLayer
 
class  PoolingLayerInt8
 
class  PowerLayer
 
class  PriorBoxLayer
 
class  ProposalLayer
 
class  QuantizeLayer
 
class  ReciprocalLayer
 
class  ReduceLayer
 
class  RegionLayer
 
class  ReLU6Layer
 
class  ReLULayer
 
class  ReorgLayer
 
class  RequantizeLayer
 
class  ReshapeLayer
 
class  ResizeLayer
 Resize input 4-dimensional blob by nearest neighbor or bilinear strategy. More...
 
class  RNNLayer
 Classical recurrent layer. More...
 
class  RoundLayer
 
class  ScaleLayer
 
class  ScaleLayerInt8
 
class  ScatterLayer
 
class  ScatterNDLayer
 
class  SegmentationModel
 This class represents high-level API for segmentation models. More...
 
class  SeluLayer
 
class  ShiftLayer
 
class  ShiftLayerInt8
 
class  ShrinkLayer
 
class  ShuffleChannelLayer
 
class  SigmoidLayer
 
class  SignLayer
 
class  SinhLayer
 
class  SinLayer
 
class  SliceLayer
 
class  SoftmaxLayer
 
class  SoftmaxLayerInt8
 
class  SoftplusLayer
 
class  SoftsignLayer
 
class  SpaceToDepthLayer
 
class  SplitLayer
 
class  SqrtLayer
 
class  SwishLayer
 
class  TanHLayer
 
class  TanLayer
 
class  TextDetectionModel
 Base class for text detection networks. More...
 
class  TextDetectionModel_DB
 This class represents high-level API for text detection DL networks compatible with DB model. More...
 
class  TextDetectionModel_EAST
 This class represents high-level API for text detection DL networks compatible with EAST model. More...
 
class  TextRecognitionModel
 This class represents high-level API for text recognition networks. More...
 
class  ThresholdedReluLayer
 
class  TileLayer
 
class  TopKLayer
 

Typedefs

typedef std::map< std::string, std::vector< LayerFactory::Constructor > > LayerFactory_Impl
 
typedef std::vector< int > MatShape
 

Enumerations

enum  Backend {
  DNN_BACKEND_DEFAULT = 0 ,
  DNN_BACKEND_HALIDE ,
  DNN_BACKEND_INFERENCE_ENGINE ,
  DNN_BACKEND_OPENCV ,
  DNN_BACKEND_VKCOM ,
  DNN_BACKEND_CUDA ,
  DNN_BACKEND_WEBNN ,
  DNN_BACKEND_TIMVX ,
  DNN_BACKEND_CANN
}
 Enum of computation backends supported by layers. More...
 
enum  DataLayout {
  DNN_LAYOUT_UNKNOWN = 0 ,
  DNN_LAYOUT_ND = 1 ,
  DNN_LAYOUT_NCHW = 2 ,
  DNN_LAYOUT_NCDHW = 3 ,
  DNN_LAYOUT_NHWC = 4 ,
  DNN_LAYOUT_NDHWC = 5 ,
  DNN_LAYOUT_PLANAR = 6
}
 Enum of data layout for model inference. More...
 
enum  ImagePaddingMode {
  DNN_PMODE_NULL = 0 ,
  DNN_PMODE_CROP_CENTER = 1 ,
  DNN_PMODE_LETTERBOX = 2
}
 Enum of image processing mode. To facilitate the specialization pre-processing requirements of the dnn model. For example, the letter box often used in the Yolo series of models. More...
 
enum class  SoftNMSMethod {
  SoftNMSMethod::SOFTNMS_LINEAR = 1 ,
  SoftNMSMethod::SOFTNMS_GAUSSIAN = 2
}
 Enum of Soft NMS methods. More...
 
enum  Target {
  DNN_TARGET_CPU = 0 ,
  DNN_TARGET_OPENCL ,
  DNN_TARGET_OPENCL_FP16 ,
  DNN_TARGET_MYRIAD ,
  DNN_TARGET_VULKAN ,
  DNN_TARGET_FPGA ,
  DNN_TARGET_CUDA ,
  DNN_TARGET_CUDA_FP16 ,
  DNN_TARGET_HDDL ,
  DNN_TARGET_NPU ,
  DNN_TARGET_CPU_FP16
}
 Enum of target devices for computations. More...
 

Functions

Mat blobFromImage (InputArray image, double scalefactor=1.0, const Size &size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false, int ddepth=CV_32F)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
 
void blobFromImage (InputArray image, OutputArray blob, double scalefactor=1.0, const Size &size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false, int ddepth=CV_32F)
 Creates 4-dimensional blob from image.
 
Mat blobFromImages (InputArrayOfArrays images, double scalefactor=1.0, Size size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false, int ddepth=CV_32F)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.
 
void blobFromImages (InputArrayOfArrays images, OutputArray blob, double scalefactor=1.0, Size size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false, int ddepth=CV_32F)
 Creates 4-dimensional blob from series of images.
 
Mat blobFromImagesWithParams (InputArrayOfArrays images, const Image2BlobParams &param=Image2BlobParams())
 Creates 4-dimensional blob from series of images with given params.
 
void blobFromImagesWithParams (InputArrayOfArrays images, OutputArray blob, const Image2BlobParams &param=Image2BlobParams())
 
Mat blobFromImageWithParams (InputArray image, const Image2BlobParams &param=Image2BlobParams())
 Creates 4-dimensional blob from image with given params.
 
void blobFromImageWithParams (InputArray image, OutputArray blob, const Image2BlobParams &param=Image2BlobParams())
 
static MatShape concat (const MatShape &a, const MatShape &b)
 
void enableModelDiagnostics (bool isDiagnosticsMode)
 Enables detailed logging of the DNN model loading with CV DNN API.
 
std::vector< std::pair< Backend, Target > > getAvailableBackends ()
 
std::vector< TargetgetAvailableTargets (dnn::Backend be)
 
cv::String getInferenceEngineBackendType ()
 Returns Inference Engine internal backend API.
 
cv::String getInferenceEngineCPUType ()
 Returns Inference Engine CPU type.
 
cv::String getInferenceEngineVPUType ()
 Returns Inference Engine VPU type.
 
LayerFactory_ImplgetLayerFactoryImpl ()
 
MutexgetLayerFactoryMutex ()
 Get the mutex guarding LayerFactory_Impl, see getLayerFactoryImpl() function.
 
static Mat getPlane (const Mat &m, int n, int cn)
 
void imagesFromBlob (const cv::Mat &blob_, OutputArrayOfArrays images_)
 Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).
 
static bool isAllOnes (const MatShape &inputShape, int startPos, int endPos)
 
void NMSBoxes (const std::vector< Rect > &bboxes, const std::vector< float > &scores, const float score_threshold, const float nms_threshold, std::vector< int > &indices, const float eta=1.f, const int top_k=0)
 Performs non maximum suppression given boxes and corresponding scores.
 
void NMSBoxes (const std::vector< Rect2d > &bboxes, const std::vector< float > &scores, const float score_threshold, const float nms_threshold, std::vector< int > &indices, const float eta=1.f, const int top_k=0)
 
void NMSBoxes (const std::vector< RotatedRect > &bboxes, const std::vector< float > &scores, const float score_threshold, const float nms_threshold, std::vector< int > &indices, const float eta=1.f, const int top_k=0)
 
void NMSBoxesBatched (const std::vector< Rect > &bboxes, const std::vector< float > &scores, const std::vector< int > &class_ids, const float score_threshold, const float nms_threshold, std::vector< int > &indices, const float eta=1.f, const int top_k=0)
 Performs batched non maximum suppression on given boxes and corresponding scores across different classes.
 
void NMSBoxesBatched (const std::vector< Rect2d > &bboxes, const std::vector< float > &scores, const std::vector< int > &class_ids, const float score_threshold, const float nms_threshold, std::vector< int > &indices, const float eta=1.f, const int top_k=0)
 
static int normalize_axis (int axis, const MatShape &shape)
 
static int normalize_axis (int axis, int dims)
 Converts axis from [-dims; dims) (similar to Python's slice notation) to [0; dims) range.
 
static Range normalize_axis_range (const Range &r, int axisSize)
 
template<typename _Tp >
static std::ostream & operator<< (std::ostream &out, const std::vector< _Tp > &shape)
 
template<typename _Tp >
static void print (const std::vector< _Tp > &shape, const String &name="")
 
Net readNet (const String &framework, const std::vector< uchar > &bufferModel, const std::vector< uchar > &bufferConfig=std::vector< uchar >())
 Read deep learning network represented in one of the supported formats.
 
Net readNet (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config="", const String &framework="")
 Read deep learning network represented in one of the supported formats.
 
Net readNetFromCaffe (const char *bufferProto, size_t lenProto, const char *bufferModel=NULL, size_t lenModel=0)
 Reads a network model stored in Caffe model in memory.
 
Net readNetFromCaffe (const std::vector< uchar > &bufferProto, const std::vector< uchar > &bufferModel=std::vector< uchar >())
 Reads a network model stored in Caffe model in memory.
 
Net readNetFromCaffe (CV_WRAP_FILE_PATH const String &prototxt, CV_WRAP_FILE_PATH const String &caffeModel=String())
 Reads a network model stored in Caffe framework's format.
 
Net readNetFromDarknet (const char *bufferCfg, size_t lenCfg, const char *bufferModel=NULL, size_t lenModel=0)
 Reads a network model stored in Darknet model files.
 
Net readNetFromDarknet (const std::vector< uchar > &bufferCfg, const std::vector< uchar > &bufferModel=std::vector< uchar >())
 Reads a network model stored in Darknet model files.
 
Net readNetFromDarknet (CV_WRAP_FILE_PATH const String &cfgFile, CV_WRAP_FILE_PATH const String &darknetModel=String())
 Reads a network model stored in Darknet model files.
 
Net readNetFromModelOptimizer (const std::vector< uchar > &bufferModelConfig, const std::vector< uchar > &bufferWeights)
 Load a network from Intel's Model Optimizer intermediate representation.
 
Net readNetFromModelOptimizer (const uchar *bufferModelConfigPtr, size_t bufferModelConfigSize, const uchar *bufferWeightsPtr, size_t bufferWeightsSize)
 Load a network from Intel's Model Optimizer intermediate representation.
 
Net readNetFromModelOptimizer (CV_WRAP_FILE_PATH const String &xml, CV_WRAP_FILE_PATH const String &bin="")
 Load a network from Intel's Model Optimizer intermediate representation.
 
Net readNetFromONNX (const char *buffer, size_t sizeBuffer)
 Reads a network model from ONNX in-memory buffer.
 
Net readNetFromONNX (const std::vector< uchar > &buffer)
 Reads a network model from ONNX in-memory buffer.
 
Net readNetFromONNX (CV_WRAP_FILE_PATH const String &onnxFile)
 Reads a network model ONNX.
 
Net readNetFromTensorflow (const char *bufferModel, size_t lenModel, const char *bufferConfig=NULL, size_t lenConfig=0)
 Reads a network model stored in TensorFlow framework's format.
 
Net readNetFromTensorflow (const std::vector< uchar > &bufferModel, const std::vector< uchar > &bufferConfig=std::vector< uchar >())
 Reads a network model stored in TensorFlow framework's format.
 
Net readNetFromTensorflow (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config=String())
 Reads a network model stored in TensorFlow framework's format.
 
Net readNetFromTFLite (const char *bufferModel, size_t lenModel)
 Reads a network model stored in TFLite framework's format.
 
Net readNetFromTFLite (const std::vector< uchar > &bufferModel)
 Reads a network model stored in TFLite framework's format.
 
Net readNetFromTFLite (CV_WRAP_FILE_PATH const String &model)
 Reads a network model stored in TFLite framework's format.
 
Net readNetFromTorch (CV_WRAP_FILE_PATH const String &model, bool isBinary=true, bool evaluate=true)
 Reads a network model stored in Torch7 framework's format.
 
Mat readTensorFromONNX (CV_WRAP_FILE_PATH const String &path)
 Creates blob from .pb file.
 
Mat readTorchBlob (const String &filename, bool isBinary=true)
 Loads blob which was serialized as torch.Tensor object of Torch7 framework.
 
void releaseHDDLPlugin ()
 Release a HDDL plugin.
 
void resetMyriadDevice ()
 Release a Myriad device (binded by OpenCV).
 
cv::String setInferenceEngineBackendType (const cv::String &newBackendType)
 Specify Inference Engine internal backend API.
 
static MatShape shape (const int *dims, const int n)
 
static MatShape shape (const Mat &mat)
 
static MatShape shape (const MatSize &sz)
 
static MatShape shape (const UMat &mat)
 
static MatShape shape (int a0, int a1=-1, int a2=-1, int a3=-1)
 
void shrinkCaffeModel (CV_WRAP_FILE_PATH const String &src, CV_WRAP_FILE_PATH const String &dst, const std::vector< String > &layersTypes=std::vector< String >())
 Convert all weights of Caffe network to half precision floating point.
 
void skipModelImport (bool skip)
 Skip model import after diagnostic run in readNet() functions.
 
static Mat slice (const Mat &m, const _Range &r0)
 
static Mat slice (const Mat &m, const _Range &r0, const _Range &r1)
 
static Mat slice (const Mat &m, const _Range &r0, const _Range &r1, const _Range &r2)
 
static Mat slice (const Mat &m, const _Range &r0, const _Range &r1, const _Range &r2, const _Range &r3)
 
void softNMSBoxes (const std::vector< Rect > &bboxes, const std::vector< float > &scores, std::vector< float > &updated_scores, const float score_threshold, const float nms_threshold, std::vector< int > &indices, size_t top_k=0, const float sigma=0.5, SoftNMSMethod method=SoftNMSMethod::SOFTNMS_GAUSSIAN)
 Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503.
 
template<typename _Tp >
static std::string toString (const std::vector< _Tp > &shape, const String &name="")
 
static int total (const Mat &mat, int start=-1, int end=-1)
 
static int total (const MatShape &shape, int start=-1, int end=-1)
 
void writeTextGraph (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &output)
 Create a text representation for a binary network stored in protocol buffer format.
 

Function Documentation

◆ concat()

static MatShape cv::dnn::concat ( const MatShape a,
const MatShape b 
)
inlinestatic

◆ getInferenceEngineBackendType()

cv::String cv::dnn::getInferenceEngineBackendType ( )

Returns Inference Engine internal backend API.

See values of CV_DNN_BACKEND_INFERENCE_ENGINE_* macros.

OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPE runtime parameter (environment variable) is ignored since 4.6.0.

Deprecated:

◆ getInferenceEngineCPUType()

cv::String cv::dnn::getInferenceEngineCPUType ( )

Returns Inference Engine CPU type.

Specify OpenVINO plugin: CPU or ARM.

◆ getInferenceEngineVPUType()

cv::String cv::dnn::getInferenceEngineVPUType ( )

Returns Inference Engine VPU type.

See values of CV_DNN_INFERENCE_ENGINE_VPU_TYPE_* macros.

◆ getPlane()

static Mat cv::dnn::getPlane ( const Mat m,
int  n,
int  cn 
)
inlinestatic
Here is the call graph for this function:

◆ isAllOnes()

static bool cv::dnn::isAllOnes ( const MatShape inputShape,
int  startPos,
int  endPos 
)
inlinestatic

◆ normalize_axis() [1/2]

static int cv::dnn::normalize_axis ( int  axis,
const MatShape shape 
)
inlinestatic
Here is the call graph for this function:

◆ normalize_axis() [2/2]

static int cv::dnn::normalize_axis ( int  axis,
int  dims 
)
inlinestatic

Converts axis from [-dims; dims) (similar to Python's slice notation) to [0; dims) range.

◆ normalize_axis_range()

static Range cv::dnn::normalize_axis_range ( const Range r,
int  axisSize 
)
inlinestatic
Here is the call graph for this function:

◆ operator<<()

template<typename _Tp >
static std::ostream & cv::dnn::operator<< ( std::ostream &  out,
const std::vector< _Tp > &  shape 
)
inlinestatic
Here is the call graph for this function:

◆ print()

template<typename _Tp >
static void cv::dnn::print ( const std::vector< _Tp > &  shape,
const String name = "" 
)
inlinestatic
Here is the call graph for this function:

◆ releaseHDDLPlugin()

void cv::dnn::releaseHDDLPlugin ( )

Release a HDDL plugin.

◆ resetMyriadDevice()

void cv::dnn::resetMyriadDevice ( )

Release a Myriad device (binded by OpenCV).

Single Myriad device cannot be shared across multiple processes which uses Inference Engine's Myriad plugin.

◆ setInferenceEngineBackendType()

cv::String cv::dnn::setInferenceEngineBackendType ( const cv::String newBackendType)

Specify Inference Engine internal backend API.

See values of CV_DNN_BACKEND_INFERENCE_ENGINE_* macros.

Returns
previous value of internal backend API
Deprecated:

◆ shape() [1/5]

static MatShape cv::dnn::shape ( const int *  dims,
const int  n 
)
inlinestatic
Here is the call graph for this function:

◆ shape() [2/5]

static MatShape cv::dnn::shape ( const Mat mat)
inlinestatic
Here is the call graph for this function:

◆ shape() [3/5]

static MatShape cv::dnn::shape ( const MatSize sz)
inlinestatic
Here is the call graph for this function:

◆ shape() [4/5]

static MatShape cv::dnn::shape ( const UMat mat)
inlinestatic
Here is the call graph for this function:

◆ shape() [5/5]

static MatShape cv::dnn::shape ( int  a0,
int  a1 = -1,
int  a2 = -1,
int  a3 = -1 
)
inlinestatic
Here is the call graph for this function:

◆ skipModelImport()

void cv::dnn::skipModelImport ( bool  skip)

Skip model import after diagnostic run in readNet() functions.

Parameters
[in]skipIndicates whether to skip the import.

This is an internal OpenCV function not intended for users.

◆ slice() [1/4]

static Mat cv::dnn::slice ( const Mat m,
const _Range r0 
)
inlinestatic
Here is the call graph for this function:

◆ slice() [2/4]

static Mat cv::dnn::slice ( const Mat m,
const _Range r0,
const _Range r1 
)
inlinestatic
Here is the call graph for this function:

◆ slice() [3/4]

static Mat cv::dnn::slice ( const Mat m,
const _Range r0,
const _Range r1,
const _Range r2 
)
inlinestatic
Here is the call graph for this function:

◆ slice() [4/4]

static Mat cv::dnn::slice ( const Mat m,
const _Range r0,
const _Range r1,
const _Range r2,
const _Range r3 
)
inlinestatic
Here is the call graph for this function:

◆ toString()

template<typename _Tp >
static std::string cv::dnn::toString ( const std::vector< _Tp > &  shape,
const String name = "" 
)
inlinestatic
Here is the call graph for this function:

◆ total() [1/2]

static int cv::dnn::total ( const Mat mat,
int  start = -1,
int  end = -1 
)
inlinestatic
Here is the call graph for this function:

◆ total() [2/2]

static int cv::dnn::total ( const MatShape shape,
int  start = -1,
int  end = -1 
)
inlinestatic
Here is the call graph for this function: