vitis::ai::Classification - 1.2 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2020-07-21
Version
1.2 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(
               "resnet_50",
               true);
auto result = network->run(image);
for (const auto &r : result.scores) {
   auto score = r.score;
   auto index = network->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
const char * lookup
  • int index
vitis::ai::ClassificationResult run
  • const cv::Mat & image
std::vector< vitis::ai::ClassificationResult > run
  • const std::vector< cv::Mat > & images
int getInputWidth
  • void
int getInputHeight
  • void
size_t get_input_batch
  • void