VVAS Inference Metadata - VVAS Inference Metadata - 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 GstInferenceMeta object, also known as the VVAS inference metadata, serves as a repository for information related to the metadata produced by VVAS plug-ins that accelerate the machine learning (ML) inference. It collects data generated from various levels of ML operations and organizes them hierarchically within a single tree structure. This data structure consolidates and stores metadata from detection and classification models.

The GStreamer plug-ins can set and get inference metadata from GstBuffer by using the gst_buffer_add_meta() API and gst_buffer_get_meta() API, respectively.

GstInferenceMeta

struct GstInferenceMeta

GstInferenceMeta is the root node of the inference metadata. GstInferencePrediction hosts the actual inference metadata.

Definition

struct GstInferenceMeta {
  GstMeta meta;
  GstInferencePrediction *prediction;
  gchar *stream_id;
};

Members

meta

Attaches additional metadata to buffers flowing through the pipeline. Metadata can carry extra details, hints, or instructions between different elements in the pipeline.

prediction

Stores the address of the root prediction node, where inference metadata is organized within child nodes.

stream_id

Identifier of the stream that produced this metadata. Useful in multi-stream pipelines to tag results per stream.

GstInferencePrediction

struct GstInferencePrediction

Represents the inference data generated from an ML operation. Prediction nodes form a tree rooted at GstInferenceMeta.prediction; child nodes represent cascaded or subordinate (multi-level) predictions.

Definition

struct GstInferencePrediction {
  GstMiniObject base;
  GMutex mutex;
  GstBuffer *sub_buffer;
  VvasInferPrediction prediction;
  void *reserved_1;
  void *reserved_2;
  void *reserved_3;
  void *reserved_4;
  void *reserved_5;
};

Members

base

Private base object to enable efficient memory management and reference counting for multiple object detection/prediction.

mutex

Provides mutual exclusion in scenarios where multiple threads are accessing shared resources such as detection results or memory allocations.

sub_buffer

Buffer containing cropped images for the cascade use case.

prediction

VVAS inference prediction data — bounding box, classification results, and child predictions. See VvasInferPrediction in the VVAS SDK headers.

reserved_1 … reserved_5

Reserved for future extension; do not use.

VvasInferPrediction

VvasInferPrediction is the VVAS-level prediction structure embedded inside GstInferencePrediction. It holds the bounding box, inference result, and the tree linkage for cascade (multi-level) inference.

Definition

typedef struct {
  uint64_t prediction_id;
  bool enabled;
  VvasTreeNode *node;
  bool scaled_to_root;
  char *model_path;
  VvasList *tensors;
  TensorBuf *tb_ref;
  VvasInferPredictionPriv priv;
  VvasInferResult *infer_result;
  int width;
  int height;
} VvasInferPrediction;

Members

prediction_id

Unique identifier for this prediction node.

enabled

When true, this prediction is used for further (cascade) inference. Set to false to skip this node without removing it from the tree.

node

Address of the tree node used to build the hierarchical prediction tree. Child predictions are appended via vvas_inferprediction_append().

scaled_to_root

Indicates whether the bounding-box coordinates have been scaled to the root-node (original frame) resolution.

model_path

Path to the model that produced this prediction.

tensors

List of raw output tensors (TensorBuf) from the model. Used by the post-processing library to extract structured results.

tb_ref

Reference to the TensorBuf from which the inference result was extracted; maintains tensor lifetime while results are in use.

priv

Application-private data slot. The application provides free and copy callbacks to manage its own associated data.

infer_result

Structured inference result populated by the post-processing library. See VvasInferResult and VvasInferResultType.

width / height

Dimensions of the input image for which this prediction was generated.

VvasInferResultType

VvasInferResultType identifies the type of inference result stored in a VvasInferResult. Each type has a corresponding result structure pointed to by VvasInferResult.data.

Definition

typedef enum {
  VVAS_INFER_RESULT_NONE,
  VVAS_INFER_RESULT_DETECTION,
  VVAS_INFER_RESULT_CLASSIFICATION,
} VvasInferResultType;

Values

VVAS_INFER_RESULT_NONE

No result. Initial state before the post-processing library sets a result.

