Package org.opencv.dnn
Class Dnn
- java.lang.Object
- 
- org.opencv.dnn.Dnn
 
- 
 public class Dnn extends java.lang.Object
- 
- 
Field SummaryFields Modifier and Type Field Description static intDNN_BACKEND_CANNstatic intDNN_BACKEND_CUDAstatic intDNN_BACKEND_DEFAULTstatic intDNN_BACKEND_HALIDEstatic intDNN_BACKEND_INFERENCE_ENGINEstatic intDNN_BACKEND_OPENCVstatic intDNN_BACKEND_TIMVXstatic intDNN_BACKEND_VKCOMstatic intDNN_BACKEND_WEBNNstatic intDNN_LAYOUT_NCDHWstatic intDNN_LAYOUT_NCHWstatic intDNN_LAYOUT_NDstatic intDNN_LAYOUT_NDHWCstatic intDNN_LAYOUT_NHWCstatic intDNN_LAYOUT_PLANARstatic intDNN_LAYOUT_UNKNOWNstatic intDNN_PMODE_CROP_CENTERstatic intDNN_PMODE_LETTERBOXstatic intDNN_PMODE_NULLstatic intDNN_TARGET_CPUstatic intDNN_TARGET_CPU_FP16static intDNN_TARGET_CUDAstatic intDNN_TARGET_CUDA_FP16static intDNN_TARGET_FPGAstatic intDNN_TARGET_HDDLstatic intDNN_TARGET_MYRIADstatic intDNN_TARGET_NPUstatic intDNN_TARGET_OPENCLstatic intDNN_TARGET_OPENCL_FP16static intDNN_TARGET_VULKANstatic intSoftNMSMethod_SOFTNMS_GAUSSIANstatic intSoftNMSMethod_SOFTNMS_LINEAR
 - 
