vitis::ai::MedicalDetection - 2.5 简体中文

Vitis AI Library 用户指南 (UG1354)

Document ID
UG1354
Release Date
2022-06-15
Version
2.5 简体中文
此基本类用于检测内窥镜疾病检测的 5 个对象和 Segmentation 数据库 (EDD2020)。

输入为图像 (cv:Mat)。

输出是检测结果的结构体,名为 MedicalDetectionResult

代码样本:

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;
}

显示模型结果:

图 1. 检测结果

函数快速参考

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

表 1. 函数快速参考
类型 成员 实参
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