OpenCV for Unity
2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
|
This class represents high-level API for classification models. More...
Public Member Functions | |
ClassificationModel (string model, string config) | |
Create classification model from network represented in one of the supported formats. An order of model and config arguments does not matter. More... | |
ClassificationModel (string model) | |
Create classification model from network represented in one of the supported formats. An order of model and config arguments does not matter. More... | |
ClassificationModel (Net network) | |
Create model from deep learning network. More... | |
ClassificationModel | setEnableSoftmaxPostProcessing (bool enable) |
Set enable/disable softmax post processing option. More... | |
bool | getEnableSoftmaxPostProcessing () |
Get enable/disable softmax post processing option. More... | |
void | classify (Mat frame, int[] classId, float[] conf) |
Public Member Functions inherited from OpenCVForUnity.DnnModule.Model | |
IntPtr | getNativeObjAddr () |
Model (string model, string config) | |
Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter. More... | |
Model (string model) | |
Create model from deep learning network represented in one of the supported formats. An order of model and config arguments does not matter. More... | |
Model (Net network) | |
Create model from deep learning network. More... | |
Model | setInputSize (Size size) |
Set input size for frame. More... | |
Model | setInputSize (int width, int height) |
Model | setInputMean (Scalar mean) |
Set mean value for frame. More... | |
Model | setInputScale (Scalar scale) |
Set scalefactor value for frame. More... | |
Model | setInputCrop (bool crop) |
Set flag crop for frame. More... | |
Model | setInputSwapRB (bool swapRB) |
Set flag swapRB for frame. More... | |
void | setInputParams (double scale, Size size, Scalar mean, bool swapRB, bool crop) |
Set preprocessing parameters for frame. More... | |
void | setInputParams (double scale, Size size, Scalar mean, bool swapRB) |
Set preprocessing parameters for frame. More... | |
void | setInputParams (double scale, Size size, Scalar mean) |
Set preprocessing parameters for frame. More... | |
void | setInputParams (double scale, Size size) |
Set preprocessing parameters for frame. More... | |
void | setInputParams (double scale) |
Set preprocessing parameters for frame. More... | |
void | setInputParams () |
Set preprocessing parameters for frame. More... | |
void | predict (Mat frame, List< Mat > outs) |
Given the input frame, create input blob, run net and return the output blobs . More... | |
Model | setPreferableBackend (int backendId) |
Model | setPreferableTarget (int targetId) |
Model | enableWinograd (bool useWinograd) |
Public Member Functions inherited from OpenCVForUnity.DisposableObject | |
void | Dispose () |
void | ThrowIfDisposed () |
Static Public Member Functions | |
static new ClassificationModel | __fromPtr__ (IntPtr addr) |
Static Public Member Functions inherited from OpenCVForUnity.DnnModule.Model | |
static Model | __fromPtr__ (IntPtr addr) |
Static Public Member Functions inherited from OpenCVForUnity.DisposableObject | |
static IntPtr | ThrowIfNullIntPtr (IntPtr ptr) |
Protected Member Functions | |
override void | Dispose (bool disposing) |
Protected Member Functions inherited from OpenCVForUnity.DnnModule.Model | |
override void | Dispose (bool disposing) |
Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject | |
DisposableOpenCVObject () | |
DisposableOpenCVObject (IntPtr ptr) | |
DisposableOpenCVObject (bool isEnabledDispose) | |
DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose) | |
Protected Member Functions inherited from OpenCVForUnity.DisposableObject | |
DisposableObject () | |
DisposableObject (bool isEnabledDispose) | |
Additional Inherited Members | |
Properties inherited from OpenCVForUnity.DisposableObject | |
bool | IsDisposed [get, protected set] |
bool | IsEnabledDispose [get, set] |
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.
OpenCVForUnity.DnnModule.ClassificationModel.ClassificationModel | ( | string | model, |
string | config | ||
) |
Create classification model from network represented in one of the supported formats. An order of model
and config
arguments does not matter.
[in] | model | Binary file contains trained weights. |
[in] | config | Text file contains network configuration. |
OpenCVForUnity.DnnModule.ClassificationModel.ClassificationModel | ( | string | model | ) |
Create classification model from network represented in one of the supported formats. An order of model
and config
arguments does not matter.
[in] | model | Binary file contains trained weights. |
[in] | config | Text file contains network configuration. |
OpenCVForUnity.DnnModule.ClassificationModel.ClassificationModel | ( | Net | network | ) |
Create model from deep learning network.
[in] | network | Net object. |
|
static |
void OpenCVForUnity.DnnModule.ClassificationModel.classify | ( | Mat | frame, |
int [] | classId, | ||
float [] | conf | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
protectedvirtual |
Reimplemented from OpenCVForUnity.DisposableOpenCVObject.
bool OpenCVForUnity.DnnModule.ClassificationModel.getEnableSoftmaxPostProcessing | ( | ) |
Get enable/disable softmax post processing option.
This option defaults to false, softmax post processing is not applied within the classify() function.
ClassificationModel OpenCVForUnity.DnnModule.ClassificationModel.setEnableSoftmaxPostProcessing | ( | bool | 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.
[in] | enable | Set enable softmax post processing within the classify() function. |