Constructor SummaryConstructors Constructor Description Dnn()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static MatblobFromImage(Mat image)Creates 4-dimensional blob from image.static MatblobFromImage(Mat image, double scalefactor)Creates 4-dimensional blob from image.static MatblobFromImage(Mat image, double scalefactor, Size size)Creates 4-dimensional blob from image.static MatblobFromImage(Mat image, double scalefactor, Size size, Scalar mean)Creates 4-dimensional blob from image.static MatblobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB)Creates 4-dimensional blob from image.static MatblobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop)Creates 4-dimensional blob from image.static MatblobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop, int ddepth)Creates 4-dimensional blob from image.static MatblobFromImages(java.util.List<Mat> images)Creates 4-dimensional blob from series of images.static MatblobFromImages(java.util.List<Mat> images, double scalefactor)Creates 4-dimensional blob from series of images.static MatblobFromImages(java.util.List<Mat> images, double scalefactor, Size size)Creates 4-dimensional blob from series of images.static MatblobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean)Creates 4-dimensional blob from series of images.static MatblobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB)Creates 4-dimensional blob from series of images.static MatblobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop)Creates 4-dimensional blob from series of images.static MatblobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop, int ddepth)Creates 4-dimensional blob from series of images.static MatblobFromImagesWithParams(java.util.List<Mat> images)Creates 4-dimensional blob from series of images with given params.static voidblobFromImagesWithParams(java.util.List<Mat> images, Mat blob)static voidblobFromImagesWithParams(java.util.List<Mat> images, Mat blob, Image2BlobParams param)static MatblobFromImagesWithParams(java.util.List<Mat> images, Image2BlobParams param)Creates 4-dimensional blob from series of images with given params.static MatblobFromImageWithParams(Mat image)Creates 4-dimensional blob from image with given params.static voidblobFromImageWithParams(Mat image, Mat blob)static voidblobFromImageWithParams(Mat image, Mat blob, Image2BlobParams param)static MatblobFromImageWithParams(Mat image, Image2BlobParams param)Creates 4-dimensional blob from image with given params.static java.util.List<java.lang.Integer>getAvailableTargets(int be)static java.lang.StringgetInferenceEngineBackendType()Deprecated.static java.lang.StringgetInferenceEngineCPUType()Returns Inference Engine CPU type.static java.lang.StringgetInferenceEngineVPUType()Returns Inference Engine VPU type.static voidimagesFromBlob(Mat blob_, java.util.List<Mat> images_)Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).static voidNMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices)Performs non maximum suppression given boxes and corresponding scores.static voidNMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta)Performs non maximum suppression given boxes and corresponding scores.static voidNMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k)Performs non maximum suppression given boxes and corresponding scores.static voidNMSBoxesBatched(MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices)Performs batched non maximum suppression on given boxes and corresponding scores across different classes.static voidNMSBoxesBatched(MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices, float eta)Performs batched non maximum suppression on given boxes and corresponding scores across different classes.static voidNMSBoxesBatched(MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k)Performs batched non maximum suppression on given boxes and corresponding scores across different classes.static voidNMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices)static voidNMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta)static voidNMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k)static NetreadNet(java.lang.String model)Read deep learning network represented in one of the supported formats.static NetreadNet(java.lang.String model, java.lang.String config)Read deep learning network represented in one of the supported formats.static NetreadNet(java.lang.String model, java.lang.String config, java.lang.String framework)Read deep learning network represented in one of the supported formats.static NetreadNet(java.lang.String framework, MatOfByte bufferModel)Read deep learning network represented in one of the supported formats.static NetreadNet(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig)Read deep learning network represented in one of the supported formats.static NetreadNetFromCaffe(java.lang.String prototxt)Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.static NetreadNetFromCaffe(java.lang.String prototxt, java.lang.String caffeModel)Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.static NetreadNetFromCaffe(MatOfByte bufferProto)Reads a network model stored in Caffe model in memory.static NetreadNetFromCaffe(MatOfByte bufferProto, MatOfByte bufferModel)Reads a network model stored in Caffe model in memory.static NetreadNetFromDarknet(java.lang.String cfgFile)Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.static NetreadNetFromDarknet(java.lang.String cfgFile, java.lang.String darknetModel)Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.static NetreadNetFromDarknet(MatOfByte bufferCfg)Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.static NetreadNetFromDarknet(MatOfByte bufferCfg, MatOfByte bufferModel)Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.static NetreadNetFromModelOptimizer(java.lang.String xml, java.lang.String bin)Load a network from Intel's Model Optimizer intermediate representation.static NetreadNetFromModelOptimizer(MatOfByte bufferModelConfig, MatOfByte bufferWeights)Load a network from Intel's Model Optimizer intermediate representation.static NetreadNetFromONNX(java.lang.String onnxFile)Reads a network model <a href="https://onnx.ai/">ONNX</a>.static NetreadNetFromONNX(MatOfByte buffer)Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer.static NetreadNetFromTensorflow(java.lang.String model)Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.static NetreadNetFromTensorflow(java.lang.String model, java.lang.String config)Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.static NetreadNetFromTensorflow(MatOfByte bufferModel)Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.static NetreadNetFromTensorflow(MatOfByte bufferModel, MatOfByte bufferConfig)Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.static NetreadNetFromTFLite(java.lang.String model)Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.static NetreadNetFromTFLite(MatOfByte bufferModel)Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.static NetreadNetFromTorch(java.lang.String model)Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.static NetreadNetFromTorch(java.lang.String model, boolean isBinary)Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.static NetreadNetFromTorch(java.lang.String model, boolean isBinary, boolean evaluate)Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.static MatreadTensorFromONNX(java.lang.String path)Creates blob from .pb file.static MatreadTorchBlob(java.lang.String filename)Loads blob which was serialized as torch.Tensor object of Torch7 framework.static MatreadTorchBlob(java.lang.String filename, boolean isBinary)Loads blob which was serialized as torch.Tensor object of Torch7 framework.static voidreleaseHDDLPlugin()Release a HDDL plugin.static voidresetMyriadDevice()Release a Myriad device (binded by OpenCV).static java.lang.StringsetInferenceEngineBackendType(java.lang.String newBackendType)Deprecated.static voidshrinkCaffeModel(java.lang.String src, java.lang.String dst)Convert all weights of Caffe network to half precision floating point.static voidshrinkCaffeModel(java.lang.String src, java.lang.String dst, java.util.List<java.lang.String> layersTypes)Convert all weights of Caffe network to half precision floating point.static voidsoftNMSBoxes(MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices)Performs soft non maximum suppression given boxes and corresponding scores.static voidsoftNMSBoxes(MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices, long top_k)Performs soft non maximum suppression given boxes and corresponding scores.static voidsoftNMSBoxes(MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices, long top_k, float sigma)Performs soft non maximum suppression given boxes and corresponding scores.static voidwriteTextGraph(java.lang.String model, java.lang.String output)Create a text representation for a binary network stored in protocol buffer format.
 
