Class ClassificationModel
- Namespace
- OpenCvSharp.Dnn
- Assembly
- OpenCvSharp.dll
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.
public class ClassificationModel : Model, IDisposable
- Inheritance
-
ClassificationModel
- Implements
- Inherited Members
Constructors
ClassificationModel(Net)
Create model from deep learning network.
public ClassificationModel(Net network)
Parameters
networkNetNet object.
ClassificationModel(string, string?)
Create classification model from network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.
public ClassificationModel(string model, string? config = null)
Parameters
modelstringBinary file contains trained weights.
configstringText file contains network configuration.
Methods
Classify(InputArray, out int, out float)
Given the @p input frame, create input blob, run net and return top-1 prediction.
public void Classify(InputArray frame, out int classId, out float conf)
Parameters
frameInputArrayThe input image.
classIdintTop-1 predicted class id.
conffloatTop-1 prediction confidence.
GetEnableSoftmaxPostProcessing()
Get enable/disable softmax post processing option.
public bool GetEnableSoftmaxPostProcessing()
Returns
- bool
true if softmax post processing is enabled.
SetEnableSoftmaxPostProcessing(bool)
Set enable/disable softmax post processing option.
public void SetEnableSoftmaxPostProcessing(bool enable)
Parameters
enableboolSet enable softmax post processing.