vitis::ai::Classification - 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 index and score of objects in the input image.

Sample code:

auto image = cv::imread("sample_classification.jpg");
auto network = vitis::ai::Classification::create(
               "resnet50");
auto result = network->run(image);
for (const auto &r : result.scores) {
   auto score = r.score;
   auto index = result.lookup(r.index);
}

Quick Function Reference

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

Table 1. Quick Function Reference
Type Name Arguments
std::unique_ptr< Classification > create
  • const std::string & model_name
  • bool need_preprocess
vitis::ai::ClassificationResult run
  • const cv::Mat & image
std::vector< vitis::ai::ClassificationResult > run
  • const std::vector< cv::Mat > & images
std::vector< vitis::ai::ClassificationResult > run
  • const std::vector< vart::xrt_bo_t > & input_bos