OpenCV  4.6.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::FaceDetectorYN Class Referenceabstract

DNN-based face detector. More...

#include <opencv2/objdetect/face.hpp>

Public Member Functions

virtual ~FaceDetectorYN ()
 
virtual int detect (InputArray image, OutputArray faces)=0
 A simple interface to detect face from given image. More...
 
virtual Size getInputSize ()=0
 
virtual float getNMSThreshold ()=0
 
virtual float getScoreThreshold ()=0
 
virtual int getTopK ()=0
 
virtual void setInputSize (const Size &input_size)=0
 Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model. More...
 
virtual void setNMSThreshold (float nms_threshold)=0
 Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value. More...
 
virtual void setScoreThreshold (float score_threshold)=0
 Set the score threshold to filter out bounding boxes of score less than the given value. More...
 
virtual void setTopK (int top_k)=0
 Set the number of bounding boxes preserved before NMS. More...
 

Static Public Member Functions

static Ptr< FaceDetectorYNcreate (const String &model, const String &config, const Size &input_size, float score_threshold=0.9f, float nms_threshold=0.3f, int top_k=5000, int backend_id=0, int target_id=0)
 Creates an instance of this class with given parameters. More...
 

Detailed Description

DNN-based face detector.

model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet

Constructor & Destructor Documentation

◆ ~FaceDetectorYN()

virtual cv::FaceDetectorYN::~FaceDetectorYN ( )
inlinevirtual

Member Function Documentation

◆ create()

static Ptr<FaceDetectorYN> cv::FaceDetectorYN::create ( const String model,
const String config,
const Size input_size,
float  score_threshold = 0.9f,
float  nms_threshold = 0.3f,
int  top_k = 5000,
int  backend_id = 0,
int  target_id = 0 
)
static
Python:
cv.FaceDetectorYN.create(model, config, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]]) -> retval
cv.FaceDetectorYN_create(model, config, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]]) -> retval

Creates an instance of this class with given parameters.

Parameters
modelthe path to the requested model
configthe path to the config file for compability, which is not requested for ONNX models
input_sizethe size of the input image
score_thresholdthe threshold to filter out bounding boxes of score smaller than the given value
nms_thresholdthe threshold to suppress bounding boxes of IoU bigger than the given value
top_kkeep top K bboxes before NMS
backend_idthe id of backend
target_idthe id of target device

◆ detect()

virtual int cv::FaceDetectorYN::detect ( InputArray  image,
OutputArray  faces 
)
pure virtual
Python:
cv.FaceDetectorYN.detect(image[, faces]) -> retval, faces

A simple interface to detect face from given image.

Parameters
imagean image to detect
facesdetection results stored in a cv::Mat

◆ getInputSize()

virtual Size cv::FaceDetectorYN::getInputSize ( )
pure virtual
Python:
cv.FaceDetectorYN.getInputSize() -> retval

◆ getNMSThreshold()

virtual float cv::FaceDetectorYN::getNMSThreshold ( )
pure virtual
Python:
cv.FaceDetectorYN.getNMSThreshold() -> retval

◆ getScoreThreshold()

virtual float cv::FaceDetectorYN::getScoreThreshold ( )
pure virtual
Python:
cv.FaceDetectorYN.getScoreThreshold() -> retval

◆ getTopK()

virtual int cv::FaceDetectorYN::getTopK ( )
pure virtual
Python:
cv.FaceDetectorYN.getTopK() -> retval

◆ setInputSize()

virtual void cv::FaceDetectorYN::setInputSize ( const Size input_size)
pure virtual
Python:
cv.FaceDetectorYN.setInputSize(input_size) -> None

Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model.

Parameters
input_sizethe size of the input image

◆ setNMSThreshold()

virtual void cv::FaceDetectorYN::setNMSThreshold ( float  nms_threshold)
pure virtual
Python:
cv.FaceDetectorYN.setNMSThreshold(nms_threshold) -> None

Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value.

Parameters
nms_thresholdthreshold for NMS operation

◆ setScoreThreshold()

virtual void cv::FaceDetectorYN::setScoreThreshold ( float  score_threshold)
pure virtual
Python:
cv.FaceDetectorYN.setScoreThreshold(score_threshold) -> None

Set the score threshold to filter out bounding boxes of score less than the given value.

Parameters
score_thresholdthreshold for filtering out bounding boxes

◆ setTopK()

virtual void cv::FaceDetectorYN::setTopK ( int  top_k)
pure virtual
Python:
cv.FaceDetectorYN.setTopK(top_k) -> None

Set the number of bounding boxes preserved before NMS.

Parameters
top_kthe number of bounding boxes to preserve from top rank based on score

The documentation for this class was generated from the following file: