Class Model
This class is presented high-level API for neural networks.
public class Model : UnmanagedObject, IDisposable
- Inheritance
-
Model
- Implements
- Derived
- Inherited Members
Constructors
Model(Net)
Create model from deep learning network.
public Model(Net network)
Parameters
network
NetDNN Network
Model(string, string)
Create DNN model from network represented in one of the supported formats.
public Model(string model, string config)
Parameters
model
stringBinary file contains trained weights.
config
stringText file contains network configuration.
Fields
_model
The pointer to the Model object
protected nint _model
Field Value
Methods
DisposeObject()
Release the memory associated with this Model.
protected override void DisposeObject()
Predict(IInputArray, IOutputArrayOfArrays)
Given the input frame, create input blob, run net and return the output blobs.
public void Predict(IInputArray frame, IOutputArrayOfArrays outs)
Parameters
frame
IInputArrayThe input image.
outs
IOutputArrayOfArraysAllocated output blobs, which will store results of the computation.
SetInputCrop(bool)
Set flag crop for frame.
public void SetInputCrop(bool crop)
Parameters
crop
boolFlag which indicates whether image will be cropped after resize or not.
SetInputMean(MCvScalar)
Set mean value for frame.
public void SetInputMean(MCvScalar mean)
Parameters
mean
MCvScalarScalar with mean values which are subtracted from channels.
SetInputScale(double)
Set scalefactor value for frame.
public void SetInputScale(double scale)
Parameters
scale
doubleMultiplier for frame values.
SetInputSize(Size)
Set input size for frame.
public void SetInputSize(Size size)
Parameters
size
SizeNew input size.
Remarks
If shape of the new blob less than 0, then frame size not change.
SetInputSwapRB(bool)
Set flag swapRB for frame.
public void SetInputSwapRB(bool swapRB)
Parameters
swapRB
boolFlag which indicates that swap first and last channels.
SetPreferableBackend(Backend)
Ask network to use specific computation backend where it supported.
public void SetPreferableBackend(Backend value)
Parameters
value
BackendThe value
SetPreferableTarget(Target)
Ask network to make computations on specific target device.
public void SetPreferableTarget(Target value)
Parameters
value
TargetThe value