dnn_DetectionModel
import { dnn_DetectionModel } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits dnn_Model.
This class represents high-level API for object detection networks.
DetectionModel allows to set params for preprocessing input image. DetectionModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return result detections. For DetectionModel SSD, Faster R-CNN, YOLO topologies are supported.
Constructors and members
static new
Create detection model from network represented in one of the supported formats.
An order of model and config arguments does not matter.
new(model: EmbindString, config: EmbindString): dnn_DetectionModel;2 available overloads
new(network: EmbindString): dnn_DetectionModel;new(model: EmbindString, config: EmbindString): dnn_DetectionModel;networkNet object.
modelBinary file contains trained weights.
configText file contains network configuration.
The dnn_DetectionModel result.
static from1
Create an owned dnn_DetectionModel instance with the supplied configuration.
This class represents high-level API for object detection networks.
from1(_0: dnn_Net): dnn_DetectionModel | null;_00 argument (dnn_Net).
The dnn_DetectionModel | null result.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
setNmsAcrossClasses
nmsAcrossClasses defaults to false, such that when non max suppression is used during the detect() function, it will do so per-class. This function allows you to toggle this behaviour.
setNmsAcrossClasses(value: boolean): dnn_DetectionModel;valueThe new value for nmsAcrossClasses
The dnn_DetectionModel result.
getNmsAcrossClasses
Getter for nmsAcrossClasses. This variable defaults to false, such that when non max suppression is used during the detect() function, it will do so only per-class
getNmsAcrossClasses(): boolean;The boolean result.
detect
Given the input frame, create input blob, run net and return result detections.
detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: RectVector, confThreshold: number, nmsThreshold: number): void;3 available overloads
detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: RectVector): void;detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: RectVector, confThreshold: number): void;detect(frame: Mat, classIds: IntVector, confidences: FloatVector, boxes: RectVector, confThreshold: number, nmsThreshold: number): void;frameThe input image.
classIdsOutput destination, filled by the native operation. Class indexes in result detection.
confidencesOutput destination, filled by the native operation. A set of corresponding confidences.
boxesOutput destination, filled by the native operation. A set of bounding boxes.
confThresholdA threshold used to filter boxes by confidences.
nmsThresholdA threshold used in non maximum suppression.
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.