View Source Evision.DNN (Evision v0.1.8)
Link to this section Summary
Functions
Raising version of blobFromImage/1
.
Raising version of blobFromImage/2
.
Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Raising version of blobFromImages/1
.
Raising version of blobFromImages/2
.
Creates 4-dimensional blob from series of images. Optionally resizes and crops @p images from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Creates 4-dimensional blob from series of images. Optionally resizes and crops @p images from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Raising version of getAvailableTargets/1
.
Positional Arguments
- be:
dnn_Backend
Python prototype (for reference):
Raising version of imagesFromBlob/1
.
Raising version of imagesFromBlob/2
.
Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).
Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).
Raising version of nmsBoxes/4
.
Raising version of nmsBoxes/5
.
Performs non maximum suppression given boxes and corresponding scores.
Performs non maximum suppression given boxes and corresponding scores.
Raising version of nmsBoxesRotated/4
.
Raising version of nmsBoxesRotated/5
.
Positional Arguments
- bboxes:
[RotatedRect]
- scores:
[float]
- score_threshold:
float
- nms_threshold:
float
Keyword Arguments
- eta:
float
. - top_k:
int
.
Return
- indices:
[int]
Python prototype (for reference):
Positional Arguments
- bboxes:
[RotatedRect]
- scores:
[float]
- score_threshold:
float
- nms_threshold:
float
Keyword Arguments
- eta:
float
. - top_k:
int
.
Return
- indices:
[int]
Python prototype (for reference):
Raising version of readNet/1
.
Raising version of readNet/2
.
Raising version of readNet/3
.
Read deep learning network represented in one of the supported formats.
Variant 1:
Read deep learning network represented in one of the supported formats.
Read deep learning network represented in one of the supported formats.
Raising version of readNetFromCaffe/1
.
Raising version of readNetFromCaffe/2
.
Variant 1:
Reads a network model stored in Caffe model in memory.
Variant 1:
Reads a network model stored in Caffe model in memory.
Raising version of readNetFromDarknet/1
.
Raising version of readNetFromDarknet/2
.
Variant 1:
Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
Variant 1:
Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
Raising version of readNetFromModelOptimizer/2
.
Variant 1:
Load a network from Intel's Model Optimizer intermediate representation.
Raising version of readNetFromONNX/1
.
Variant 1:
Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer.
Raising version of readNetFromTensorflow/1
.
Raising version of readNetFromTensorflow/2
.
Variant 1:
Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
Variant 1:
Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
Raising version of readNetFromTorch/1
.
Raising version of readNetFromTorch/2
.
Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
Raising version of readTensorFromONNX/1
.
Creates blob from .pb file.
Raising version of readTorchBlob/1
.
Raising version of readTorchBlob/2
.
Loads blob which was serialized as torch.Tensor object of Torch7 framework.
Loads blob which was serialized as torch.Tensor object of Torch7 framework.
Raising version of shrinkCaffeModel/2
.
Raising version of shrinkCaffeModel/3
.
Convert all weights of Caffe network to half precision floating point.
Convert all weights of Caffe network to half precision floating point.
Raising version of softNMSBoxes/4
.
Raising version of softNMSBoxes/5
.
Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
Raising version of writeTextGraph/2
.
Create a text representation for a binary network stored in protocol buffer format.
Link to this section Functions
Raising version of blobFromImage/1
.
Raising version of blobFromImage/2
.
Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Positional Arguments
image:
Evision.Mat
.input image (with 1-, 3- or 4-channels).
Keyword Arguments
scalefactor:
double
.multiplier for @p image values.
size:
Size
.spatial size for output image
mean:
Scalar
.scalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true.
swapRB:
bool
.flag which indicates that swap first and last channels in 3-channel image is necessary.
crop:
bool
.flag which indicates whether image will be cropped after resize or not
ddepth:
int
.Depth of output blob. Choose CV_32F or CV_8U.
@details if @p crop is true, input image is resized so one side after resize is equal to corresponding dimension in @p size and another one is equal or larger. Then, crop from the center is performed. If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. @returns 4-dimensional Mat with NCHW dimensions order.
Python prototype (for reference):
blobFromImage(image[, scalefactor[, size[, mean[, swapRB[, crop[, ddepth]]]]]]) -> retval
Creates 4-dimensional blob from image. Optionally resizes and crops @p image from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Positional Arguments
image:
Evision.Mat
.input image (with 1-, 3- or 4-channels).
Keyword Arguments
scalefactor:
double
.multiplier for @p image values.
size:
Size
.spatial size for output image
mean:
Scalar
.scalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true.
swapRB:
bool
.flag which indicates that swap first and last channels in 3-channel image is necessary.
crop:
bool
.flag which indicates whether image will be cropped after resize or not
ddepth:
int
.Depth of output blob. Choose CV_32F or CV_8U.
@details if @p crop is true, input image is resized so one side after resize is equal to corresponding dimension in @p size and another one is equal or larger. Then, crop from the center is performed. If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. @returns 4-dimensional Mat with NCHW dimensions order.
Python prototype (for reference):
blobFromImage(image[, scalefactor[, size[, mean[, swapRB[, crop[, ddepth]]]]]]) -> retval
Raising version of blobFromImages/1
.
Raising version of blobFromImages/2
.
Creates 4-dimensional blob from series of images. Optionally resizes and crops @p images from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Positional Arguments
images:
[Evision.Mat]
.input images (all with 1-, 3- or 4-channels).
Keyword Arguments
scalefactor:
double
.multiplier for @p images values.
size:
Size
.spatial size for output image
mean:
Scalar
.scalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true.
swapRB:
bool
.flag which indicates that swap first and last channels in 3-channel image is necessary.
crop:
bool
.flag which indicates whether image will be cropped after resize or not
ddepth:
int
.Depth of output blob. Choose CV_32F or CV_8U.
@details if @p crop is true, input image is resized so one side after resize is equal to corresponding dimension in @p size and another one is equal or larger. Then, crop from the center is performed. If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. @returns 4-dimensional Mat with NCHW dimensions order.
Python prototype (for reference):
blobFromImages(images[, scalefactor[, size[, mean[, swapRB[, crop[, ddepth]]]]]]) -> retval
Creates 4-dimensional blob from series of images. Optionally resizes and crops @p images from center, subtract @p mean values, scales values by @p scalefactor, swap Blue and Red channels.
Positional Arguments
images:
[Evision.Mat]
.input images (all with 1-, 3- or 4-channels).
Keyword Arguments
scalefactor:
double
.multiplier for @p images values.
size:
Size
.spatial size for output image
mean:
Scalar
.scalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if @p image has BGR ordering and @p swapRB is true.
swapRB:
bool
.flag which indicates that swap first and last channels in 3-channel image is necessary.
crop:
bool
.flag which indicates whether image will be cropped after resize or not
ddepth:
int
.Depth of output blob. Choose CV_32F or CV_8U.
@details if @p crop is true, input image is resized so one side after resize is equal to corresponding dimension in @p size and another one is equal or larger. Then, crop from the center is performed. If @p crop is false, direct resize without cropping and preserving aspect ratio is performed. @returns 4-dimensional Mat with NCHW dimensions order.
Python prototype (for reference):
blobFromImages(images[, scalefactor[, size[, mean[, swapRB[, crop[, ddepth]]]]]]) -> retval
Raising version of getAvailableTargets/1
.
Positional Arguments
- be:
dnn_Backend
Python prototype (for reference):
getAvailableTargets(be) -> retval
Raising version of imagesFromBlob/1
.
Raising version of imagesFromBlob/2
.
Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).
Positional Arguments
blob_:
Evision.Mat
.4 dimensional array (images, channels, height, width) in floating point precision (CV_32F) from which you would like to extract the images.
Return
images_:
[Evision.Mat]
.array of 2D Mat containing the images extracted from the blob in floating point precision (CV_32F). They are non normalized neither mean added. The number of returned images equals the first dimension of the blob (batch size). Every image has a number of channels equals to the second dimension of the blob (depth).
Python prototype (for reference):
imagesFromBlob(blob_[, images_]) -> images_
Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).
Positional Arguments
blob_:
Evision.Mat
.4 dimensional array (images, channels, height, width) in floating point precision (CV_32F) from which you would like to extract the images.
Return
images_:
[Evision.Mat]
.array of 2D Mat containing the images extracted from the blob in floating point precision (CV_32F). They are non normalized neither mean added. The number of returned images equals the first dimension of the blob (batch size). Every image has a number of channels equals to the second dimension of the blob (depth).
Python prototype (for reference):
imagesFromBlob(blob_[, images_]) -> images_
Raising version of nmsBoxes/4
.
Raising version of nmsBoxes/5
.
Performs non maximum suppression given boxes and corresponding scores.
Positional Arguments
bboxes:
[Rect2d]
.a set of bounding boxes to apply NMS.
scores:
[float]
.a set of corresponding confidences.
score_threshold:
float
.a threshold used to filter boxes by score.
nms_threshold:
float
.a threshold used in non maximum suppression.
Keyword Arguments
eta:
float
.a coefficient in adaptive threshold formula: \f$nms_threshold_{i+1}=eta\cdot nms_threshold_i\f$.
top_k:
int
.if
>0
, keep at most @p top_k picked indices.
Return
indices:
[int]
.the kept indices of bboxes after NMS.
Python prototype (for reference):
NMSBoxes(bboxes, scores, score_threshold, nms_threshold[, eta[, top_k]]) -> indices
Performs non maximum suppression given boxes and corresponding scores.
Positional Arguments
bboxes:
[Rect2d]
.a set of bounding boxes to apply NMS.
scores:
[float]
.a set of corresponding confidences.
score_threshold:
float
.a threshold used to filter boxes by score.
nms_threshold:
float
.a threshold used in non maximum suppression.
Keyword Arguments
eta:
float
.a coefficient in adaptive threshold formula: \f$nms_threshold_{i+1}=eta\cdot nms_threshold_i\f$.
top_k:
int
.if
>0
, keep at most @p top_k picked indices.
Return
indices:
[int]
.the kept indices of bboxes after NMS.
Python prototype (for reference):
NMSBoxes(bboxes, scores, score_threshold, nms_threshold[, eta[, top_k]]) -> indices
Raising version of nmsBoxesRotated/4
.
nmsBoxesRotated!(bboxes, scores, score_threshold, nms_threshold, opts)
View SourceRaising version of nmsBoxesRotated/5
.
Positional Arguments
- bboxes:
[RotatedRect]
- scores:
[float]
- score_threshold:
float
- nms_threshold:
float
Keyword Arguments
- eta:
float
. - top_k:
int
.
Return
- indices:
[int]
Python prototype (for reference):
NMSBoxesRotated(bboxes, scores, score_threshold, nms_threshold[, eta[, top_k]]) -> indices
nmsBoxesRotated(bboxes, scores, score_threshold, nms_threshold, opts)
View SourcePositional Arguments
- bboxes:
[RotatedRect]
- scores:
[float]
- score_threshold:
float
- nms_threshold:
float
Keyword Arguments
- eta:
float
. - top_k:
int
.
Return
- indices:
[int]
Python prototype (for reference):
NMSBoxesRotated(bboxes, scores, score_threshold, nms_threshold[, eta[, top_k]]) -> indices
Raising version of readNet/1
.
Raising version of readNet/2
.
Raising version of readNet/3
.
Read deep learning network represented in one of the supported formats.
Positional Arguments
- model:
String
.Binary file contains trained weights. The following file extensions are expected for models from different frameworks:*.caffemodel
(Caffe, http://caffe.berkeleyvision.org/)*.pb
(TensorFlow, https://www.tensorflow.org/)*.t7
|*.net
(Torch, http://torch.ch/)*.weights
(Darknet, https://pjreddie.com/darknet/)*.bin
(DLDT, https://software.intel.com/openvino-toolkit)*.onnx
(ONNX, https://onnx.ai/)
Keyword Arguments
config:
String
.Text file contains network configuration. It could be a file with the following extensions:
*.prototxt
(Caffe, http://caffe.berkeleyvision.org/)*.pbtxt
(TensorFlow, https://www.tensorflow.org/)*.cfg
(Darknet, https://pjreddie.com/darknet/)*.xml
(DLDT, https://software.intel.com/openvino-toolkit)
framework:
String
.Explicit framework name tag to determine a format.
@returns Net object. This function automatically detects an origin framework of trained model and calls an appropriate function such @ref readNetFromCaffe, @ref readNetFromTensorflow, @ref readNetFromTorch or @ref readNetFromDarknet. An order of @p model and @p config arguments does not matter.
Python prototype (for reference):
readNet(model[, config[, framework]]) -> retval
Variant 1:
Read deep learning network represented in one of the supported formats.
Positional Arguments
framework:
String
.Name of origin framework.
bufferModel:
[uchar]
.A buffer with a content of binary file with weights
Keyword Arguments
bufferConfig:
[uchar]
.A buffer with a content of text file contains network configuration.
@details This is an overloaded member function, provided for convenience.
It differs from the above function only in what argument(s) it accepts.
@returns Net object.
Python prototype (for reference):
readNet(framework, bufferModel[, bufferConfig]) -> retval
Variant 2:
Read deep learning network represented in one of the supported formats.
Positional Arguments
- model:
String
.Binary file contains trained weights. The following file extensions are expected for models from different frameworks:*.caffemodel
(Caffe, http://caffe.berkeleyvision.org/)*.pb
(TensorFlow, https://www.tensorflow.org/)*.t7
|*.net
(Torch, http://torch.ch/)*.weights
(Darknet, https://pjreddie.com/darknet/)*.bin
(DLDT, https://software.intel.com/openvino-toolkit)*.onnx
(ONNX, https://onnx.ai/)
Keyword Arguments
config:
String
.Text file contains network configuration. It could be a file with the following extensions:
*.prototxt
(Caffe, http://caffe.berkeleyvision.org/)*.pbtxt
(TensorFlow, https://www.tensorflow.org/)*.cfg
(Darknet, https://pjreddie.com/darknet/)*.xml
(DLDT, https://software.intel.com/openvino-toolkit)
framework:
String
.Explicit framework name tag to determine a format.
@returns Net object. This function automatically detects an origin framework of trained model and calls an appropriate function such @ref readNetFromCaffe, @ref readNetFromTensorflow, @ref readNetFromTorch or @ref readNetFromDarknet. An order of @p model and @p config arguments does not matter.
Python prototype (for reference):
readNet(model[, config[, framework]]) -> retval
Read deep learning network represented in one of the supported formats.
Positional Arguments
framework:
String
.Name of origin framework.
bufferModel:
[uchar]
.A buffer with a content of binary file with weights
Keyword Arguments
bufferConfig:
[uchar]
.A buffer with a content of text file contains network configuration.
@details This is an overloaded member function, provided for convenience.
It differs from the above function only in what argument(s) it accepts.
@returns Net object.
Python prototype (for reference):
readNet(framework, bufferModel[, bufferConfig]) -> retval
Raising version of readNetFromCaffe/1
.
Raising version of readNetFromCaffe/2
.
Variant 1:
Reads a network model stored in Caffe model in memory.
Positional Arguments
bufferProto:
[uchar]
.buffer containing the content of the .prototxt file
Keyword Arguments
bufferModel:
[uchar]
.buffer containing the content of the .caffemodel file
@returns Net object.
Python prototype (for reference):
readNetFromCaffe(bufferProto[, bufferModel]) -> retval
Variant 2:
Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.
Positional Arguments
prototxt:
String
.path to the .prototxt file with text description of the network architecture.
Keyword Arguments
caffeModel:
String
.path to the .caffemodel file with learned network.
@returns Net object.
Python prototype (for reference):
readNetFromCaffe(prototxt[, caffeModel]) -> retval
Variant 1:
Reads a network model stored in Caffe model in memory.
Positional Arguments
bufferProto:
[uchar]
.buffer containing the content of the .prototxt file
Keyword Arguments
bufferModel:
[uchar]
.buffer containing the content of the .caffemodel file
@returns Net object.
Python prototype (for reference):
readNetFromCaffe(bufferProto[, bufferModel]) -> retval
Variant 2:
Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.
Positional Arguments
prototxt:
String
.path to the .prototxt file with text description of the network architecture.
Keyword Arguments
caffeModel:
String
.path to the .caffemodel file with learned network.
@returns Net object.
Python prototype (for reference):
readNetFromCaffe(prototxt[, caffeModel]) -> retval
Raising version of readNetFromDarknet/1
.
Raising version of readNetFromDarknet/2
.
Variant 1:
Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
Positional Arguments
bufferCfg:
[uchar]
.A buffer contains a content of .cfg file with text description of the network architecture.
Keyword Arguments
bufferModel:
[uchar]
.A buffer contains a content of .weights file with learned network.
@returns Net object.
Python prototype (for reference):
readNetFromDarknet(bufferCfg[, bufferModel]) -> retval
Variant 2:
Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
Positional Arguments
cfgFile:
String
.path to the .cfg file with text description of the network architecture.
Keyword Arguments
darknetModel:
String
.path to the .weights file with learned network.
@returns Network object that ready to do forward, throw an exception in failure cases. @returns Net object.
Python prototype (for reference):
readNetFromDarknet(cfgFile[, darknetModel]) -> retval
Variant 1:
Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
Positional Arguments
bufferCfg:
[uchar]
.A buffer contains a content of .cfg file with text description of the network architecture.
Keyword Arguments
bufferModel:
[uchar]
.A buffer contains a content of .weights file with learned network.
@returns Net object.
Python prototype (for reference):
readNetFromDarknet(bufferCfg[, bufferModel]) -> retval
Variant 2:
Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.
Positional Arguments
cfgFile:
String
.path to the .cfg file with text description of the network architecture.
Keyword Arguments
darknetModel:
String
.path to the .weights file with learned network.
@returns Network object that ready to do forward, throw an exception in failure cases. @returns Net object.
Python prototype (for reference):
readNetFromDarknet(cfgFile[, darknetModel]) -> retval
Raising version of readNetFromModelOptimizer/2
.
Variant 1:
Load a network from Intel's Model Optimizer intermediate representation.
Positional Arguments
bufferModelConfig:
[uchar]
.Buffer contains XML configuration with network's topology.
bufferWeights:
[uchar]
.Buffer contains binary data with trained weights.
@returns Net object. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.
Python prototype (for reference):
readNetFromModelOptimizer(bufferModelConfig, bufferWeights) -> retval
Variant 2:
Load a network from Intel's Model Optimizer intermediate representation.
Positional Arguments
xml:
String
.XML configuration file with network's topology.
bin:
String
.Binary file with trained weights.
@returns Net object. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.
Python prototype (for reference):
readNetFromModelOptimizer(xml, bin) -> retval
Raising version of readNetFromONNX/1
.
Variant 1:
Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer.
Positional Arguments
buffer:
[uchar]
.in-memory buffer that stores the ONNX model bytes.
@returns Network object that ready to do forward, throw an exception
in failure cases.
Python prototype (for reference):
readNetFromONNX(buffer) -> retval
Variant 2:
Reads a network model <a href="https://onnx.ai/">ONNX</a>.
Positional Arguments
onnxFile:
String
.path to the .onnx file with text description of the network architecture.
@returns Network object that ready to do forward, throw an exception in failure cases.
Python prototype (for reference):
readNetFromONNX(onnxFile) -> retval
Raising version of readNetFromTensorflow/1
.
Raising version of readNetFromTensorflow/2
.
Variant 1:
Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
Positional Arguments
bufferModel:
[uchar]
.buffer containing the content of the pb file
Keyword Arguments
bufferConfig:
[uchar]
.buffer containing the content of the pbtxt file
@returns Net object.
Python prototype (for reference):
readNetFromTensorflow(bufferModel[, bufferConfig]) -> retval
Variant 2:
Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
Positional Arguments
model:
String
.path to the .pb file with binary protobuf description of the network architecture
Keyword Arguments
config:
String
.path to the .pbtxt file that contains text graph definition in protobuf format. Resulting Net object is built by text graph using weights from a binary one that let us make it more flexible.
@returns Net object.
Python prototype (for reference):
readNetFromTensorflow(model[, config]) -> retval
Variant 1:
Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
Positional Arguments
bufferModel:
[uchar]
.buffer containing the content of the pb file
Keyword Arguments
bufferConfig:
[uchar]
.buffer containing the content of the pbtxt file
@returns Net object.
Python prototype (for reference):
readNetFromTensorflow(bufferModel[, bufferConfig]) -> retval
Variant 2:
Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.
Positional Arguments
model:
String
.path to the .pb file with binary protobuf description of the network architecture
Keyword Arguments
config:
String
.path to the .pbtxt file that contains text graph definition in protobuf format. Resulting Net object is built by text graph using weights from a binary one that let us make it more flexible.
@returns Net object.
Python prototype (for reference):
readNetFromTensorflow(model[, config]) -> retval
Raising version of readNetFromTorch/1
.
Raising version of readNetFromTorch/2
.
Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
Positional Arguments
model:
String
.path to the file, dumped from Torch by using torch.save() function.
Keyword Arguments
isBinary:
bool
.specifies whether the network was serialized in ascii mode or binary.
evaluate:
bool
.specifies testing phase of network. If true, it's similar to evaluate() method in Torch.
@returns Net object.
Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use long
type of C language,
which has various bit-length on different systems.
The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> 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):
- nn.Sequential
- nn.Parallel
- nn.Concat
- nn.Linear
- nn.SpatialConvolution
- nn.SpatialMaxPooling, nn.SpatialAveragePooling
- nn.ReLU, nn.TanH, nn.Sigmoid
- nn.Reshape
- nn.SoftMax, nn.LogSoftMax
Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
Python prototype (for reference):
readNetFromTorch(model[, isBinary[, evaluate]]) -> retval
Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.
Positional Arguments
model:
String
.path to the file, dumped from Torch by using torch.save() function.
Keyword Arguments
isBinary:
bool
.specifies whether the network was serialized in ascii mode or binary.
evaluate:
bool
.specifies testing phase of network. If true, it's similar to evaluate() method in Torch.
@returns Net object.
Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use long
type of C language,
which has various bit-length on different systems.
The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> 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):
- nn.Sequential
- nn.Parallel
- nn.Concat
- nn.Linear
- nn.SpatialConvolution
- nn.SpatialMaxPooling, nn.SpatialAveragePooling
- nn.ReLU, nn.TanH, nn.Sigmoid
- nn.Reshape
- nn.SoftMax, nn.LogSoftMax
Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
Python prototype (for reference):
readNetFromTorch(model[, isBinary[, evaluate]]) -> retval
Raising version of readTensorFromONNX/1
.
Creates blob from .pb file.
Positional Arguments
path:
String
.to the .pb file with input tensor.
@returns Mat.
Python prototype (for reference):
readTensorFromONNX(path) -> retval
Raising version of readTorchBlob/1
.
Raising version of readTorchBlob/2
.
Loads blob which was serialized as torch.Tensor object of Torch7 framework.
Positional Arguments
- filename:
String
Keyword Arguments
- isBinary:
bool
.
@warning This function has the same limitations as readNetFromTorch().
Python prototype (for reference):
readTorchBlob(filename[, isBinary]) -> retval
Loads blob which was serialized as torch.Tensor object of Torch7 framework.
Positional Arguments
- filename:
String
Keyword Arguments
- isBinary:
bool
.
@warning This function has the same limitations as readNetFromTorch().
Python prototype (for reference):
readTorchBlob(filename[, isBinary]) -> retval
Raising version of shrinkCaffeModel/2
.
Raising version of shrinkCaffeModel/3
.
Convert all weights of Caffe network to half precision floating point.
Positional Arguments
src:
String
.Path to origin model from Caffe framework contains single precision floating point weights (usually has
.caffemodel
extension).dst:
String
.Path to destination model with updated weights.
Keyword Arguments
layersTypes:
[String]
.Set of layers types which parameters will be converted. By default, converts only Convolutional and Fully-Connected layers' weights.
Note: Shrinked model has no origin float32 weights so it can't be used
in origin Caffe framework anymore. However the structure of data
is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe.
So the resulting model may be used there.
Python prototype (for reference):
shrinkCaffeModel(src, dst[, layersTypes]) -> None
Convert all weights of Caffe network to half precision floating point.
Positional Arguments
src:
String
.Path to origin model from Caffe framework contains single precision floating point weights (usually has
.caffemodel
extension).dst:
String
.Path to destination model with updated weights.
Keyword Arguments
layersTypes:
[String]
.Set of layers types which parameters will be converted. By default, converts only Convolutional and Fully-Connected layers' weights.
Note: Shrinked model has no origin float32 weights so it can't be used
in origin Caffe framework anymore. However the structure of data
is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe.
So the resulting model may be used there.
Python prototype (for reference):
shrinkCaffeModel(src, dst[, layersTypes]) -> None
Raising version of softNMSBoxes/4
.
softNMSBoxes!(bboxes, scores, score_threshold, nms_threshold, opts)
View SourceRaising version of softNMSBoxes/5
.
Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
Positional Arguments
bboxes:
[Rect]
.a set of bounding boxes to apply Soft NMS.
scores:
[float]
.a set of corresponding confidences.
score_threshold:
float
.a threshold used to filter boxes by score.
nms_threshold:
float
.a threshold used in non maximum suppression.
Keyword Arguments
top_k:
size_t
.keep at most @p top_k picked indices.
sigma:
float
.parameter of Gaussian weighting.
method:
SoftNMSMethod
.Gaussian or linear.
Return
updated_scores:
[float]
.a set of corresponding updated confidences.
indices:
[int]
.the kept indices of bboxes after NMS.
@see SoftNMSMethod
Python prototype (for reference):
softNMSBoxes(bboxes, scores, score_threshold, nms_threshold[, top_k[, sigma[, method]]]) -> updated_scores, indices
softNMSBoxes(bboxes, scores, score_threshold, nms_threshold, opts)
View SourcePerforms soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503
Positional Arguments
bboxes:
[Rect]
.a set of bounding boxes to apply Soft NMS.
scores:
[float]
.a set of corresponding confidences.
score_threshold:
float
.a threshold used to filter boxes by score.
nms_threshold:
float
.a threshold used in non maximum suppression.
Keyword Arguments
top_k:
size_t
.keep at most @p top_k picked indices.
sigma:
float
.parameter of Gaussian weighting.
method:
SoftNMSMethod
.Gaussian or linear.
Return
updated_scores:
[float]
.a set of corresponding updated confidences.
indices:
[int]
.the kept indices of bboxes after NMS.
@see SoftNMSMethod
Python prototype (for reference):
softNMSBoxes(bboxes, scores, score_threshold, nms_threshold[, top_k[, sigma[, method]]]) -> updated_scores, indices
Raising version of writeTextGraph/2
.
Create a text representation for a binary network stored in protocol buffer format.
Positional Arguments
Note: To reduce output file size, trained weights are not included.
Python prototype (for reference):
writeTextGraph(model, output) -> None