基於 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 | A 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]
| 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] | ) -> | 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 | ) -> | 無 |
設定網路輸入的大小,這將覆蓋建立模型時的輸入大小。 當輸入影像的大小與建立模型時的輸入大小不匹配時,呼叫此方法。
- 引數
-
◆ setNMSThreshold()
| virtual void cv::FaceDetectorYN::setNMSThreshold |
( |
float | nms_threshold | ) |
|
|
純虛擬函式 |
| Python |
|---|
| cv.FaceDetectorYN.setNMSThreshold( | nms_threshold | ) -> | 無 |
設定非極大值抑制閾值,以抑制 IoU 大於給定值的邊界框。
- 引數
-
◆ 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 | 要根據分數從排名靠前的位置保留的邊界框的數量 |
此類文件由以下檔案生成