OpenCV 5.0.0
Open Source Computer Vision
読み込み中...
検索中...
見つかりません
🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
cv::FaceDetectorYN クラスabstract

DNNベースの顔検出器。 続き...

#include <opencv2/objdetect/face.hpp>

Collaboration diagram for 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_kNMSの前に保持する上位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_kNMSの前に保持する上位K個のバウンディングボックス
backend_idバックエンドのID
target_idターゲットデバイスのID

◆ detect()

virtual int cv::FaceDetectorYN::detect ( InputArray image,
OutputArray faces )
pure virtual
Python:
cv.FaceDetectorYN.detect(image[, faces]) -> retval, faces

入力画像から顔を検出する。以下は出力例である。

image
引数
image検出対象の画像
faces形状 [num_faces, 15] の2次元 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 ( )
pure virtual
Python:
cv.FaceDetectorYN.getInputSize() -> retval

◆ getNMSThreshold()

virtual float cv::FaceDetectorYN::getNMSThreshold ( )
pure virtual
Python:
cv.FaceDetectorYN.getNMSThreshold() -> retval

◆ getScoreThreshold()

virtual float cv::FaceDetectorYN::getScoreThreshold ( )
pure virtual
Python:
cv.FaceDetectorYN.getScoreThreshold() -> retval

◆ getTopK()

virtual int cv::FaceDetectorYN::getTopK ( )
pure virtual
Python:
cv.FaceDetectorYN.getTopK() -> retval

◆ setInputSize()

virtual void cv::FaceDetectorYN::setInputSize ( const Size & input_size)
pure virtual
Python:
cv.FaceDetectorYN.setInputSize(input_size) -> None

ネットワークの入力サイズを設定する。これはモデル作成時の入力サイズを上書きする。入力画像のサイズがモデル作成時の入力サイズと一致しない場合にこのメソッドを呼び出す。

引数
input_size入力画像のサイズ

◆ setNMSThreshold()

virtual void cv::FaceDetectorYN::setNMSThreshold ( float nms_threshold)
pure virtual
Python:
cv.FaceDetectorYN.setNMSThreshold(nms_threshold) -> None

Non-maximum-suppressionのしきい値を設定し、与えた値より大きいIoUを持つバウンディングボックスを抑制する。

引数
nms_thresholdNMS処理のしきい値

◆ setScoreThreshold()

virtual void cv::FaceDetectorYN::setScoreThreshold ( float score_threshold)
pure virtual
Python:
cv.FaceDetectorYN.setScoreThreshold(score_threshold) -> None

スコアのしきい値を設定し、与えた値未満のスコアを持つバウンディングボックスを除外する。

引数
score_thresholdバウンディングボックスを除外するためのしきい値

◆ setTopK()

virtual void cv::FaceDetectorYN::setTopK ( int top_k)
pure virtual
Python:
cv.FaceDetectorYN.setTopK(top_k) -> None

NMSの前に保持するバウンディングボックスの数を設定する。

引数
top_kスコアに基づく上位ランクから保持するバウンディングボックスの数

このクラス詳解は次のファイルから抽出されました: