OpenCV 4.12.0
开源计算机视觉
加载中...
搜索中...
无匹配项
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原始框架的名称
bufferModelA buffer with a content of binary file with weights
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 image,
OutputArray faces )
纯虚函数
Python
cv.FaceDetectorYN.detect(image[, faces]) -> retval, faces

检测输入图像中的人脸。 以下是一个示例输出。

image
参数
image要检测的图像
faces检测结果存储在形状为 [num_faces, 15] 的 2D cv::Mat
  • 0-1:bbox 左上角的 x, y
  • 2-3:bbox 的宽度、高度
  • 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) ->

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

参数
input_size输入图像的大小

◆ setNMSThreshold()

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

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

参数
nms_thresholdNMS 操作的阈值

◆ setScoreThreshold()

virtual void cv::FaceDetectorYN::setScoreThreshold ( float score_threshold)
纯虚函数
Python
cv.FaceDetectorYN.setScoreThreshold(score_threshold) ->

设置分数阈值以过滤掉分数小于给定值的边界框。

参数
score_threshold用于过滤掉边界框的阈值

◆ setTopK()

virtual void cv::FaceDetectorYN::setTopK ( int top_k)
纯虚函数
Python
cv.FaceDetectorYN.setTopK(top_k) ->

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

参数
top_k要根据分数从排名靠前的位置保留的边界框的数量

此类文档由以下文件生成