vvas_xinfer - vvas_xinfer - 6.2 English - XD056

Vitis Video Analytics SDK (VVAS) 6.2 User Guide (XD056)

Document_ID
XD056
Release_Date
2026-06-12
Version
6.2 English

The vvas_xinfer plugin is designed to perform hardware-accelerated inference on video and images using various neural network models. This plugin is based on the ONNX Runtime and VART inference engine. ONNX Runtime supports both CPU Execution Provider (CPU-EP) and the VitisAI Execution Provider (VitisAI-EP), as well as mix of CPU-EP and VitisAI-EP. Vitis-AI-Runtime (VART) provided alternatives to bypass inefficiencies in acceleration further to extract HW maximum acceleration. It integrates seamlessly with GStreamer pipelines, enabling efficient use of hardware accelerators or CPU for real-time video analytics. Whether you are working with object detection, classification, or custom neural networks, vvas_xinfer provides a flexible and powerful solution.

../../../_images/vvas_xinfer_blockdiagram.png

Key Features

  • Versatility: Supports a wide range of neural network models.

  • Hardware Acceleration: Optimized for AMD Versal hardware, ensuring high performance.

  • Easy Integration: Compatible with standard GStreamer pipelines.

  • VART and ONNX Runtime Support: Compatible with both VART and ONNX Runtime (CPU/Vitis-AI EP) inference engines.

  • Pre-Processing: Uses VvasCore’s ImageProcess module for scaling, color space conversion, cropping, and normalization.

  • Post Processing: Uses VvasCore’s PostProcess module for interpreting the inference output and transforming it to meaningful information.

  • Wide Input Format Support: Handles a broad spectrum of input video formats.

  • VART Zero-Copy: Uses zero-copy data transfers between preprocessing and hardware accelerators for optimal latency with VART backend runtime.

  • DMA-BUF Input: Accepts DMA-BUF buffers from upstream elements (for example, v4l2src io-mode=dmabuf-import). When HW pre-processing is enabled or when the runtime is VART with HW input tensor, the proposed allocator exports DMA-BUF file descriptors so capture sources can write directly into XRT memory. See vvas_xinfer Buffer Allocation Strategies for the full negotiation matrix.

  • Multi-level and Cascade Inference: Supports multi-level inference pipelines for complex analytics tasks.

  • Inference Metadata: Uses GstInferenceMeta to store and attach inference results to GstBuffer.

  • Profiler Support: Built-in profiling capabilities to monitor performance.

  • Batch Support: Capable of processing multiple frames in a single batch for improved throughput with VART backend runtime.

  • VART Post-Processing: Allows integration of newly added VART post-processing libraries for various post process operations (Softmax/NMS etc).

The vvas_xinfer plug-in leverages the VvasCore's ImageProcess module for pre-processing tasks. This module handles essential pre-processing functions including scaling, color space conversion, cropping, and normalization. Pre-processing uses the hardware image_processing kernel through libvvas_image_process_hw_lib.so unless you supply a compatible custom image-process library via configuration.

Key Pre-Processing Features

  • Scaling: Adjusts the resolution of the input video stream to match the model’s requirements.

  • Color Space Conversion: Converts the input video to the appropriate color space needed for inference.

  • Cropping: Extracts the region of interest from the input video frame (applicable for second or later inference levels)

  • Normalization: Adjusts the pixel values to the range required by the neural network model.

Post Processing

The vvas_xinfer plug-in leverages the VvasCore’s PostProcess module for post processing tasks. This module handles essential post processing functions and supports models such as ResNet50, ResNet18 etc.

The PostProcess module can be configured to use either hardware accelerators for high-performance processing or software for scenarios where hardware acceleration is not available. ResNet50, ResNet18 and YOLOv5n: Only software post processing is supported in this release.

For the library-config JSON options accepted by each shipped library, see Sample Postprocess Library Configuration Reference.

You create and integrate your own post processing libraries for other models. For more details on creating your own post-processing libraries, refer to New post-process library Development .

Key Features of GstInferenceMeta

  • Tree Structure: Organizes inference results in a hierarchical manner.

  • Attached to GstBuffer: Ensures that inference results are directly associated with the corresponding video frames, facilitating downstream processing and analysis.

  • Flexible Data Representation: Capable of storing various types of inference data, from simple object detection results to complex multi-level analytics.

For details about meta data, refer to VVAS Inference Metadata.

Wide Input Format Support

The vvas_xinfer plug-in is designed to handle a wide range of input video formats, making it versatile and adaptable to various input sources and requirements.

  • vvas_xinfer supports the following video formats on both of its pads:

    • NV12

    • RGB

    • BGR

    • GRAY8

    • I420

    • RGBx

    • BGRx

    • RGBP

    • BGRP

    • RGB_FLOAT (Custom)

    • BGR_FLOAT (Custom)

    • RGB_FLOATP (Custom)

    • BGR_FLOATP (Custom)

    • RGB_BF16 (Custom)

    • BGR_BF16 (Custom)

    • RGB_BF16P (Custom)

    • BGR_BF16P (Custom)

    • RGBX_BF16_C4 (Custom)

    • BGRx_BF16_C4 (Custom)

    • RGB_FP16 (Custom)

    • BGR_FP16 (Custom)

    • RGB_FP16P (Custom)

    • BGR_FP16P (Custom)

    • RGBX_FP16_C4 (Custom)

    • BGRx_FP16_C4 (Custom)

    • GRAY_BF16 (Custom)

    • GRAY_FP16 (Custom)

    • GRAY_FLOAT (Custom)

    Note

    The formats mentioned with “Custom” are specific to VVAS and they are not compatible with open-source plugins.

    These caps are shown for the hardware image_processing path (libvvas_image_process_hw_lib.so).

    Note

    The pad template caps shown in gst-inspect-1.0 are superset caps of all available VvasImageProcess libraries. If a library is added or removed, remove the GStreamer plug-in registry cache file and reinspect to create it again.

    rm -rf ~/.cache/gstreamer-1.0

    If the plug-in registry cache is not removed, caps shown in gst-inspect-1.0 might not reflect the exact caps of the available image-process library.

Tensor Video Format Names

Xinfer plugin supports custom GStreamer video formats for AI tensor buffers. vvas_xinfer may show these names in gst-inspect-1.0 output, negotiated caps, and logs such as inference preferred caps. The selected tensor format is derived from model-format, tensor layout, and tensor data type. For the naming convention and mapping table, see Custom AI Tensor Formats.

For insight into the implementation details, refer to the vvas_xinfer source code located at <vvas>/vvas-gst-plugins/sys/infer.

Note

To ensure the smooth operation of multithreaded applications, it is important to create the ML pipeline in such a way that the vvas_xinfer instances are sequentially created instead of concurrently by multiple threads.

Control Parameters

Table 4 vvas_xinfer Plug-in Properties

Property Name

Type

Range

Default

Description

config-file

String

N/A

Null

Absolute path, including file name, of the JSON configuration file.

batch-timeout

Integer

0 to UINT_MAX

2000

Timeout in milliseconds to wait for batch size number of frames to arrive before processing a partial batch. A value of 0 indicates no timeout (wait indefinitely until batch size is reached).

enable-profiler

Boolean

true/false

false

Enables or disables the profiler for inference backend runtime.

profiler-file

String

N/A

Null

Specifies the file path to write the profiler output.

profiler-log-interval

Integer

1 to 60

0

Sets the duration (in seconds) for logging profiling details at GST_INFO log level.

Signals

Table 5 vvas_xinfer Plug-in Signals

Signal Name

Description

vvas-kernel-done

Notifies when the inference and post processing operations for a batch is completed.

JSON File Format to Be Provided as Input to the config-file Property

This section describes the JSON file format and configuration parameters for the vvas_xinfer plug-in.

  1. Sample config json for onnxrt with internal pre-processing

