Package org.opencv.dnn
Class ClassificationModel
- java.lang.Object
- 
- org.opencv.dnn.Model
- 
- org.opencv.dnn.ClassificationModel
 
 
- 
 public class ClassificationModel extends Model This class represents high-level API for classification models. ClassificationModel allows to set params for preprocessing input image. ClassificationModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return top-1 prediction.
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedClassificationModel(long addr)ClassificationModel(java.lang.String model)Create classification model from network represented in one of the supported formats.ClassificationModel(java.lang.String model, java.lang.String config)Create classification model from network represented in one of the supported formats.ClassificationModel(Net network)Create model from deep learning network.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClassificationModel__fromPtr__(long addr)voidclassify(Mat frame, int[] classId, float[] conf)protected voidfinalize()booleangetEnableSoftmaxPostProcessing()Get enable/disable softmax post processing option.ClassificationModelsetEnableSoftmaxPostProcessing(boolean enable)Set enable/disable softmax post processing option.- 
Methods inherited from class org.opencv.dnn.ModelenableWinograd, getNativeObjAddr, predict, setInputCrop, setInputMean, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputScale, setInputSize, setInputSize, setInputSwapRB, setPreferableBackend, setPreferableTarget
 
- 
 
- 
- 
- 
Constructor Detail- 
ClassificationModelprotected ClassificationModel(long addr) 
 - 
ClassificationModelpublic ClassificationModel(java.lang.String model, java.lang.String config)Create classification model from network represented in one of the supported formats. An order ofmodelandconfigarguments does not matter.- Parameters:
- model- Binary file contains trained weights.
- config- Text file contains network configuration.
 
 - 
ClassificationModelpublic ClassificationModel(java.lang.String model) Create classification model from network represented in one of the supported formats. An order ofmodelandconfigarguments does not matter.- Parameters:
- model- Binary file contains trained weights.
 
 - 
ClassificationModelpublic ClassificationModel(Net network) Create model from deep learning network.- Parameters:
- network- Net object.
 
 
- 
 - 
Method Detail- 
__fromPtr__public static ClassificationModel __fromPtr__(long addr) 
 - 
setEnableSoftmaxPostProcessingpublic ClassificationModel setEnableSoftmaxPostProcessing(boolean enable) Set enable/disable softmax post processing option. If this option is true, softmax is applied after forward inference within the classify() function to convert the confidences range to [0.0-1.0]. This function allows you to toggle this behavior. Please turn true when not contain softmax layer in model.- Parameters:
- enable- Set enable softmax post processing within the classify() function.
- Returns:
- automatically generated
 
 - 
getEnableSoftmaxPostProcessingpublic boolean getEnableSoftmaxPostProcessing() Get enable/disable softmax post processing option. This option defaults to false, softmax post processing is not applied within the classify() function.- Returns:
- automatically generated
 
 - 
classifypublic void classify(Mat frame, int[] classId, float[] conf) 
 
- 
 
-