vitis::ai::SSD - 2.5 日本語

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

Document ID
UG1354
Release Date
2022-06-15
Version
2.5 日本語
車両、歩行者などの位置を検出するためのベース クラス。

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

出力は、 SSDResult という名前の検出結果の構造体です。

サンプル コード:

  Mat img = cv::imread("sample_ssd.jpg");
  auto ssd = vitis::ai::SSD::create("ssd_traffic_pruned_0_9",true);
  auto results = ssd->run(img);
  for(const auto &r : results.bboxes){
     auto label = r.label;
     auto x = r.x * img.cols;
     auto y = r.y * img.rows;
     auto width = r.width * img.cols;
     auto heigth = r.height * img.rows;
     auto score = r.score;
     std::cout << "RESULT: " << label << "\t" << x << "\t" << y << "\t" <<
width
        << "\t" << height << "\t" << score << std::endl;
  }

モデルの結果を次に示します。

図 1. 検出結果

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

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

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