Class FaceDetectorYN
DNN-based face detector
public class FaceDetectorYN : SharedPtrObject, IDisposable
- Inheritance
-
FaceDetectorYN
- Implements
- Inherited Members
Constructors
FaceDetectorYN(string, string, Size, float, float, int, Backend, Target)
Creates an instance of this class with given parameters.
public FaceDetectorYN(string model, string config, Size inputSize, float scoreThreshold = 0.9, float nmsThreshold = 0.3, int topK = 5000, Backend backendId = Backend.Default, Target targetId = Target.Cpu)
Parameters
model
stringThe path to the requested model
config
stringThe path to the config file for compability, which is not requested for ONNX models
inputSize
SizeThe size of the input image
scoreThreshold
floatThe threshold to filter out bounding boxes of score smaller than the given value
nmsThreshold
floatThe threshold to suppress bounding boxes of IoU bigger than the given value
topK
intKeep top K bboxes before NMS
backendId
BackendThe id of backend
targetId
TargetThe id of target device
Properties
InputSize
The size for the network input, which overwrites the input size of creating model.
public Size InputSize { get; set; }
Property Value
Methods
Detect(IInputArray, IOutputArray)
A simple interface to detect face from given image.
public int Detect(IInputArray image, IOutputArray faces)
Parameters
image
IInputArrayAn image to detect
faces
IOutputArrayDetection results stored in a Mat
Returns
- int
1 if detection is successful, 0 otherwise.
DisposeObject()
Release the unmanaged memory associated with this FaceDetectorYN
protected override void DisposeObject()
SetNMSThreshold(float)
The Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value
public void SetNMSThreshold(float value)
Parameters
value
floatThe value
SetScoreThreshold(float)
The score threshold to filter out bounding boxes of score less than the given value
public void SetScoreThreshold(float value)
Parameters
value
floatThe value
SetTopK(int)
The number of bounding boxes to preserve from top rank based on score
public void SetTopK(int value)
Parameters
value
intThe value