vitis::ai::BEVdet - 3.5 简体中文

Vitis AI Library 用户指南 (UG1354)

Document ID
UG1354
Release Date
2023-06-29
Version
3.5 简体中文
此基本类用于检测输入图像 (cv::Mat) 中的对象。输入为图像 (cv::Mat)。输出是输入图像中对象的位置。代码样本:
auto model = vitis::ai::BEVdet::create(argv[1], argv[2], argv[3]);
std::vector<std::string> names;
LoadImageNames(argv[4], names);
std::vector<cv::Mat> images;
for (auto&& i : names) {
  images.emplace_back(cv::imread(i));
}
std::vector<std::vector<char>> bins;
std::vector<std::string> bin_names;
LoadImageNames(argv[5], bin_names);
for (auto&& i : bin_names) {
  auto infile = std::ifstream(i, std::ios_base::binary);
  bins.emplace_back(std::vector<char>(std::istreambuf_iterator<char>(infile),
                                      std::istreambuf_iterator<char>()));
}
std::vector<vitis::ai::CenterPointResult> res;

res = model->run(images, bins);
for (size_t i = 0; i < 32 && i < res.size(); i++) {
  const auto& r = res[i];
  cout << "label: " << r.label << " score: " << r.score
       << " bbox: " << r.bbox[0] << " " << r.bbox[1] << " " << r.bbox[2]
       << " " << r.bbox[3] << " " << r.bbox[4] << " " << r.bbox[5] << " "
       << r.bbox[6] << " " << r.bbox[7] << " " << r.bbox[8] << endl;
}

函数快速参考

下表列出了 vitis::ai::BEVdet 类中定义的所有函数:

表 1. 函数快速参考
类型 成员 实参
std::unique_ptr< BEVdet > create
  • const std::string & model_name0
  • const std::string & model_name1
  • const std::string & model_name2
std::vector< CenterPointResult > run
  • const std::vector< cv::Mat > & images
  • const std::vector< std::vector< char > > & input_bins