cv::FaceDetectorYN Class ReferenceabstractObject Detection » DNN-based face detection and recognition
DNN-based face detector. More...
#include <opencv2/objdetect/face.hpp>
Public Member Functions |
DNN-based face detector. More...
#include <opencv2/objdetect/face.hpp>
Public Member Functions |
| virtual | ~FaceDetectorYN () |
| virtual int | detect (InputArray image, OutputArray faces)=0 |
| Detects faces in the input image. Following is an example output. |
| 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. |
| 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. |
| virtual void | setScoreThreshold (float score_threshold)=0 |
| Set the score threshold to filter out bounding boxes of score less than the given value. |
| virtual void | setTopK (int top_k)=0 |
| Set the number of bounding boxes preserved before NMS. |
Static Public Member Functions | |
| static Ptr< FaceDetectorYN > | create (const String &framework, const std::vector< uchar > &bufferModel, const std::vector< uchar > &bufferConfig, 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 Ptr< FaceDetectorYN > | create (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH 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 face detector class with given parameters. | |
DNN-based face detector.
model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet
| inlinevirtual |
| static |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.create( | model, config, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]] | ) -> | retval | |
| cv.FaceDetectorYN.create( | framework, bufferModel, bufferConfig, 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]]]]] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| framework | Name of origin framework |
| bufferModel | A buffer with a content of binary file with weights |
| bufferConfig | A buffer with a content of text file contains network configuration |
| input_size | the size of the input image |
| score_threshold | the threshold to filter out bounding boxes of score smaller than the given value |
| nms_threshold | the threshold to suppress bounding boxes of IoU bigger than the given value |
| static |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.create( | model, config, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]] | ) -> | retval | |
| cv.FaceDetectorYN.create( | framework, bufferModel, bufferConfig, 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]]]]] |
Creates an instance of face detector class with given parameters.
| model | the path to the requested model |
| config | the path to the config file for compability, which is not requested for ONNX models |
| input_size | the size of the input image |
| score_threshold | the threshold to filter out bounding boxes of score smaller than the given value |
| nms_threshold | the threshold to suppress bounding boxes of IoU bigger than the given value |
| top_k | keep top K bboxes before NMS |
| pure virtual |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.detect( | image[, faces] | ) -> | retval, faces |
Detects faces in the input image. Following is an example output.
| image | an image to detect |
| faces | detection results stored in a 2D cv::Mat of shape [num_faces, 15]
|
| pure virtual |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.getInputSize( | ) -> | retval |
| pure virtual |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.getNMSThreshold( | ) -> | retval |
| pure virtual |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.getScoreThreshold( | ) -> | retval |
| pure virtual |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.getTopK( | ) -> | retval |
| 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.
| input_size | the size of the input image |
| 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.
| nms_threshold | threshold for NMS operation |
| 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.
| score_threshold | threshold for filtering out bounding boxes |
| pure virtual |
| Python: | ||||
|---|---|---|---|---|
| cv.FaceDetectorYN.setTopK( | top_k | ) -> | None |
Set the number of bounding boxes preserved before NMS.
| top_k | the number of bounding boxes to preserve from top rank based on score |
| ) -> |
| retval |
| cv.FaceDetectorYN_create( | framework, bufferModel, bufferConfig, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]] | ) -> | retval |
| top_k | keep top K bboxes before NMS |
| backend_id | the id of backend |
| target_id | the id of target device |
| ) -> |
| retval |
| cv.FaceDetectorYN_create( | framework, bufferModel, bufferConfig, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]] | ) -> | retval |
| backend_id | the id of backend |
| target_id | the id of target device |