{
  "preprocess-config":{
    "xclbin-location":"./x_plus_ml.xclbin",
    "library-name": "libvvas_image_process_hw_lib.so",
    "library-config": "{\"kernel-name\":\"image_processing:{image_processing_1}\"}",
    "mean-r": 123.675,
    "mean-g": 116.28,
    "mean-b": 103.53,
    "scale-r": 0.017124,
    "scale-g": 0.017507,
    "scale-b": 0.017429,
  },
  "infer-config":{
    "model-format" : "RGB",
    "inference-backend-runtime" : "onnxrt",
    "onnxrt-config":{
      "onnx-model-path" : "./resnet50.onnx",
      "input-tensor-layout" : "NCHW",
      "onnxrt-ep" : "vitisai",
      "vitisai-ep-config":{
        "config-file-path": "./vitisai_config.json",
        "cache-dir": ".",
        "cache-key": "resnet50"
      }
    }
  },
  "postprocess-config" : {
    "library-path" : "/usr/lib/libvvascore_postprocess_resnet50-1.0.so",
    "library-config" : {
      "topk" : 1,
      "label-file-path" : "./imagenet-classes-1000.txt"
    }
  }
}
  1. Sample config json for vart with external pre-processing

{
  "infer-config":{
    "model-format" : "RGB",
    "inference-backend-runtime" : "vart",
    "vart-config": {
      "vart-model-path": "./ResNet50.rai"
    }
  },
  "postprocess-config" : {
    "library-path" : "/usr/lib/libvvascore_postprocess_resnet50-1.0.so",
    "library-config" : {
      "topk" : 1,
      "label-file-path" : "./imagenet-classes-1000.txt"
    }
  }
}

Various configuration parameters passed to vvas_xinfer via a JSON file are described in the following table.

config-file json members

Table 6 vvas_xinfer config-file json members

Json Key

Item

Item Description

preprocess-config

Description

Preprocess-config object provides information to configure VVAS ImageProcess module.

Value type

JSON Object

Mandatory/Optional

Optional

Default value

None

Object Members

Members of the preprocess-config JSON object are mentioned as follows.

infer-config

Description

Infer-config object provides information to configure the VVAS inference library.

Value type

JSON Object

Mandatory/Optional

Mandatory

Default value

None

Object Members

Members of the infer-config JSON object are mentioned as follows.

postprocess-config

Description

Postprocess-config object provides information to configure the VVAS postprocessor library.

Value type

JSON Object

Mandatory/Optional

Mandatory

Default value

None

Object Members

Members of the postprocess-config JSON object are mentioned as follows.

config-file infer-config JSON Members

Table 7 infer-config json members

Parameter

Type

Expected Values

Default

Description

attach-empty-metadata

Boolean

true/false

true

Adds empty inference metadata to GstBuffer, when there are no predictions available for that frame.

model-format

String

“RGB”/”BGR”

N/A

Model/network’s format.

inference-level

Integer

1 to 2

1

Specifies the inference level in cascaded pipeline; for example, object detection ML (level=1) followed by object classification ML (level=2) on detected objects.

attach-ppe-outbuf

Boolean

true/false

false

Specifies whether to attach the pre-processed ROI buffer inside the metadata tree so that subsequent stages can reuse the same crop (improving performance by avoiding repeated crop/resize operations).

inference-backend-runtime

String

“onnxrt”/”vart”

N/A

Specifies the inference backend runtime, accordingly config json object needs to be provided.

onnxrt-config

JSON Object

See Table onnxrt-config json members`

N/A

Configuration object for ONNX Runtime inference engine. Contains ONNX model path and optional execution provider settings.

vart-config

JSON Object

See Table vart-config json members`

N/A

Configuration object for vart inference engine. Contains vart model path and optional execution provider settings.

Table 8 onnxrt-config JSON Members

Parameter

Type

Expected Values

Default

Description

onnx-model-path

String

Path to .onnx file

N/A

Absolute or relative path to the ONNX model file to be used for inference.

input-tensor-layout

String

“NCHW” / “NHWC”

N/A

Specifies the layout of the input tensor expected by the ONNX model. Common values are “NCHW” (batch, channel, height, width) or “NHWC” (batch, height, width, channel). The selected layout and tensor data type determine the GStreamer tensor format name shown in caps and debug logs; see Custom AI Tensor Formats.

onnxrt-ep

String

“vitisai”`` / “cpu”

N/A

Specifies the Vitis AI Execution Provider (EP).

enable-profiling

Boolean

true / false

false

Enable or disable profiling.

profiling-file-path

String

File path to write profiling output

N/A

Specify the path to write profiling output.

vitisai-ep-config

JSON Object

See vitisai-ep json members

N/A

(Optional) Configuration for the Vitis AI Execution Provider (EP) in ONNX Runtime. If this node is set, the VitisAI EP will be used for inference; otherwise, the CPU Execution Provider (CPU-EP) will be used by default.

Table 9 vart-config JSON Members

Parameter

Type

Expected Values

Default

Description

vart-model-path

String

Path to VART model file

N/A

Absolute or relative path to the VART model file to be used for inference.

config-file-path

String

Path to config file

N/A

(Optional) Path to the Vitis AI EP configuration file (Example: vitisai_config.json).

ai-analyzer-profiling

Boolean

true / false

false

Parameter to enable or disable AI Analyzer profiling.

out-mem-bank

Integer

0 to 65535

0

VVAS output memory bank to allocate memory.

aie-columns-sharing

Boolean

true / false

true

Whether to use AIE columns sharing for the NPU overlay execution.

start-column

Integer

0 to 32

0

Start column for the NPU overlay execution.

Table 10 vitisai-ep JSON Members

Parameter

Type

Expected Values

Default

Description

config-file-path

String

Path to config file

N/A

Path to the Vitis AI EP configuration file (Example: vitisai_config.json).

ai-analyzer-profiling

Boolean

true / false

false

Parameter to enable or disable AI Analyzer profiling.

cache-dir

String

Path to cache directory or compiled model directory

/tmp/$USER/vaip

Directory path where cache files for the VAIML compiled model will be stored.

cache-key

String

Directory name

Directory named with a hash value under /tmp/$USER/vaip

Unique identifier (directory name) for the cache entry corresponding to the VAIML compiled model.

config-file preprocess-config JSON Members

Table 11 preprocess-config JSON Members

Parameter

Type

Expected Values

Default

Description

xclbin-location

String

/run/media/mmcblk0p1
/x_plus_ml.xclbin

N/A

Absolute path of the xclbin which contains the image process IP to program the FPGA device based on the device-index property.

library-name

String

libvvas_image_process
_hw_lib.so

N/A

Image process library name (.so file name) or path. Use libvvas_image_process_hw_lib.so for the supported hardware library, or your own implementation of the VVAS Image Process interface.

library-config

String

{“kernel-name”:
“image_processing
:{image_processing_1}
“}
(for libvvas_image
_process_hw_lib.so)

N/A

Image process library–specific configuration string. The image process library will use this configuration while initializing.

mean-r

Float

0 to 128

N/A

Mean pre-processing value for the Red channel.

mean-g

Float

0 to 128

N/A

Mean pre-processing value for the Green channel.

mean-b

Float

0 to 128

N/A

Mean pre-processing value for the Blue channel.

scale-r

Float

0 to 1

N/A

Scale pre-processing value for the Red channel.

scale-g

Float

0 to 1

N/A

Scale pre-processing value for the Green channel.

scale-b

Float

0 to 1

N/A

Scale pre-processing value for the Blue channel.

in-mem-bank

Integer

0 to 65535

0

VVAS input memory bank to allocate memory.

out-mem-bank

Integer

0 to 65535

0

VVAS output memory bank to allocate memory.

interpolation
-mode

Integer

0 to 2

Image process library default interpolation mode

Used to configure interpolation modes for scaling if supported by the image process library.

maintain-aspect
-ratio

Integer

0 to 65535

0

Type of scaling used for the resize operation. Some models require resize with aspect ratio preserved. If not set, default resizing will be applied.

symmetric-padding

Integer

0 to 65535

0

Applicable if maintain-aspect-ratio is set. If symmetric-padding is enabled, the processed image will be centered with symmetric bars; otherwise, it appears top-left with padding on the bottom or right edges.

image-pad
-value

Integer

0 to UINT_MAX

0

Pixel value used for padding regions when maintaining aspect ratio.

quantization

JSON Object

See quantization json object

N/A

Configuration JSON object for quantization.

Table 12 Quantization json object

Parameter

Type

Expected Values

Default

Description

scale-factor

Float

(0.0, 1.0]

N/A

Multiplicative factor applied to quantize the pre-processed input before passing to the model. See Quantization and Dequantization.

config-file postprocess-config JSON Members

Table 13 Postprocess-config json members

Parameter

Type

Expected Values

Default

Description

library-path

string

/usr/lib/libvvascore
_postprocessor.so

N/A

Library to post-process tensors. Absolute path of the library has to be given.

  • Embedded: /usr/lib
    /libvvascore_postprocess
    _resnet50-1.0.so

library-config

JSON object

json object

N/A

JSON configuration specific to the post processing library. See Sample Postprocess Library Configuration Reference for the fields accepted by each shipped library.

dequantization

JSON Object

See dequantization json object

N/A

Configuration json object for dequantization.

Table 14 Dequantization json object

Parameter

Type

Expected Values

Default

Description

scale-factor

Float

(0.0, 1.0]

N/A

Multiplicative factor applied to dequantize the raw output tensors before passing to the post-processing library. See Quantization and Dequantization.

Example pipelines

Single stage inference pipeline

The following is an example of a simple inference pipeline using Resnet50 model. The input for this pipeline is an NV12 YUV file (test.nv12):

The pipeline employs the Resnet50.onnx model for ML inference. First, a 1920x1080 NV12 frame is fed into the vvas_xinfer plugin. The pre-processor then resizes the frame and converts the color format to RGB, which is required by the model. In addition, mean value subtraction and normalization operations are performed on the frame. The resized and pre-processed frame is then passed to the inference library, which generates the inference predictions. These predictions are then upscaled to the original resolution (1920x1080) and attached to the output buffer.

Note

  • The JSONs provided below are only samples. Ensure model-path is set to point to your available model before running.

gst-launch-1.0 filesrc location=<INPUT>.nv12 ! rawvideoparse width=<INPUT_WIDTH> height=<INPUT_HEIGHT> format=nv12 ! \
vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_onnxrt.json ! fakesink -v

Multi-level cascaded inference pipeline

Multi-level inference builds a cascade of models where the output metadata from a parent model (for example, a YOLO detector) drives child models (for example, ResNet classifiers) on cropped regions of interest (ROI). The vvas_xinfer element attaches a tree of inference metadata to each frame: the root represents the frame, each detection is a child node, and each classification result becomes a child of its detection node. In a 2-stage pipeline, YOLO generates bounding boxes, vvas_xinfer crops each box and runs the classifier, and the classifier results are inserted under the corresponding detection in the metadata tree. The attach-ppe-outbuf option stores the pre-processed ROI buffer inside the metadata tree so that subsequent stages can reuse the same crop (improving performance by avoiding repeated crop/resize operations).

Metadata tree (single frame with two detections and two classification results)

Frame (root)
├─ Detection #0 (bbox, label, score)
│ ├─ Classification #0 (label, prob)
│ └─ Classification #1 (label, prob)
└─ Detection #1 (bbox, label, score)
│ ├─ Classification #0 (label, prob)
│ └─ Classification #1 (label, prob)

Yolo + Resnet50 + pipeline

Note

  • The JSONs provided below are only samples. Ensure model-path is set to point to your available model before running.

  • Ensure label-file-path in the YOLOv5n JSON points to the correct label file for your model.

gst-launch-1.0 \
filesrc location=<INPUT>.bgr ! \
rawvideoparse format=bgr height=<INPUT_HEIGHT> width=<INPUT_WIDTH> ! \
vvas_xinfer config-file=/etc/vvas/configs/infer/yolov5n_vart.json ! \
vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_l2.json ! \
vvas_xmetaconvert config-location=/etc/vvas/configs/metaconvert/metaconvert_config.json ! \
vvas_xoverlay ! \
fpsdisplaysink sync=false text-overlay=false video-sink='filesink location=./output_yolo_r50_640x640.bgr' -v

Yolo + Resnet50 + Resnet50 (L2) pipeline

Note

  • The JSONs provided below are only samples. Ensure model-path is set to point to your available model before running.

  • Ensure label-file-path in the YOLOv5n JSON points to the correct label file for your model.

  • In branched pipelines (using tee), metadata and ROI buffers are shared by default. If attach-ppe-outbuf is enabled in one branch, its ROI buffers may be reused by other branches, which can cause classification results from different branches to appear together. To avoid cross-branch mixing, keep attach-ppe-outbuf=false for secondary stages in branched pipelines, or add a buffer/meta copy in each branch before running the second-stage vvas_xinfer.

gst-launch-1.0 \
filesrc location=<INPUT>.bgr ! \
rawvideoparse format=bgr height=<INPUT_HEIGHT> width=<INPUT_WIDTH> ! \
vvas_xinfer config-file=/etc/vvas/configs/infer/yolov5n_vart.json ! \
vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_l2.json ! \
vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_l2.json ! \
vvas_xmetaconvert config-location=/etc/vvas/configs/metaconvert/metaconvert_config.json ! \
vvas_xoverlay ! \
fpsdisplaysink sync=false text-overlay=false video-sink='filesink location=./output_yolo_r50_r18_640x640.bgr' -v

Advanced Features

Batch Processing Support

The vvas_xinfer plug-in supports batch processing mode exclusively with the VART backend runtime to improve throughput by processing multiple frames in a single inference call. This feature is not available with ONNX Runtime backend.

Key Features:

  • Automatic Detection: The plug-in automatically detects the batch mode configuration from the compiled VART model during initialization. No explicit configuration is required from the user.

  • Split Batch Mode: The plug-in operates in split batch mode, where individual pre-processed tensors are gathered and sent for inference once the batch size (N) is reached. There is no need to create a single concatenated tensor for the entire batch.

  • Partial Batch Processing: The plug-in intelligently handles partial batches in the following scenarios:

    • End-of-Stream (EOS): When EOS is received and the number of accumulated frames is less than the batch size, the plug-in processes the partial batch to ensure all frames are inferenced.

    • Timeout: If frames do not accumulate to the full batch size within a specified timeout period, the plug-in processes the available frames as a partial batch to maintain pipeline responsiveness. The timeout duration can be configured via the batch-timeout property (in milliseconds).

How It Works:

  1. The plug-in accumulates pre-processed input tensors until the batch size is reached.

  2. Once N tensors are gathered, they are sent together for a single inference operation.

  3. Inference results are then distributed back to their corresponding input frames.

  4. In case of EOS or timeout, any remaining frames (less than batch size) are processed immediately.

Example Pipeline with Batch Processing:

Note

  • The JSONs provided below are only samples. Ensure model-path is set to point to your available model before running.

gst-launch-1.0 filesrc location=<INPUT>.nv12 ! \
 rawvideoparse width=<INPUT_WIDTH> height=<INPUT_HEIGHT> format=nv12 ! \
 vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_vart.json ! \
 fakesink -v

In this example, if the resnet50 model is compiled with batch N, the plug-in will automatically accumulate N frames, perform inference on all of them together, and then output the results. User need to ensure that the model is compiled with the desired batch size using Vitis AI compiler tools, as the plug-in relies on the batch size specified in the compiled model.

Note

Batch processing is only supported with VART backend runtime. Ensure your model is compiled with the desired batch size using Vitis AI compiler tools. The plug-in will use the batch size specified in the compiled model.

VART Post-Processing Support

VVAS historically supports post-processing based on the VvasCore post-processing library interface, where users can create custom post-processing libraries using defined interfaces to hook into the vvas_xinfer plugin flow without modifying the plugin code. VVAS provides example post-processing libraries for ResNet50 and YOLO models as demonstration use cases and reference implementations.

Traditional VvasCore Post-Processing:

"postprocess-config": {
    "library-path": "/usr/lib/libvvascore_postprocess_resnet50-1.0.so",
    "library-config": {
        "topk": 1,
        "label-file-path": "/etc/vvas/configs/infer/imagenet-classes-1000.txt"
    }
}

VART-Based Post-Processing:

With this release, VVAS also supports VART-based post-processing operations that are based on operators rather than model types. This provides flexibility to compose post-processing pipelines using various operators. VVAS includes a standalone library implementation (libvvascore_postprocess_vart.so) for the VART-X interface, requiring no modifications to the infer plugin itself.

Supported VART Post-Processing Operators:

Classification:

  • SOFTMAX

  • ARGMAX

  • TOPK

  • THRESHOLD

  • LABEL_MAPPING

  • NORMALIZATION

  • CALIBRATION_TEMPERATURE

  • CALIBRATION_PLATT

  • BIAS_CORRECTION

  • OUTLIER_DETECTION

  • UNCERTAINTY_ESTIMATION

Detection:

  • NMS

  • ANCHOR_ADJUSTMENT

  • CLASSWISE_NMS

  • DISTANCE_IOU_NMS

  • OBJECT_COUNT

  • SOFT_NMS

Example VART Post-Processing Configuration:

The following is an example post-processing configuration using the SOFTMAX operator for ResNet50:

"postprocess-config": {
    "library-path": "/usr/lib/libvvascore_postprocess_vart.so",
    "library-config": {
        "topk": 1,
        "label-file-path": "/etc/vvas/configs/infer/imagenet-classes-1000.txt",
        "type": "SOFTMAX",
        "post-process-print": "false",
        "model-params": {
            "quant-scale-factors": [4.0]
        }
    }
}

Note

When using VART-based post-processing, ensure that the models are compiled with the flags in vitisai_config.json “fe_experiment”: “edge-quantization-in-rt=1 enable-output-without-rt-support=1”.

For detailed information about VART post-processing operators and their configuration, refer to the VART documentation.

Mixed-Precision Models

vvas_xinfer runs models that mix tensor precisions across layers — for example, an INT8 backbone with an FP16 detection head. Supported dtypes are INT8, BF16, FP16 and FLOAT32, on both the ONNX Runtime (VitisAI EP) and VART backends. The plug-in handles the precision boundaries transparently; no extra configuration is required beyond pointing vart-model-path (or onnx-model-path) at the compiled mixed-precision model. Refer to Vitis-AI compiler guide to generate models.

Quantization and Dequantization

Quantization scaling adjusts the pre-processed input to the fixed-point range expected by the model. Dequantization scaling converts the raw integer output tensors back to floating-point values before the post-processing library interprets them.

Quantization (preprocess → model input)

The preprocess-config.quantization.scale-factor is a multiplicative factor applied to the normalized input tensor. It converts floating-point pixel values into the INT8 range the compiled model expects.

Dequantization (model output → postprocess)

The postprocess-config.dequantization.scale-factor is a multiplicative factor applied to the raw output tensor. It converts INT8 model outputs back to float values before the post-processing library (softmax, NMS, etc.) interprets them.

VART backend — auto-detection

When using the VART backend, vvas_xinfer reads the per-tensor quantization parameters embedded in the compiled .rai model at start-up. The following precedence applies:

  1. If scale-factor is explicitly set in the config JSON, that value is used.

  2. Otherwise, the model’s embedded scale is used automatically.

  3. If neither is available, a default factor of 1.0 is applied.

For most pre-compiled .rai models the quantization and dequantization blocks can be omitted — the correct values are read from the model.

ONNX Runtime backend

Auto-detection is not available with the ONNX Runtime backend. scale-factor must be specified explicitly in both quantization and dequantization blocks when quantization scaling is required.

Profiler Support

The vvas_xinfer plug-in includes built-in profiling capabilities that allow users to monitor and analyze the performance of the inference pipeline. To enable profiling, set the enable-profiler property to true on the vvas_xinfer plugin element.

The profiling data is automatically written to a JSON output file named vvas_xinfer_profiler_data_XXXX.json, which contains detailed performance metrics for analysis. Users can customize the output file name by setting the profiler-file property to specify a custom file path.

Optionally, set the profiler-log-interval property to define the log frequency in seconds to get periodic profiling logs at runtime. To view the profiling logs in the console, the inference log level must be set to GST_INFO or higher.

Example Pipeline with Profiling Enabled:

Note

  • The JSONs provided below are only samples. Ensure model-path is set to point to your available model before running.

export GST_DEBUG="vvas_xinfer:4"

gst-launch-1.0 filesrc location=<INPUT>.rgb \
 ! rawvideoparse width=<INPUT_WIDTH> height=<INPUT_HEIGHT> format=rgb ! queue \
 ! vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_vart.json \
 enable-profiler=true profiler-log-interval=5 ! queue min-threshold-buffers=4 ! queue \
 ! vvas_xmetaconvert config-location=/etc/vvas/configs/metaconvert/metaconvert_config.json \
 ! vvas_xoverlay ! queue ! fpsdisplaysink video-sink="fakesink" text-overlay=false sync=false

In this example, profiling is enabled with a log interval of 5 seconds, allowing periodic performance monitoring during the inference operation.

Profiler Output JSON Structure

The profiler captures timing data for the preprocess, inference, and postprocess stages of the pipeline. When the pipeline concludes, the profiling results are written to a JSON file with the following structure:

General Metrics:

  • backend: The inference backend runtime used (for example, "onnxruntime:vitisai-ep", "vart").

  • duration_sec: Total duration of the pipeline execution in seconds.

  • frames: Total number of frames processed.

  • fps_avg: Average frames per second (FPS) achieved during execution.

Per-Stage Metrics:

For each stage (preprocess, inference, postprocess), the following timing information is captured:

  • init_us: Initialization time for the stage in microseconds.

  • deinit_us: De-initialization time for the stage in microseconds.

  • avg_us: Average execution time per frame in microseconds.

  • min_us: Minimum execution time observed in microseconds.

  • max_us: Maximum execution time observed in microseconds.

  • samples: Number of samples (frames) processed in this stage.

Sample Profiler Output:

{
  "backend": "onnxruntime:vitisai-ep",
  "duration_sec": "8.250",
  "frames": 1062,
  "fps_avg": "128.721",
  "preprocess": {
    "init_us": 26431,
    "deinit_us": 239,
    "avg_us": 350,
    "min_us": 345,
    "max_us": 697,
    "samples": 1066
  },
  "inference": {
    "init_us": 1596981,
    "deinit_us": 2,
    "avg_us": 7641,
    "min_us": 7597,
    "max_us": 8140,
    "samples": 1063
  },
  "postprocess": {
    "init_us": 79,
    "deinit_us": 147,
    "avg_us": 74,
    "min_us": 67,
    "max_us": 146,
    "samples": 1062
  }
}

This profiling data helps identify performance bottlenecks across different stages of the inference pipeline, enabling optimization and performance tuning.

Debugging Tips

  • Enable Debug Logging: Use the GST_DEBUG environment variable to enable detailed logging:

    GST_DEBUG=vvas_xinfer:6 gst-launch-1.0 ...
    
    # Above mentioned example command (with debug logs) will print the inference results for the given input file.
    # The sample print is as below.
    infer-result-type : classification,
    label : airliner
    probability : 0.929330
    
    # To check onnx model runtime environment, You can search for print statement with "[Vitis AI EP]". Here, "NPU" indicates offloaded to AI engine, and "CPU" indicates cpu execution.
    # Please note that vart models are fully offloaded to AI engine.