VVAS_INFER_RESULT_DETECTION

The result is a VvasInferDetection — bounding box, label, class ID, and probability for a detected object.

VVAS_INFER_RESULT_CLASSIFICATION

The result is a VvasList of VvasInferClassification entries — one per class label assigned to the input image or crop.

VvasInferResult

VvasInferResult is a type-erased container that holds the actual inference result along with utility function pointers for lifecycle management. The data pointer is cast to the concrete result structure indicated by infer_result_type.

Definition

struct VvasInferResult {
  void *data;
  VvasInferResultType infer_result_type;
  VvasInferResult* (*create) (void);
  bool (*free) (void *);
  bool (*copy) (const void *, void **);
  bool (*transform) (void *, VvasInferScaleInfo *);
};

Members

data

Pointer to the concrete result structure. Cast to VvasInferDetection when infer_result_type is VVAS_INFER_RESULT_DETECTION, or to VvasList of VvasInferClassification when it is VVAS_INFER_RESULT_CLASSIFICATION.

infer_result_type

Discriminator identifying the result type. See VvasInferResultType.

create

Allocates a new result of this type.

free

Releases the result and its data.

copy

Deep-copies the result into a new allocation.

transform

Scales bounding-box coordinates using the supplied VvasInferScaleInfo. Used internally during cascade inference to map predictions back to the original frame resolution.

VvasBoundingBox

VvasBoundingBox holds the position, size, and display color of a detected object’s bounding box.

Definition

typedef struct {
  int32_t x;
  int32_t y;
  uint32_t width;
  uint32_t height;
  VvasColorInfo box_color;
} VvasBoundingBox;

Members

x

Horizontal coordinate of the upper-left corner of the bounding box (pixels).

y

Vertical coordinate of the upper-left corner of the bounding box (pixels).

width

Width of the bounding box in pixels.

height

Height of the bounding box in pixels.

box_color

RGBA color used to draw the bounding box. See VvasColorInfo.

VvasInferDetection

VvasInferDetection holds the detection result for a single detected object. It is pointed to by VvasInferResult.data when infer_result_type == VVAS_INFER_RESULT_DETECTION.

Definition

typedef struct {
  VvasBoundingBox bbox;
  char *label;
  int class_id;
  double probability;
  char *obj_track_label;
} VvasInferDetection;

Members

bbox

Bounding box coordinates and display color for the detected object.

label

Human-readable class label string (for example, "car", "person"), or NULL if no label is available.

class_id

Numerical class index corresponding to label.

probability

Detection confidence score, typically in the range [0.0, 1.0].

obj_track_label

Tracker-assigned label for this object across frames. NULL when tracking is not in use.

VvasInferClassification

VvasInferClassification holds a single classification result — one entry per class label. For classification models the VvasInferResult.data points to a VvasList of VvasInferClassification items.

Definition

typedef struct {
  uint64_t classification_id;
  int32_t id;
  double probability;
  char *label;
  VvasColorInfo label_color;
} VvasInferClassification;

Members

classification_id

Unique identifier for this classification entry.

id

Numerical class index.

probability

Confidence score for this class, typically in the range [0.0, 1.0].

label

Human-readable class label string, or NULL if not available.

label_color

RGBA color used to render this class label in overlay.

GstInferenceMetaData APIs

The following APIs allow access, modification, and update of inference metadata structures produced by the vvas_xinfer GStreamer plug-in.

  • gst_inference_prediction_new() — Creates a new prediction node initialized to default values.

  • gst_inference_prediction_new_full() — Creates a new prediction node and sets its bounding box.

  • gst_inference_prediction_copy() — Performs a deep copy of a prediction node.

  • gst_inference_prediction_ref() — Increases the reference count of a prediction node.

  • gst_inference_prediction_unref() — Decreases the reference count; frees the node when it reaches zero.

  • gst_inference_prediction_append() — Attaches a prediction node as a child of another node.

  • gst_inference_prediction_get_children() — Retrieves all child nodes as a linked list.

  • gst_inference_prediction_find() — Traverses the tree to find a node by prediction ID.

  • gst_inference_prediction_to_string() — Serializes a prediction and its children to a JSON-like string.