vitis::ai::Classification - 3.5 English

Vitis AI Library User Guide (UG1354)

Document ID
Release Date
3.5 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(
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 Member 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