vitis::ai::MedicalDetection - 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 five objects of Endoscopy Disease Detection and Segmentation database (EDD2020) .

Input is an image (cv:Mat).

Output is a struct of detection results, named MedicalDetectionResult.

Sample code :

Mat img = cv::imread("sample_medicaldetection.jpg");
auto medicaldetection = vitis::ai::MedicalDetection::create("RefineDet-Medical_EDD_tf",true);
auto results = medicaldetection->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 height = 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:

Figure 1. detection result
Image sample_medicaldetection_result.jpg

Quick Function Reference

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

Table 1. Quick Function Reference
Type Name Arguments
std::unique_ptr< MedicalDetection > create
  • const std::string & model_name
  • bool need_preprocess
vitis::ai::MedicalDetectionResult run
  • const cv::Mat & img
std::vector< vitis::ai::MedicalDetectionResult > run
  • const std::vector< cv::Mat > & imgs
int getInputWidth
  • void
int getInputHeight
  • void
size_t get_input_batch
  • void