Table of Contents

Class Model

Namespace
OpenCvSharp.Dnn
Assembly
OpenCvSharp.dll

This class is presented high-level API for neural networks. It allows to set params for preprocessing input image. It creates net from file with trained weights and config, sets preprocessing input and runs forward pass.

public class Model : CvObject, IDisposable
Inheritance
Model
Implements
Derived
Inherited Members

Constructors

Model()

For derived classes that construct the native object themselves.

Model(Net)

Create model from deep learning network.

Model(string, string?)

Create model from deep learning network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.

Methods

EnableWinograd(bool)

Enables or disables the Winograd convolution optimization.

Predict(InputArray)

Given the @p input frame, create input blob, run net and return the output @p blobs.

SetHandle(nint, Func<nint, ExceptionStatus>)

Sets the underlying native handle together with the correct destructor.

SetInputCrop(bool)

Set flag crop for frame.

SetInputMean(Scalar)

Set mean value for frame.

SetInputParams(double, Size?, Scalar?, bool, bool)

Set preprocessing parameters for frame.

SetInputScale(Scalar)

Set scalefactor value for frame.

SetInputSize(Size)

Set input size for frame.

SetInputSize(int, int)

Set input size for frame.

SetInputSwapRB(bool)

Set flag swapRB for frame.

SetOutputNames(IEnumerable<string>)

Set output names for frame.

SetPreferableBackend(Backend)

Ask network to use specific computation backend where it supported.

SetPreferableTarget(Target)

Ask network to make computations on specific target device.