基于DNN的人脸检测器。更多...
#include <opencv2/objdetect/face.hpp>
|
| 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) |
| | 使用给定参数创建一个人脸检测器类实例。
|
| |
◆ ~FaceDetectorYN()
| virtual cv::FaceDetectorYN::~FaceDetectorYN |
( |
| ) |
|
|
inlinevirtual |
◆ create() [1/2]
| static Ptr< FaceDetectorYN > cv::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 (静态) |
| 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]]]]] | ) -> | retval |
| cv.FaceDetectorYN_create( | framework, bufferModel, bufferConfig, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]] | ) -> | retval |
这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。
- 参数
-
| framework | 原始框架的名称 |
| bufferModel | 包含权重二进制文件内容的缓冲区 |
| bufferConfig | 包含网络配置文本文件内容的缓冲区 |
| input_size | 输入图像的尺寸 |
| score_threshold | 用于过滤掉分数小于给定值的边界框的阈值 |
| nms_threshold | 用于抑制IoU大于给定值的边界框的阈值 |
| top_k | 在NMS之前保留排名前 K 的边界框 |
| backend_id | 后端ID |
| target_id | 目标设备ID |
◆ create() [2/2]
| 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]]]]] | ) -> | retval |
| cv.FaceDetectorYN_create( | framework, bufferModel, bufferConfig, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]] | ) -> | retval |
使用给定参数创建一个人脸检测器类实例。
- 参数
-
| model | 所请求模型的路径 |
| config | 用于兼容性的配置文件路径,对于ONNX模型不是必需的 |
| input_size | 输入图像的尺寸 |
| score_threshold | 用于过滤掉分数小于给定值的边界框的阈值 |
| nms_threshold | 用于抑制IoU大于给定值的边界框的阈值 |
| top_k | 在NMS之前保留排名前 K 的边界框 |
| backend_id | 后端ID |
| target_id | 目标设备ID |
◆ detect()
| Python |
|---|
| cv.FaceDetectorYN.detect( | image[, faces] | ) -> | 返回值,faces |
在输入图像中检测人脸。示例如下。
图像
- 参数
-
| 图像 | 要检测的图像 |
| faces | 检测结果存储在形状为 [num_faces, 15] 的二维 cv::Mat 中
- 0-1: 边界框左上角的 x, y 坐标
- 2-3: 边界框的宽度, 高度
- 4-5: 右眼 (示例图像中的蓝点) 的 x, y 坐标
- 6-7: 左眼 (示例图像中的红点) 的 x, y 坐标
- 8-9: 鼻尖 (示例图像中的绿点) 的 x, y 坐标
- 10-11: 嘴巴右角 (示例图像中的粉点) 的 x, y 坐标
- 12-13: 嘴巴左角 (示例图像中的黄点) 的 x, y 坐标
- 14: 人脸分数
|
◆ getInputSize()
| virtual Size cv::FaceDetectorYN::getInputSize |
( |
| ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.getInputSize( | | ) -> | retval |
◆ getNMSThreshold()
| virtual float cv::FaceDetectorYN::getNMSThreshold |
( |
| ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.getNMSThreshold( | | ) -> | retval |
◆ getScoreThreshold()
| virtual float cv::FaceDetectorYN::getScoreThreshold |
( |
| ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.getScoreThreshold( | | ) -> | retval |
◆ getTopK()
| virtual int cv::FaceDetectorYN::getTopK |
( |
| ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.getTopK( | | ) -> | retval |
◆ setInputSize()
| virtual void cv::FaceDetectorYN::setInputSize |
( |
const Size & | input_size | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.setInputSize( | input_size | ) -> | None |
设置网络输入尺寸,这将覆盖创建模型时的输入尺寸。当输入图像的尺寸与创建模型时的输入尺寸不匹配时,请调用此方法。
- 参数
-
◆ setNMSThreshold()
| virtual void cv::FaceDetectorYN::setNMSThreshold |
( |
float | nms_threshold | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.setNMSThreshold( | nms_threshold | ) -> | None |
设置非极大值抑制阈值,以抑制IoU大于给定值的边界框。
- 参数
-
◆ setScoreThreshold()
| virtual void cv::FaceDetectorYN::setScoreThreshold |
( |
float | score_threshold | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.setScoreThreshold( | score_threshold | ) -> | None |
设置分数阈值,以过滤掉分数低于给定值的边界框。
- 参数
-
| score_threshold | 用于过滤边界框的阈值 |
◆ setTopK()
| virtual void cv::FaceDetectorYN::setTopK |
( |
int | top_k | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.FaceDetectorYN.setTopK( | top_k | ) -> | None |
该类的文档由以下文件生成: