vitis::ai::UltraFast - 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 traffic lane for CULane dataset.

Input is an image (cv:Mat).

Output is a struct of detection results, named UltraFastResult.

Sample code :

Mat img = cv::imread("sample_ultrafast.jpg");
auto ultrafast = vitis::ai::UltraFast::create("ultrafast_pt",true);
auto results = ultrafast->run(img);
for(const auto &lanes : results.lanes){
  std::cout <<"lane:\n";
  for(auto &v: lanes) {
     std::cout << "    ( " << v.first << ", " << v.second << " )\n";
  }
}

Display of the model results:

Figure 1. detection result
Image sample_ultrafast_result.jpg

Quick Function Reference

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

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