- 
- 
- 
Field Detail- 
DNN_BACKEND_DEFAULTpublic static final int DNN_BACKEND_DEFAULT - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_HALIDEpublic static final int DNN_BACKEND_HALIDE - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_INFERENCE_ENGINEpublic static final int DNN_BACKEND_INFERENCE_ENGINE - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_OPENCVpublic static final int DNN_BACKEND_OPENCV - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_VKCOMpublic static final int DNN_BACKEND_VKCOM - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_CUDApublic static final int DNN_BACKEND_CUDA - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_WEBNNpublic static final int DNN_BACKEND_WEBNN - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_TIMVXpublic static final int DNN_BACKEND_TIMVX - See Also:
- Constant Field Values
 
 - 
DNN_BACKEND_CANNpublic static final int DNN_BACKEND_CANN - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_UNKNOWNpublic static final int DNN_LAYOUT_UNKNOWN - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_NDpublic static final int DNN_LAYOUT_ND - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_NCHWpublic static final int DNN_LAYOUT_NCHW - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_NCDHWpublic static final int DNN_LAYOUT_NCDHW - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_NHWCpublic static final int DNN_LAYOUT_NHWC - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_NDHWCpublic static final int DNN_LAYOUT_NDHWC - See Also:
- Constant Field Values
 
 - 
DNN_LAYOUT_PLANARpublic static final int DNN_LAYOUT_PLANAR - See Also:
- Constant Field Values
 
 - 
DNN_PMODE_NULLpublic static final int DNN_PMODE_NULL - See Also:
- Constant Field Values
 
 - 
DNN_PMODE_CROP_CENTERpublic static final int DNN_PMODE_CROP_CENTER - See Also:
- Constant Field Values
 
 - 
DNN_PMODE_LETTERBOXpublic static final int DNN_PMODE_LETTERBOX - See Also:
- Constant Field Values
 
 - 
SoftNMSMethod_SOFTNMS_LINEARpublic static final int SoftNMSMethod_SOFTNMS_LINEAR - See Also:
- Constant Field Values
 
 - 
SoftNMSMethod_SOFTNMS_GAUSSIANpublic static final int SoftNMSMethod_SOFTNMS_GAUSSIAN - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_CPUpublic static final int DNN_TARGET_CPU - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_OPENCLpublic static final int DNN_TARGET_OPENCL - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_OPENCL_FP16public static final int DNN_TARGET_OPENCL_FP16 - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_MYRIADpublic static final int DNN_TARGET_MYRIAD - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_VULKANpublic static final int DNN_TARGET_VULKAN - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_FPGApublic static final int DNN_TARGET_FPGA - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_CUDApublic static final int DNN_TARGET_CUDA - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_CUDA_FP16public static final int DNN_TARGET_CUDA_FP16 - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_HDDLpublic static final int DNN_TARGET_HDDL - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_NPUpublic static final int DNN_TARGET_NPU - See Also:
- Constant Field Values
 
 - 
DNN_TARGET_CPU_FP16public static final int DNN_TARGET_CPU_FP16 - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getAvailableTargetspublic static java.util.List<java.lang.Integer> getAvailableTargets(int be) 
 - 
