vitis::ai::YOLOvX - 2.0 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2022-01-20
Version
2.0 English
Base class for detecting objects in the input image (cv::Mat).

Input is an image (cv::Mat).

Output is the position of the pedestrians in the input image.

Sample code:

auto yolo = vitis::ai::YOLOvX::create("yolovx_pt", true);

Mat img = cv::imread("sample_yolovx.jpg");
auto results = yolo->run(img);

for (auto& result : results.bboxes) {
  int label = result.label;
  auto& box = result.box;

  cout << "RESULT: " << label << "\t" << std::fixed << std::setprecision(2)
       << box[0] << "\t" << box[1] << "\t" << box[2] << "\t" << box[3] << "\t"
       << std::setprecision(6) << result.score << "\n";
  rectangle(img, Point(box[0], box[1]), Point(box[2], box[3]),
            Scalar(0, 255, 0), 1, 1, 0);
}
imwrite("result.jpg", img);

Quick Function Reference

The following table lists all the functions defined in the vitis::ai::YOLOvX class:

Table 1. Quick Function Reference
Type Name Arguments
std::unique_ptr< YOLOvX > create
  • const std::string & model_name
  • bool need_preprocess
std::unique_ptr< YOLOvX > create
  • const std::string & model_name
  • xir::Attrs * attrs
  • bool need_preprocess
YOLOvXResult run
  • const cv::Mat & image
std::vector< YOLOvXResult > run
  • const std::vector< cv::Mat > & images