vitis::ai::EfficientDetD2 - 3.5 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2023-06-29
Version
3.5 English
Base class for detecting position of vehicle, pedestrian, and so on.

Input is an image (cv:Mat).

Output is a struct of detection results, named EfficientDetD2Result .

Sample code :

  Mat img = cv::imread("sample_efficientdet_d2.jpg");
  auto efficientdet_d2 =
vitis::ai::EfficientDetD2::create("efficientdet_d2_tf",true);
  auto results = efficientdet_d2->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;
  }

Display of the model results: width=\textwidth

Figure 1. detection result
detection result

Quick Function Reference

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

Table 1. Quick Function Reference
Type Member Arguments
std::unique_ptr< EfficientDetD2 > create
  • const std::string & model_name
  • bool need_preprocess
std::unique_ptr< EfficientDetD2 > create
  • const std::string & model_name
  • xir::Attrs * attrs
  • bool need_preprocess
vitis::ai::EfficientDetD2Result run
  • const cv::Mat & image
std::vector< vitis::ai::EfficientDetD2Result > run
  • const std::vector< cv::Mat > & images