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
GstInferenceMetais the root node of the inference metadata.GstInferencePredictionhosts the actual inference metadata.
Definition
struct GstInferenceMeta {
GstMeta meta;
GstInferencePrediction *prediction;
gchar *stream_id;
};
Members
metaAttaches additional metadata to buffers flowing through the pipeline. Metadata can carry extra details, hints, or instructions between different elements in the pipeline.
predictionStores the address of the root prediction node, where inference metadata is organized within child nodes.
stream_idIdentifier 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
basePrivate base object to enable efficient memory management and reference counting for multiple object detection/prediction.
mutexProvides mutual exclusion in scenarios where multiple threads are accessing shared resources such as detection results or memory allocations.
sub_bufferBuffer containing cropped images for the cascade use case.
predictionVVAS inference prediction data — bounding box, classification results, and child predictions. See
VvasInferPredictionin the VVAS SDK headers.reserved_1…reserved_5Reserved 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_idUnique identifier for this prediction node.
enabledWhen
true, this prediction is used for further (cascade) inference. Set tofalseto skip this node without removing it from the tree.nodeAddress of the tree node used to build the hierarchical prediction tree. Child predictions are appended via
vvas_inferprediction_append().scaled_to_rootIndicates whether the bounding-box coordinates have been scaled to the root-node (original frame) resolution.
model_pathPath to the model that produced this prediction.
tensorsList of raw output tensors (
TensorBuf) from the model. Used by the post-processing library to extract structured results.tb_refReference to the
TensorBuffrom which the inference result was extracted; maintains tensor lifetime while results are in use.privApplication-private data slot. The application provides
freeandcopycallbacks to manage its own associated data.infer_resultStructured inference result populated by the post-processing library. See VvasInferResult and VvasInferResultType.
width/heightDimensions 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_NONENo result. Initial state before the post-processing library sets a result.
VVAS_INFER_RESULT_DETECTIONThe result is a
VvasInferDetection— bounding box, label, class ID, and probability for a detected object.VVAS_INFER_RESULT_CLASSIFICATIONThe result is a
VvasListofVvasInferClassificationentries — 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
dataPointer to the concrete result structure. Cast to
VvasInferDetectionwheninfer_result_typeisVVAS_INFER_RESULT_DETECTION, or toVvasListofVvasInferClassificationwhen it isVVAS_INFER_RESULT_CLASSIFICATION.infer_result_typeDiscriminator identifying the result type. See VvasInferResultType.
createAllocates a new result of this type.
freeReleases the result and its
data.copyDeep-copies the result into a new allocation.
transformScales 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
xHorizontal coordinate of the upper-left corner of the bounding box (pixels).
yVertical coordinate of the upper-left corner of the bounding box (pixels).
widthWidth of the bounding box in pixels.
heightHeight of the bounding box in pixels.
box_colorRGBA 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
bboxBounding box coordinates and display color for the detected object.
labelHuman-readable class label string (for example,
"car","person"), orNULLif no label is available.class_idNumerical class index corresponding to
label.probabilityDetection confidence score, typically in the range [0.0, 1.0].
obj_track_labelTracker-assigned label for this object across frames.
NULLwhen 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_idUnique identifier for this classification entry.
idNumerical class index.
probabilityConfidence score for this class, typically in the range [0.0, 1.0].
labelHuman-readable class label string, or
NULLif not available.label_colorRGBA 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.