OpenCV
3.3.1
Open Source Computer Vision
|
Modules | |
Partial List of Implemented Layers | |
Utilities for New Layers Registration | |
Classes | |
class | cv::dnn::BackendNode |
Derivatives of this class encapsulates functions of certain backends. More... | |
class | cv::dnn::BackendWrapper |
Derivatives of this class wraps cv::Mat for different backends and targets. More... | |
class | cv::dnn::Dict |
This class implements name-value dictionary, values are instances of DictValue. More... | |
struct | cv::dnn::DictValue |
This struct stores the scalar value (or array) of one of the following type: double, cv::String or int64. More... | |
class | cv::dnn::Importer |
Small interface class for loading trained serialized models of different dnn-frameworks. More... | |
class | cv::dnn::Layer |
This interface class allows to build new Layers - are building blocks of networks. More... | |
class | cv::dnn::LayerParams |
This class provides all data needed to initialize layer. More... | |
class | cv::dnn::Net |
This class allows to create and manipulate comprehensive artificial neural networks. More... | |
Typedefs | |
typedef std::vector< int > | cv::dnn::MatShape |
Enumerations | |
enum | cv::dnn::Backend { cv::dnn::DNN_BACKEND_DEFAULT, cv::dnn::DNN_BACKEND_HALIDE } |
Enum of computation backends supported by layers. More... | |
enum | cv::dnn::Target { cv::dnn::DNN_TARGET_CPU, cv::dnn::DNN_TARGET_OPENCL } |
Enum of target devices for computations. More... | |
Functions | |
Mat | cv::dnn::blobFromImage (const Mat &image, double scalefactor=1.0, const Size &size=Size(), const Scalar &mean=Scalar(), bool swapRB=true, bool crop=true) |
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. More... | |
Mat | cv::dnn::blobFromImages (const std::vector< Mat > &images, double scalefactor=1.0, Size size=Size(), const Scalar &mean=Scalar(), bool swapRB=true, bool crop=true) |
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. More... | |
Ptr< Importer > | cv::dnn::createCaffeImporter (const String &prototxt, const String &caffeModel=String()) |
Creates the importer of Caffe framework network. More... | |
Ptr< Importer > | cv::dnn::createTensorflowImporter (const String &model) |
Creates the importer of TensorFlow framework network. More... | |
Ptr< Importer > | cv::dnn::createTorchImporter (const String &filename, bool isBinary=true) |
Creates the importer of Torch7 framework network. More... | |
Net | cv::dnn::readNetFromCaffe (const String &prototxt, const String &caffeModel=String()) |
Reads a network model stored in Caffe model files. More... | |
Net | cv::dnn::readNetFromDarknet (const String &cfgFile, const String &darknetModel=String()) |
Reads a network model stored in Darknet model files. More... | |
Net | cv::dnn::readNetFromTensorflow (const String &model, const String &config=String()) |
Reads a network model stored in Tensorflow model file. More... | |
Net | cv::dnn::readNetFromTorch (const String &model, bool isBinary=true) |
Reads a network model stored in Torch model file. More... | |
Mat | cv::dnn::readTorchBlob (const String &filename, bool isBinary=true) |
Loads blob which was serialized as torch.Tensor object of Torch7 framework. More... | |
void | cv::dnn::shrinkCaffeModel (const String &src, const String &dst) |
Convert all weights of Caffe network to half precision floating point. More... | |
This module contains:
Functionality of this module is designed only for forward pass computations (i. e. network testing). A network training is in principle not supported.
typedef std::vector<int> cv::dnn::MatShape |
enum cv::dnn::Backend |
enum cv::dnn::Target |
Mat cv::dnn::blobFromImage | ( | const Mat & | image, |
double | scalefactor = 1.0 , |
||
const Size & | size = Size() , |
||
const Scalar & | mean = Scalar() , |
||
bool | swapRB = true , |
||
bool | crop = true |
||
) |
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.
image | input image (with 1- or 3-channels). |
size | spatial size for output image |
mean | scalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true. |
scalefactor | multiplier for image values. |
swapRB | flag which indicates that swap first and last channels in 3-channel image is necessary. |
crop | flag which indicates whether image will be cropped after resize or not |
if crop
is true, input image is resized so one side after resize is equal to corresponing dimension in size
and another one is equal or larger. Then, crop from the center is performed. If crop
is false, direct resize without cropping and preserving aspect ratio is performed.
Mat cv::dnn::blobFromImages | ( | const std::vector< Mat > & | images, |
double | scalefactor = 1.0 , |
||
Size | size = Size() , |
||
const Scalar & | mean = Scalar() , |
||
bool | swapRB = true , |
||
bool | crop = true |
||
) |
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.
images | input images (all with 1- or 3-channels). |
size | spatial size for output image |
mean | scalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true. |
scalefactor | multiplier for images values. |
swapRB | flag which indicates that swap first and last channels in 3-channel image is necessary. |
crop | flag which indicates whether image will be cropped after resize or not |
if crop
is true, input image is resized so one side after resize is equal to corresponing dimension in size
and another one is equal or larger. Then, crop from the center is performed. If crop
is false, direct resize without cropping and preserving aspect ratio is performed.
Ptr<Importer> cv::dnn::createCaffeImporter | ( | const String & | prototxt, |
const String & | caffeModel = String() |
||
) |
Creates the importer of Caffe framework network.
prototxt | path to the .prototxt file with text description of the network architecture. |
caffeModel | path to the .caffemodel file with learned network. |
Creates the importer of TensorFlow framework network.
model | path to the .pb file with binary protobuf description of the network architecture. |
Creates the importer of Torch7 framework network.
filename | path to the file, dumped from Torch by using torch.save() function. |
isBinary | specifies whether the network was serialized in ascii mode or binary. |
opencv_dnn_BUILD_TORCH_IMPORTER
flag to compile its.long
type of C language, which has various bit-length on different systems.The loading file must contain serialized nn.Module object with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.
List of supported layers (i.e. object instances derived from Torch nn.Module class):
Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
Reads a network model stored in Caffe model files.
This is shortcut consisting from createCaffeImporter and Net::populateNet calls.
Reads a network model stored in Darknet model files.
cfgFile | path to the .cfg file with text description of the network architecture. |
darknetModel | path to the .weights file with learned network. |
This is shortcut consisting from DarknetImporter and Net::populateNet calls.
Reads a network model stored in Tensorflow model file.
This is shortcut consisting from createTensorflowImporter and Net::populateNet calls.
Reads a network model stored in Torch model file.
This is shortcut consisting from createTorchImporter and Net::populateNet calls.
Loads blob which was serialized as torch.Tensor object of Torch7 framework.
Convert all weights of Caffe network to half precision floating point.
src | Path to origin model from Caffe framework contains single precision floating point weights (usually has .caffemodel extension). |
dst | Path to destination model with updated weights. |