Table of Contents

Class Model

Namespace
Emgu.CV.Dnn
Assembly
Emgu.CV.dll

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 Net

DNN Network

Model(string, string)

Create DNN model from network represented in one of the supported formats.

public Model(string model, string config)

Parameters

model string

Binary file contains trained weights.

config string

Text file contains network configuration.

Fields

_model

The pointer to the Model object

protected nint _model

Field Value

nint

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 IInputArray

The input image.

outs IOutputArrayOfArrays

Allocated output blobs, which will store results of the computation.

SetInputCrop(bool)

Set flag crop for frame.

public void SetInputCrop(bool crop)

Parameters

crop bool

Flag 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 MCvScalar

Scalar with mean values which are subtracted from channels.

SetInputScale(double)

Set scalefactor value for frame.

public void SetInputScale(double scale)

Parameters

scale double

Multiplier for frame values.

SetInputSize(Size)

Set input size for frame.

public void SetInputSize(Size size)

Parameters

size Size

New 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 bool

Flag 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 Backend

The value

SetPreferableTarget(Target)

Ask network to make computations on specific target device.

public void SetPreferableTarget(Target value)

Parameters

value Target

The value