readNetFromDarknetpublic static Net readNetFromDarknet(java.lang.String cfgFile, java.lang.String darknetModel) Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.- Parameters:
- cfgFile- path to the .cfg file with text description of the network architecture.
- darknetModel- path to the .weights file with learned network.
- Returns:
- Network object that ready to do forward, throw an exception in failure cases.
 
 - 
readNetFromDarknetpublic static Net readNetFromDarknet(java.lang.String cfgFile) Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.- Parameters:
- cfgFile- path to the .cfg file with text description of the network architecture.
- Returns:
- Network object that ready to do forward, throw an exception in failure cases.
 
 - 
readNetFromDarknetpublic static Net readNetFromDarknet(MatOfByte bufferCfg, MatOfByte bufferModel) Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.- Parameters:
- bufferCfg- A buffer contains a content of .cfg file with text description of the network architecture.
- bufferModel- A buffer contains a content of .weights file with learned network.
- Returns:
- Net object.
 
 - 
readNetFromDarknetpublic static Net readNetFromDarknet(MatOfByte bufferCfg) Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.- Parameters:
- bufferCfg- A buffer contains a content of .cfg file with text description of the network architecture.
- Returns:
- Net object.
 
 - 
readNetFromCaffepublic static Net readNetFromCaffe(java.lang.String prototxt, java.lang.String caffeModel) Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.- Parameters:
- prototxt- path to the .prototxt file with text description of the network architecture.
- caffeModel- path to the .caffemodel file with learned network.
- Returns:
- Net object.
 
 - 
readNetFromCaffepublic static Net readNetFromCaffe(java.lang.String prototxt) Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.- Parameters:
- prototxt- path to the .prototxt file with text description of the network architecture.
- Returns:
- Net object.
 
 - 
readNetFromCaffepublic static Net readNetFromCaffe(MatOfByte bufferProto, MatOfByte bufferModel) Reads a network model stored in Caffe model in memory.- Parameters:
- bufferProto- buffer containing the content of the .prototxt file
- bufferModel- buffer containing the content of the .caffemodel file
- Returns:
- Net object.
 
 - 
readNetFromCaffepublic static Net readNetFromCaffe(MatOfByte bufferProto) Reads a network model stored in Caffe model in memory.- Parameters:
- bufferProto- buffer containing the content of the .prototxt file
- Returns:
- Net object.
 
 - 
readNetFromTensorflowpublic static Net readNetFromTensorflow(java.lang.String model, java.lang.String config) Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.- Parameters:
- model- path to the .pb file with binary protobuf description of the network architecture
- config- 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.
 
 - 
readNetFromTensorflowpublic static Net readNetFromTensorflow(java.lang.String model) Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.- Parameters:
- model- path to the .pb file with binary protobuf description of the network architecture Resulting Net object is built by text graph using weights from a binary one that let us make it more flexible.
- Returns:
- Net object.
 
 - 
readNetFromTensorflowpublic static Net readNetFromTensorflow(MatOfByte bufferModel, MatOfByte bufferConfig) Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.- Parameters:
- bufferModel- buffer containing the content of the pb file
- bufferConfig- buffer containing the content of the pbtxt file
- Returns:
- Net object.
 
 - 
readNetFromTensorflowpublic static Net readNetFromTensorflow(MatOfByte bufferModel) Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.- Parameters:
- bufferModel- buffer containing the content of the pb file
- Returns:
- Net object.
 
 - 
readNetFromTFLitepublic static Net readNetFromTFLite(java.lang.String model) Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.- Parameters:
- model- path to the .tflite file with binary flatbuffers description of the network architecture
- Returns:
- Net object.
 
 - 
readNetFromTFLitepublic static Net readNetFromTFLite(MatOfByte bufferModel) Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.- Parameters:
- bufferModel- buffer containing the content of the tflite file
- Returns:
- Net object.
 
 - 
