Click or drag to resize

Net Class

This class allows to create and manipulate comprehensive artificial neural networks.
Inheritance Hierarchy

Namespace:  OpenCvSharp.Dnn
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax
public class Net : DisposableCvObject

The Net type exposes the following members.

Constructors
  NameDescription
Public methodNet
Default constructor.
Protected methodNet(IntPtr)
Initializes a new instance of the Net class
Top
Properties
  NameDescription
Protected propertyAllocatedMemory
Gets or sets a memory address allocated by AllocMemory.
(Inherited from DisposableObject.)
Protected propertyAllocatedMemorySize
Gets or sets the byte length of the allocated memory
(Inherited from DisposableObject.)
Public propertyCvPtr
Native pointer of OpenCV structure
(Inherited from DisposableCvObject.)
Protected propertyDataHandle
Gets or sets a handle which allocates using cvSetData.
(Inherited from DisposableObject.)
Public propertyIsDisposed
Gets a value indicating whether this instance has been disposed.
(Inherited from DisposableObject.)
Public propertyIsEnabledDispose
Gets or sets a value indicating whether you permit disposing this instance.
(Inherited from DisposableObject.)
Top
Methods
  NameDescription
Protected methodAllocGCHandle
Pins the object to be allocated by cvSetData.
(Inherited from DisposableObject.)
Protected methodAllocMemory
Allocates the specified size of memory.
(Inherited from DisposableObject.)
Public methodConnect(String, String)
Connects output of the first layer to input of the second layer.
Public methodConnect(Int32, Int32, Int32, Int32)
Connects #@p outNum output of the first layer to #@p inNum input of the second layer.
Public methodDispose
Releases the resources
(Inherited from DisposableObject.)
Protected methodDispose(Boolean)
Releases the resources
(Inherited from DisposableObject.)
Protected methodDisposeManaged
Releases managed resources
(Inherited from DisposableObject.)
Protected methodDisposeUnmanaged
Public methodEmpty
Returns true if there are no layers in the network.
Public methodEnableFusion
Enables or disables layer fusion in the network.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Destructor
(Inherited from DisposableObject.)
Public methodForward(String)
Runs forward pass to compute output of layer with name @p outputName. By default runs forward pass for the whole network.
Public methodForward(IEnumerableMat, IEnumerableString)
Runs forward pass to compute outputs of layers listed in @p outBlobNames.
Public methodForward(IEnumerableMat, String)
Runs forward pass to compute output of layer with name @p outputName.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLayerId
Converts string name of the layer to the integer identifier.
Public methodGetLayerNames
Public methodGetPerfProfile
Returns overall time for inference and timings (in ticks) for layers. Indexes in returned vector correspond to layers ids.Some layers can be fused with others, in this case zero ticks count will be return for that skipped layers.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUnconnectedOutLayers
Returns indexes of layers with unconnected outputs.
Public methodGetUnconnectedOutLayersNames
Returns names of layers with unconnected outputs.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodNotifyMemoryPressure
Notifies the allocated size of memory.
(Inherited from DisposableObject.)
Public methodStatic memberReadNet
Read deep learning network represented in one of the supported formats. This function automatically detects an origin framework of trained model and calls an appropriate function such @ref readNetFromCaffe, @ref readNetFromTensorflow,
Public methodStatic memberReadNetFromCaffe
Reads a network model stored in Caffe model files.
Public methodStatic memberReadNetFromDarknet
Reads a network model stored in Darknet (https://pjreddie.com/darknet/) model files.
Public methodStatic memberReadNetFromModelOptimizer
Load a network from Intel's Model Optimizer intermediate representation. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.
Public methodStatic memberReadNetFromONNX
Reads a network model ONNX https://onnx.ai/
Public methodStatic memberReadNetFromTensorflow
Reads a network model stored in Tensorflow model file.
Public methodStatic memberReadNetFromTorch
Reads a network model stored in Torch model file.
Public methodSetHalideScheduler
Compile Halide layers. Schedule layers that support Halide backend. Then compile them for specific target.For layers that not represented in scheduling file or if no manual scheduling used at all, automatic scheduling will be applied.
Public methodSetInput
Sets the new value for the layer output blob
Public methodSetInputsNames
Sets outputs names of the network input pseudo layer.
Public methodSetPreferableBackend
Ask network to use specific computation backend where it supported.
Public methodSetPreferableTarget
Ask network to make computations on specific target device.
Public methodThrowIfDisposed
If this object is disposed, then ObjectDisposedException is thrown.
(Inherited from DisposableObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Protected fieldptr
Data pointer
(Inherited from DisposableCvObject.)
Top
Remarks
Neural network is presented as directed acyclic graph(DAG), where vertices are Layer instances, and edges specify relationships between layers inputs and outputs. Each network layer has unique integer id and unique string name inside its network. LayerId can store either layer name or layer id. This class supports reference counting of its instances, i.e.copies point to the same instance.
See Also