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要根據分數從排名靠前的位置保留的邊界框的數量

此類文件由以下檔案生成