readNetFromTorchpublic static Net readNetFromTorch(java.lang.String model, boolean isBinary, boolean evaluate) Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.- Parameters:
- model- path to the file, dumped from Torch by using torch.save() function.
- isBinary- specifies whether the network was serialized in ascii mode or binary.
- evaluate- 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 longtype 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.
 
 - 
readNetFromTorchpublic static Net readNetFromTorch(java.lang.String model, boolean isBinary) Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.- Parameters:
- model- path to the file, dumped from Torch by using torch.save() function.
- isBinary- specifies whether the network was serialized in ascii mode or binary.
- Returns:
- Net object.
 Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use longtype 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.
 
 - 
readNetFromTorchpublic static Net readNetFromTorch(java.lang.String model) Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.- Parameters:
- model- path to the file, dumped from Torch by using torch.save() function.
- Returns:
- Net object.
 Note: Ascii mode of Torch serializer is more preferable, because binary mode extensively use longtype 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.
 
 - 
readNetpublic static Net readNet(java.lang.String model, java.lang.String config, java.lang.String framework) Read deep learning network represented in one of the supported formats.- Parameters:
- model- 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/)
- config- 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- 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 modelandconfigarguments does not matter.
 
 - 
readNetpublic static Net readNet(java.lang.String model, java.lang.String config) Read deep learning network represented in one of the supported formats.- Parameters:
- model- 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/)
- config- 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)
- 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 modelandconfigarguments does not matter.
 
 - 
readNetpublic static Net readNet(java.lang.String model) Read deep learning network represented in one of the supported formats.- Parameters:
- model- 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/) 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)
- 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 modelandconfigarguments does not matter.
 
 - 
readNetpublic static Net readNet(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig) Read deep learning network represented in one of the supported formats. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.- Parameters:
- framework- Name of origin framework.
- bufferModel- A buffer with a content of binary file with weights
- bufferConfig- A buffer with a content of text file contains network configuration.
- Returns:
- Net object.
 
 - 
readNetpublic static Net readNet(java.lang.String framework, MatOfByte bufferModel) Read deep learning network represented in one of the supported formats. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.- Parameters:
- framework- Name of origin framework.
- bufferModel- A buffer with a content of binary file with weights
- Returns:
- Net object.
 
 - 
readTorchBlobpublic static Mat readTorchBlob(java.lang.String filename, boolean isBinary) Loads blob which was serialized as torch.Tensor object of Torch7 framework. WARNING: This function has the same limitations as readNetFromTorch().- Parameters:
- filename- automatically generated
- isBinary- automatically generated
- Returns:
- automatically generated
 
 - 
readTorchBlobpublic static Mat readTorchBlob(java.lang.String filename) Loads blob which was serialized as torch.Tensor object of Torch7 framework. WARNING: This function has the same limitations as readNetFromTorch().- Parameters:
- filename- automatically generated
- Returns:
- automatically generated
 
 - 
readNetFromModelOptimizerpublic static Net readNetFromModelOptimizer(java.lang.String xml, java.lang.String bin) Load a network from Intel's Model Optimizer intermediate representation.- Parameters:
- xml- XML configuration file with network's topology.
- bin- Binary file with trained weights.
- Returns:
- Net object. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.
 
 - 
readNetFromModelOptimizerpublic static Net readNetFromModelOptimizer(MatOfByte bufferModelConfig, MatOfByte bufferWeights) Load a network from Intel's Model Optimizer intermediate representation.- Parameters:
- bufferModelConfig- Buffer contains XML configuration with network's topology.
- bufferWeights- 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.
 
 - 
readNetFromONNXpublic static Net readNetFromONNX(java.lang.String onnxFile) Reads a network model <a href="https://onnx.ai/">ONNX</a>.- Parameters:
- onnxFile- 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.
 
 - 
readNetFromONNXpublic static Net readNetFromONNX(MatOfByte buffer) Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer.- Parameters:
- buffer- in-memory buffer that stores the ONNX model bytes.
- Returns:
- Network object that ready to do forward, throw an exception in failure cases.
 
 - 
