Developing with Vitis AI API_1 - 3.5 English

Vitis AI Library User Guide (UG1354)

Document ID
Release Date
3.5 English

Vitis AI API_1 is a set of high-level API-based libraries involving different vision tasks including classification, detection, and segmentation. It is optimized for the whole algorithm flow, including pre-process and post-process, and supports the models in the AI Model Zoo.

  1. Download the corresponding Docker image from
  2. Load and run the Docker Image.
  3. Create a folder and place the float model within it on the host side, then use the Vitis AI Quantizer to quantize the model. For more details, see the Vitis AI User Guide (UG1414).
  4. Use the Vitis AI Compiler to compile the model and generate an xmodel file, such as yolov3_custom.xmodel. For more information, see the Vitis AI User Guide (UG1414).
  5. Create the yolov3_custom.prototxt file, as shown in the following snippet.
    model {
      name: "yolov3_custom"
      kernel {
         name: "yolov3_custom"
         mean: 0.0
         mean: 0.0
         mean: 0.0
         scale: 0.00390625
         scale: 0.00390625
         scale: 0.00390625
      model_type : YOLOv3
      yolo_v3_param {
        num_classes: 20
        anchorCnt: 3
        layer_name: "59"
        layer_name: "67"
        layer_name: "75"
        conf_threshold: 0.3
        nms_threshold: 0.45
        biases: 10
        biases: 13
        biases: 16
        biases: 30
        biases: 33
        biases: 23
        biases: 30
        biases: 61
        biases: 62
        biases: 45
        biases: 59
        biases: 119
        biases: 116
        biases: 90
        biases: 156
        biases: 198
        biases: 373
        biases: 326
        test_mAP: false
  6. Create the yolov3_custom folder. Put the yolov3_custom.xmodel and yolov3_custom.prototxt files in the yolov3_custom folder.
  7. Copy the yolov3_custom folder to /usr/share/vitis_ai_library/models on the target.
  8. Use the sample code for Yolov3 for the application code. There is no need to modify it.
    int main(int argc, char* argv[]) {
      std::string model = argv[1];
      return vitis::ai::main_for_jpeg_demo(
        argc, argv,
        [model] {
          return vitis::ai::YOLOv3::create(model);
        process_result, 2);
  9. Cross-compile the program and generate an executable file called test_jpeg_yolov3.
    cd Vitis-AI/examples/vai_library/samples/yolov3
    sh -x
  10. Copy the executable program to the target board using scp.
    scp test_jpeg_yolov3 root@IP_OF_BOARD:~/
  11. Install the VART runtime on the target. For details, refer to Step 3: Installing the AI Library Package.
  12. Execute the program on the target board to get the following results.
    ./test_jpeg_yolov3 yolov3_custom sample.jpg 
Note: When you develop with Vitis AI API_1, prepare the model.xmodel and model.protxt files. Run the model with the Vitis AI Library samples. You can find all the Vitis AI Library samples in the Vitis-AI/examples/vai_library/samples folder.