OpenCV 4.13.0
开源计算机视觉库 (Open Source Computer Vision)
正在加载...
正在搜索...
未找到匹配项
cv::FaceDetectorYN 类参考抽象

基于DNN的人脸检测器。更多...

#include <opencv2/objdetect/face.hpp>

cv::FaceDetectorYN 的协作图

公开成员函数

virtual ~FaceDetectorYN ()
 
virtual int detect (InputArray image, OutputArray faces)=0
 在输入图像中检测人脸。示例如下。
 
virtual Size getInputSize ()=0
 
virtual float getNMSThreshold ()=0
 
virtual float getScoreThreshold ()=0
 
virtual int getTopK ()=0
 
virtual void setInputSize (const Size &input_size)=0
 设置网络输入尺寸,这将覆盖创建模型时的输入尺寸。当输入图像的尺寸与创建模型时的输入尺寸不匹配时,请调用此方法。
 
virtual void setNMSThreshold (float nms_threshold)=0
 设置非极大值抑制阈值,以抑制IoU大于给定值的边界框。
 
virtual void setScoreThreshold (float score_threshold)=0
 设置分数阈值,以过滤掉分数低于给定值的边界框。
 
virtual void setTopK (int top_k)=0
 设置NMS之前保留的边界框数量。
 

静态公开成员函数

static Ptr< FaceDetectorYNcreate (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< FaceDetectorYNcreate (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)
 使用给定参数创建一个人脸检测器类实例。
 

详细说明

基于DNN的人脸检测器。

模型下载链接:https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet

构造函数与析构函数说明

◆ ~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]

static Ptr< FaceDetectorYN > cv::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 )
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

使用给定参数创建一个人脸检测器类实例。

参数
model所请求模型的路径
config用于兼容性的配置文件路径,对于ONNX模型不是必需的
input_size输入图像的尺寸
score_threshold用于过滤掉分数小于给定值的边界框的阈值
nms_threshold用于抑制IoU大于给定值的边界框的阈值
top_k在NMS之前保留排名前 K 的边界框
backend_id后端ID
target_id目标设备ID

◆ detect()

virtual int cv::FaceDetectorYN::detect ( InputArray 图像,
OutputArray faces )
纯虚函数
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

设置网络输入尺寸,这将覆盖创建模型时的输入尺寸。当输入图像的尺寸与创建模型时的输入尺寸不匹配时,请调用此方法。

参数
input_size输入图像的尺寸

◆ setNMSThreshold()

virtual void cv::FaceDetectorYN::setNMSThreshold ( float nms_threshold)
纯虚函数
Python
cv.FaceDetectorYN.setNMSThreshold(nms_threshold) -> None

设置非极大值抑制阈值,以抑制IoU大于给定值的边界框。

参数
nms_threshold用于NMS操作的阈值

◆ 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

设置NMS之前保留的边界框数量。

参数
top_k根据分数保留的排名前 K 的边界框数量

该类的文档由以下文件生成: