Gst-nvdspreprocess
The Gst-nvdspreprocess plugin is a customizable plugin which provides a custom library interface for preprocessing on input streams. Each stream can have its own preprocessing requirements. (e.g. per stream ROIs - Region of Interests processing) Streams with same preprocessing requirements are grouped and processed together. These requirements can be specified via a config file. Refer to section Gst-nvdspreprocess File Configuration Specifications below for more details.
Default plugin implementation provides two functionalities.
-
Streams with predefined ROIs (Region of Interests) are scaled and format converted as per the network requirements for inference. Per stream ROIs are specified in the config file.
-
It prepares a raw tensor from the scaled & converted ROIs. It is passed to the downstream plugins via user metadata. Downstream plugins can access this tensor for inference.
The default custom library (nvdspreprocess_lib) provided with the plugin implements these functionalities. It contains the group transformation (scaling and conversion functionality per group) and tensor preparation functions for 2d convolution NCHW/NHWC models. User can implement its own library with group transformation functions and tensor preparation function as per the requirements.
This plugin can operate in two modes PGIE and SGIE. Preprocess with PGIE mode is used to process the given ROI/Frame on which we want to perform primary inferencing. Preprocess with SGIE mode is used to process the detected objects within the given ROI/Frame on which we want to perform secondary inferencing.

Inputs and Outputs
-
Inputs
- Input Video Gst Buffers
- Metadata (NvDsBatchMeta)
-
Control parameters
- config-file
-
Output
- Output Video Gst Buffers
- Metadata (NvDsBatchMeta) + User Metadata at batch level (NvDsPreProcessBatchMeta)
Features
The following table summarizes the features of the plugin.
Gst-nvdspreprocess features
Custom library Interfaces
-
custom_transform => An Interface to implement custom transformation for different group of streams. Default implementation provides group transformation functionalities of ROIs specified in the config fie.
-
custom_tensor_function => An interface to provide custom tensor preparation function. Default implementation prepares raw tensor from transformed ROIs
Gst-nvdspreprocess File Configuration Specifications
The Gst-nvdspreprocess configuration file uses a “Key File” format described in https://specifications.freedesktop.org/desktop-entry-spec/latest.
Refer to config_preprocess.txt at /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-nvdspreprocess/config_preprocess.txt.
The [property] group configures the general behavior of the plugin.
The [group-<id>] group configures ROIs/full-frames for a group of streams with src-ids and custom-input-transformation-function from custom lib.
The [user-configs] group configures parameters required by the custom library, which is passed on to custom lib through a map of <string,string> as key-value pair.
custom lib needs to parse the values accordingly.
The following two tables describes the keys supported for [property] groups and [group-<id>] groups respectively.
Gst-nvdspreprocess property Group Supported Keys
Gst-nvdspreprocess group-<id> Group Supported Keys
The following table describes the keys supported for [user-configs] group for custom library nvdspreprocess_lib.
Gst-nvdspreprocess user-configs Group Supported Keys
The following table describes the keys supported for [user-configs] group for custom library libnvds_custom_sequence_preprocess.so. which gets used in deepstream-3d-action-recognition sample app.
user-configs properties for custom sequence preprocess
Gst Properties
The following table describes the Gst properties of the Gst-nvdspreprocess plugin.
Gst-nvspreprocess gst properties
Sample pipelines
Given below are some sample pipelines to demonstrate preprocess plugin’s usage, please set the appropriate configuration file and library paths.
Preprocess in PGIE mode for single stream (dGPU):
Preprocess in PGIE mode for single stream (Jetson):
Preprocess in PGIE mode for Multi-stream (dGPU):
Preprocess in PGIE mode for Multi-stream (Jetson):
Preprocess in PGIE and SGIE Mode for single stream (dGPU):
Preprocess in PGIE and SGIE Mode for single stream (Jetson):
Preprocess in PGIE and SGIE Mode for Multi-stream (dGPU):
Preprocess in PGIE and SGIE Mode for Multi-stream (Jetson):