跳转到主要内容
SDK Version: 2.3.3

DxInfer

DxInfer is an element that performs AI model inference using the DEEPX NPU. It processes input tensors received from DxPreprocess elements and produces output tensors for downstream processing.

  • Input tensors: DxInfer receives preprocessed input tensors from DxPreprocess and performs inference using a specified AI model.
  • Output tensors: Each output tensor is assigned an ID using the inference-id property, allowing downstream elements such as DxPostprocess to retrieve the correct output.
  • Model configuration: The AI model used for inference must be specified using the model-path property, which points to a compiled .dxnn file.

Key Features

Input Tensor Management
Input tensors are linked to DxInfer using the preprocess-id property. This ensures that the correct tensor from DXPreprocess is used for inference.

Output Tensor Management
Each output tensor is uniquely defined in the inference-id property. This allows downstream elements like DXPostprocess to connect to the correct inference output.

Pipeline Configuration
The recommended pipeline chain is [DxPreprocess] → [DxInfer] → [DxPostprocess]. When using features like secondary-mode, the configuration must be consistently applied across all three elements (DxPreprocess , DxInfer and DxPostprocess).

QoS Handling
If the downstream sink element has sync=true, input buffers may be dropped based on their timestamps to maintain real-time processing performance.

Throttle QoS Events
When DxRate sends a Throttle QoS Event, DxInfer drops incoming frames until the accumulated time between frames exceeds the throttling_delay value. This avoids unnecessary NPU computation in low-framerate pipelines and promotes smooth and consistent streaming.

JSON Configuration
All properties can be configured through a JSON file using the config-file-path property. This enables reusable, clean, and scalable configuration of inference behavior.

Hierarchy

GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstDxInfer

Properties

NameDescriptionTypeDefault Value
nameSets the unique name of the DxInfer element.String"dxinfer0"
config-file-pathPath to the JSON config file containing the element's properties.Stringnull
model-pathPath to the .dxnn model file used for inference.Stringnull
preprocess-idSpecifies the ID of the input tensor to be used for inference.Unsigned Integer0
inference-idSpecifies the ID of the output tensor to be used for postprocess.Unsigned Integer0
secondary-modeDetermines whether to operate in primary mode or secondary mode.Booleanfalse
use-ortDetermines whether to use ONNX Runtime (ORT) for inference.Booleantrue

Example JSON Configuration

{
"preprocess_id": 1,
"inference_id": 1,
"model_path" : "./dx_stream/samples/models/YOLOV5S_1.dxnn"
}
NOTE
  • The pipeline must follow [DxPreprocess] → [DxInfer] → [DxPostprocess] for correct and stable operation.
  • All properties can also be configured using a JSON file for enhanced usability and flexibility.