Skip to content

dnn_readNet

Deep neural networksfunctionOpenCV 5.0.0
import { dnn_readNet } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSmodel, config, framework, engine
FUNCTIONdnn_readNet
RETURN TYPEdnn_Net
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Read deep learning network represented in one of the supported formats.

dnn_readNet(model: EmbindString, config: EmbindString, framework: EmbindString, engine: number): dnn_Net;
4 available overloads
dnn_readNet(model: EmbindString): dnn_Net;
dnn_readNet(model: EmbindString, config: EmbindString): dnn_Net;
dnn_readNet(model: EmbindString, config: EmbindString, framework: EmbindString): dnn_Net;
dnn_readNet(model: EmbindString, config: EmbindString, framework: EmbindString, engine: number): dnn_Net;
model

Binary file contains trained weights. The following file extensions are expected for models from different frameworks: *.pb (TensorFlow, https://www.tensorflow.org/) *.bin | *.onnx (OpenVINO, https://software.intel.com/openvino-toolkit) *.onnx (ONNX, https://onnx.ai/)

config

Text file contains network configuration. It could be a file with the following extensions: *.pbtxt (TensorFlow, https://www.tensorflow.org/) *.xml (OpenVINO, https://software.intel.com/openvino-toolkit)

framework

Explicit framework name tag to determine a format.

engine

select DNN engine to be used. With auto selection the new engine is used first and falls back to classic. Please pay attention that the new DNN does not support non-CPU back-ends for now. Use ENGINE_CLASSIC if you want to use other back-ends.

Returns

Net object.

This function automatically detects an origin framework of trained model and calls an appropriate function such readNetFromTensorflow, readNetFromONNX. An order of model and config arguments does not matter.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.