Can Deepstream select to enable or disable object detection for different sources


For multi camera sources (e.g.4, V4L2 or RTSP) outputting to one sink, if I want 2 of them to have object detection, and other 2 have not. Is it possible? If yes, how to implement it?

-> 5. How to support each stream to deploy different aglorithm

Hi ChrisDing,

If I’m not wrong, this is for sgie mode? For my case, I need to disable object detection completely for some streams while keep it for other streams, which could be related to pgie? I’m not sure whether this is doable in deepstream.

I have another question: with gstreamer, we can do video flip with pipeline options, how to do it with deepstream?


gst_nvinfer_sink_event() is for pgie and sgie both. You can follow it to disable pgie for some streams.

video flip
NvBufSurfTransform (NvBufSurface *src, NvBufSurface *dst,NvBufSurfTransformParams *transform_params)

typedef struct _NvBufSurfaceTransformParams
  /** Holds a flag that indicates which transform parameters are valid. */
  uint32_t transform_flag;
  /** Holds the flip method. */
  NvBufSurfTransform_Flip transform_flip;
  /** Holds a transform filter. */
  NvBufSurfTransform_Inter transform_filter;
  /** Holds a pointer to a list of source rectangle coordinates for
   a crop operation. */
  NvBufSurfTransformRect *src_rect;
  /** Holds a pointer to list of destination rectangle coordinates for
   a crop operation. */
  NvBufSurfTransformRect *dst_rect;

Hi ChrisDing, thanks!

Hi ChrisDing,
I changed the code in gstnvinfer.cpp and do “make” and “sudo install make”. I want to run deepstreep-app, but this changes in “gstnvinfer.cpp” dont take effect in deepstream-app. I even copied [ds-example] part configuration to the respective configuration file for deepstream-app, it is still not useful. What other steps should I do to make changes in the plugin to link with deepstream-app?


Don’t forget
$ rm ~/.cache/gstreamer-1.0/registry.aarch64.bin

Replace this /usr/lib/x86_64(or aarch64)-linux-gnu/gstreamer-1.0/

Hi ChrisDing,
The gstnvinfer plugin works, thanks.

I added code in gst_nvinfer_sink_event(), but the results are not expected.

With multi-camera sources, I tried to disable the object detection and rotate the display video by 180 deg for a specific stream by the code below in gst_nvinfer_sink_event(), but

(1) it will disable the object detection for all streams (I believe there should be another parameter to control the detection for each stream).

(2) it will not rotate the display video in this window.

if ((GstNvEventType) GST_EVENT_TYPE (event) == GST_NVEVENT_PAD_ADDED) {
    /* New source added in the pipeline. Create a source info instance for it. */
    guint source_id;
    gst_nvevent_parse_pad_added (event, &source_id);

    if (source_id == 2) {
      nvinfer->transform_params.transform_flip = NvBufSurfTransform_Rotate180;
      nvinfer->process_full_frame = FALSE;

    nvinfer->source_info->emplace (source_id, GstNvInferSourceInfo ());


Any feedback on implementing these 2 functions? Or these 2 functions cannot work currently?

  1. Currently, there is no patch to support selective source-based inferencing.
  2. Flip / rotate is not supported for dGPU

Hi ChrisDing,
Thanks a lot for the clarifications. I’m using Xavier which should belong to dGPU.