vitis::ai::RetinaFace - 3.5 日本語

Vitis AI ライブラリ ユーザー ガイド (UG1354)

Document ID
UG1354
Release Date
2023-06-29
Version
3.5 日本語
入力イメージ (cv::Mat) 内の顔の位置、スコア、ランドマークを検出するためのベース クラス。

入力はイメージ (cv::Mat) です。

出力は入力イメージ内の顔の位置およびスコアのベクターです。

サンプル コード:

auto image = cv::imread("sample_retinaface.jpg");
auto network = vitis::ai::RetinaFace::create(
               "retinaface",
               true);
auto result = network->run(image);
for (auto i = 0u; i < result.bboxes.size(); ++i) {
   auto score = result.bboxes[i].score;
   auto x = result.bboxes[i].x * image.cols;
   auto y = result.bboxes[i].y * image.rows;
   auto width = result.bboxes[i].width * image.cols;
   auto height = result.bboxes[i].height * image.rows;
   auto landmark = results.landmarks[i];
   for (auto j = 0; j < 5; ++j) {
     auto px = landmark[j].first * image.cols;
     auto py = landmark[j].second * image.rows;
   }
}

width=\textwidth の場合のモデルの結果を次に示します。

図 1. 結果イメージ
result image

関数クイック リファレンス

次の表に、vitis::ai::RetinaFace クラスに定義されているすべての関数を示します。

表 1. 関数クイック リファレンス
タイプ メンバー 引数
std::unique_ptr< RetinaFace > create
  • const std::string & model_name
  • bool need_preprocess
std::unique_ptr< RetinaFace > create
  • const std::string & model_name
  • xir::Attrs * attrs
  • bool need_preprocess
RetinaFaceResult run
  • const cv::Mat & img
std::vector< RetinaFaceResult > run
  • const std::vector< cv::Mat > & imgs
std::vector< RetinaFaceResult > run
  • const std::vector< vart::xrt_bo_t > & input_bos