readTensorFromONNXpublic static Mat readTensorFromONNX(java.lang.String path) Creates blob from .pb file.- Parameters:
- path- to the .pb file with input tensor.
- Returns:
- Mat.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop, int ddepth) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels).
- scalefactor- multiplier for- imagesvalues.
- 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- imagehas BGR ordering and- swapRBis true.
- 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
- ddepth- Depth of output blob. Choose CV_32F or CV_8U. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels).
- scalefactor- multiplier for- imagesvalues.
- 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- imagehas BGR ordering and- swapRBis true.
- 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- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean, boolean swapRB) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels).
- scalefactor- multiplier for- imagesvalues.
- 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- imagehas BGR ordering and- swapRBis true.
- swapRB- flag which indicates that swap first and last channels in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image, double scalefactor, Size size, Scalar mean) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels).
- scalefactor- multiplier for- imagesvalues.
- 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- imagehas BGR ordering and- swapRBis true. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image, double scalefactor, Size size) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels).
- scalefactor- multiplier for- imagesvalues.
- size- spatial size for output image to be in (mean-R, mean-G, mean-B) order if- imagehas BGR ordering and- swapRBis true. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image, double scalefactor) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels).
- scalefactor- multiplier for- imagesvalues. to be in (mean-R, mean-G, mean-B) order if- imagehas BGR ordering and- swapRBis true. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagepublic static Mat blobFromImage(Mat image) Creates 4-dimensional blob from image. Optionally resizes and cropsimagefrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- image- input image (with 1-, 3- or 4-channels). to be in (mean-R, mean-G, mean-B) order if- imagehas BGR ordering and- swapRBis true. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop, int ddepth) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-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- imagehas BGR ordering and- swapRBis true.
- scalefactor- multiplier for- imagesvalues.
- 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
- ddepth- Depth of output blob. Choose CV_32F or CV_8U. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB, boolean crop) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-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- imagehas BGR ordering and- swapRBis true.
- scalefactor- multiplier for- imagesvalues.
- 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- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean, boolean swapRB) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-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- imagehas BGR ordering and- swapRBis true.
- scalefactor- multiplier for- imagesvalues.
- swapRB- flag which indicates that swap first and last channels in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images, double scalefactor, Size size, Scalar mean) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-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- imagehas BGR ordering and- swapRBis true.
- scalefactor- multiplier for- imagesvalues. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images, double scalefactor, Size size) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-channels).
- size- spatial size for output image to be in (mean-R, mean-G, mean-B) order if- imagehas BGR ordering and- swapRBis true.
- scalefactor- multiplier for- imagesvalues. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images, double scalefactor) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-channels). to be in (mean-R, mean-G, mean-B) order if- imagehas BGR ordering and- swapRBis true.
- scalefactor- multiplier for- imagesvalues. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImagespublic static Mat blobFromImages(java.util.List<Mat> images) Creates 4-dimensional blob from series of images. Optionally resizes and cropsimagesfrom center, subtractmeanvalues, scales values byscalefactor, swap Blue and Red channels.- Parameters:
- images- input images (all with 1-, 3- or 4-channels). to be in (mean-R, mean-G, mean-B) order if- imagehas BGR ordering and- swapRBis true. in 3-channel image is necessary. if- cropis true, input image is resized so one side after resize is equal to corresponding dimension in- sizeand another one is equal or larger. Then, crop from the center is performed. If- cropis false, direct resize without cropping and preserving aspect ratio is performed.
- Returns:
- 4-dimensional Mat with NCHW dimensions order.
 Note:
 The order and usage of scalefactorandmeanare (input - mean) * scalefactor.
 
 - 
blobFromImageWithParamspublic static Mat blobFromImageWithParams(Mat image, Image2BlobParams param) Creates 4-dimensional blob from image with given params. This function is an extension of REF: blobFromImage to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.- Parameters:
- image- input image (all with 1-, 3- or 4-channels).
- param- struct of Image2BlobParams, contains all parameters needed by processing of image to blob.
- Returns:
- 4-dimensional Mat.
 
 - 
blobFromImageWithParamspublic static Mat blobFromImageWithParams(Mat image) Creates 4-dimensional blob from image with given params. This function is an extension of REF: blobFromImage to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.- Parameters:
- image- input image (all with 1-, 3- or 4-channels).
- Returns:
- 4-dimensional Mat.
 
 - 
blobFromImageWithParamspublic static void blobFromImageWithParams(Mat image, Mat blob, Image2BlobParams param) 
 - 
blobFromImagesWithParamspublic static Mat blobFromImagesWithParams(java.util.List<Mat> images, Image2BlobParams param) Creates 4-dimensional blob from series of images with given params. This function is an extension of REF: blobFromImages to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.- Parameters:
- images- input image (all with 1-, 3- or 4-channels).
- param- struct of Image2BlobParams, contains all parameters needed by processing of image to blob.
- Returns:
- 4-dimensional Mat.
 
 - 
blobFromImagesWithParamspublic static Mat blobFromImagesWithParams(java.util.List<Mat> images) Creates 4-dimensional blob from series of images with given params. This function is an extension of REF: blobFromImages to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.- Parameters:
- images- input image (all with 1-, 3- or 4-channels).
- Returns:
- 4-dimensional Mat.
 
 - 
blobFromImagesWithParamspublic static void blobFromImagesWithParams(java.util.List<Mat> images, Mat blob, Image2BlobParams param) 
 - 
blobFromImagesWithParamspublic static void blobFromImagesWithParams(java.util.List<Mat> images, Mat blob) 
 - 
imagesFromBlobpublic static void imagesFromBlob(Mat blob_, java.util.List<Mat> images_) Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).- Parameters:
- blob_- 4 dimensional array (images, channels, height, width) in floating point precision (CV_32F) from which you would like to extract the images.
- images_- 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).
 
 - 
shrinkCaffeModelpublic static void shrinkCaffeModel(java.lang.String src, java.lang.String dst, java.util.List<java.lang.String> layersTypes)Convert all weights of Caffe network to half precision floating point.- Parameters:
- src- Path to origin model from Caffe framework contains single precision floating point weights (usually has- .caffemodelextension).
- dst- Path to destination model with updated weights.
- layersTypes- 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.
 
 - 
shrinkCaffeModelpublic static void shrinkCaffeModel(java.lang.String src, java.lang.String dst)Convert all weights of Caffe network to half precision floating point.- Parameters:
- src- Path to origin model from Caffe framework contains single precision floating point weights (usually has- .caffemodelextension).
- dst- Path to destination model with updated weights. 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.
 
 - 
writeTextGraphpublic static void writeTextGraph(java.lang.String model, java.lang.String output)Create a text representation for a binary network stored in protocol buffer format.- Parameters:
- model- A path to binary network.
- output- A path to output text file to be created. Note: To reduce output file size, trained weights are not included.
 
 - 
NMSBoxespublic static void NMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k) Performs non maximum suppression given boxes and corresponding scores.- Parameters:
- bboxes- a set of bounding boxes to apply NMS.
- scores- a set of corresponding confidences.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
- eta- a coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
- top_k- if- >0, keep at most- top_kpicked indices.
 
 - 
NMSBoxespublic static void NMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta) Performs non maximum suppression given boxes and corresponding scores.- Parameters:
- bboxes- a set of bounding boxes to apply NMS.
- scores- a set of corresponding confidences.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
- eta- a coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
 
 - 
NMSBoxespublic static void NMSBoxes(MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices) Performs non maximum suppression given boxes and corresponding scores.- Parameters:
- bboxes- a set of bounding boxes to apply NMS.
- scores- a set of corresponding confidences.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
 
 - 
NMSBoxesRotatedpublic static void NMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k) 
 - 
NMSBoxesRotatedpublic static void NMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta) 
 - 
NMSBoxesRotatedpublic static void NMSBoxesRotated(MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices) 
 - 
NMSBoxesBatchedpublic static void NMSBoxesBatched(MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k) Performs batched non maximum suppression on given boxes and corresponding scores across different classes.- Parameters:
- bboxes- a set of bounding boxes to apply NMS.
- scores- a set of corresponding confidences.
- class_ids- a set of corresponding class ids. Ids are integer and usually start from 0.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
- eta- a coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
- top_k- if- >0, keep at most- top_kpicked indices.
 
 - 
NMSBoxesBatchedpublic static void NMSBoxesBatched(MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices, float eta) Performs batched non maximum suppression on given boxes and corresponding scores across different classes.- Parameters:
- bboxes- a set of bounding boxes to apply NMS.
- scores- a set of corresponding confidences.
- class_ids- a set of corresponding class ids. Ids are integer and usually start from 0.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
- eta- a coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
 
 - 
NMSBoxesBatchedpublic static void NMSBoxesBatched(MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices) Performs batched non maximum suppression on given boxes and corresponding scores across different classes.- Parameters:
- bboxes- a set of bounding boxes to apply NMS.
- scores- a set of corresponding confidences.
- class_ids- a set of corresponding class ids. Ids are integer and usually start from 0.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
 
 - 
softNMSBoxespublic static void softNMSBoxes(MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices, long top_k, float sigma) Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503- Parameters:
- bboxes- a set of bounding boxes to apply Soft NMS.
- scores- a set of corresponding confidences.
- updated_scores- a set of corresponding updated confidences.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
- top_k- keep at most- top_kpicked indices.
- sigma- parameter of Gaussian weighting. SEE: SoftNMSMethod
 
 - 
softNMSBoxespublic static void softNMSBoxes(MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices, long top_k) Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503- Parameters:
- bboxes- a set of bounding boxes to apply Soft NMS.
- scores- a set of corresponding confidences.
- updated_scores- a set of corresponding updated confidences.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS.
- top_k- keep at most- top_kpicked indices. SEE: SoftNMSMethod
 
 - 
softNMSBoxespublic static void softNMSBoxes(MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices) Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503- Parameters:
- bboxes- a set of bounding boxes to apply Soft NMS.
- scores- a set of corresponding confidences.
- updated_scores- a set of corresponding updated confidences.
- score_threshold- a threshold used to filter boxes by score.
- nms_threshold- a threshold used in non maximum suppression.
- indices- the kept indices of bboxes after NMS. SEE: SoftNMSMethod
 
 - 
getInferenceEngineBackendType@Deprecated public static java.lang.String getInferenceEngineBackendType() Deprecated.Returns Inference Engine internal backend API. See values ofCV_DNN_BACKEND_INFERENCE_ENGINE_*macros.OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPEruntime parameter (environment variable) is ignored since 4.6.0.- Returns:
- automatically generated
 
 - 
setInferenceEngineBackendType@Deprecated public static java.lang.String setInferenceEngineBackendType(java.lang.String newBackendType) Deprecated.Specify Inference Engine internal backend API. See values ofCV_DNN_BACKEND_INFERENCE_ENGINE_*macros.- Parameters:
- newBackendType- automatically generated
- Returns:
- previous value of internal backend API
 
 - 
resetMyriadDevicepublic static void resetMyriadDevice() Release a Myriad device (binded by OpenCV). Single Myriad device cannot be shared across multiple processes which uses Inference Engine's Myriad plugin.
 - 
getInferenceEngineVPUTypepublic static java.lang.String getInferenceEngineVPUType() Returns Inference Engine VPU type. See values ofCV_DNN_INFERENCE_ENGINE_VPU_TYPE_*macros.- Returns:
- automatically generated
 
 - 
getInferenceEngineCPUTypepublic static java.lang.String getInferenceEngineCPUType() Returns Inference Engine CPU type. Specify OpenVINO plugin: CPU or ARM.- Returns:
- automatically generated
 
 - 
releaseHDDLPluginpublic static void releaseHDDLPlugin() Release a HDDL plugin.
 
- 
 
-