Deepstream App Config File

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) :- dGPU
• DeepStream Version:- 7.0
**
How to properly add SGIE in deepstream app ?**

 {
    "device-configs": {
        "application": {
            "enable-perf-measurement": 1,
            "perf-measurement-interval-sec": 2
        },
        "tiled-display": {
            "enable": 0,
            "rows": 2,
            "columns": 2,
            "width": 1920,
            "height": 1080,
            "gpu-id": 0,
            "nvbuf-memory-type": 0
        },
        "source": {
            "csv-file-path": "sources.csv"
        },
        "sink0": {
            "enable": 1,
            "type": 1,
            "sync": 0,
            "source-id": 0,
            "gpu-id": 0,
            "nvbuf-memory-type": 0
        },
        "sink1": {
            "enable": 0,
            "type": 3,
            "container": 1,
            "codec": 1,
            "enc-type": 0,
            "sync": 0,
            "bitrate": 2000000,
            "profile": 0,
            "output-file": "out.mp4",
            "source-id": 0
        },
        "sink2": {
            "enable": 0,
            "type": "None",
            "codec": 1,
            "enc-type": 0,
            "sync": 0,
            "bitrate": 4000000,
            "profile": 0,
            "rtsp-port": 8554,
            "udp-port": 5400
        },
        "osd": {
            "enable": 1,
            "gpu-id": 0,
            "border-width": 1,
            "text-size": 15,
            "text-color": "1;1;1;1",
            "text-bg-color": "0.3;0.3;0.3;1",
            "font": "Serif",
            "show-clock": 0,
            "clock-x-offset": 800,
            "clock-y-offset": 820,
            "clock-text-size": 12,
            "clock-color": "1;0;0;0",
            "nvbuf-memory-type": 0
        },
        "streammux": {
            "gpu-id": 0,
            "live-source": 1,
            "buffer-pool-size": 4,
            "batch-size": 1,
            "batched-push-timeout": 40000,
            "width": 1920,
            "height": 1080,
            "enable-padding": 0,
            "nvbuf-memory-type": 0
        },
        "primary-gie1": {
            "enable": 1,
            "gpu-id": 0,
            "batch-size": 2,
            "model-engine-file": "dummy-name.engine",
            "bbox-border-color0": "1;0;0;1",
            "bbox-border-color1": "0;1;1;1",
            "bbox-border-color2": "0;0;1;1",
            "bbox-border-color3": "0;1;0;1",
            "interval": 0,
            "gie-unique-id": 1,
            "nvbuf-memory-type": 0,
            "config-file": "/app/models/model1/config.yml"
        },
        "secondary-gie1": {
            "enable": 1,
            "gpu-id": 0,
            "batch-size": 2,
            "model-engine-file": "dummy-name.engine",
            "bbox-border-color0": "1;0;0;1",
            "bbox-border-color1": "0;1;1;1",
            "bbox-border-color2": "0;0;1;1",
            "bbox-border-color3": "0;1;0;1",
            "interval": 0,
            "gie-unique-id": 2,
            "nvbuf-memory-type": 0,
            "config-file": "/app/models/model2/config.yml"
        },
        "secondary-gie2": {
            "enable": 1,
            "gpu-id": 0,
            "batch-size": 2,
            "model-engine-file": "dummy-name.engine",
            "bbox-border-color0": "1;0;0;1",
            "bbox-border-color1": "0;1;1;1",
            "bbox-border-color2": "0;0;1;1",
            "bbox-border-color3": "0;1;0;1",
            "interval": 0,
            "gie-unique-id": 69,
            "nvbuf-memory-type": 0,
            "config-file": "/app/models/model3/config.yml"
        },
        "tracker": {
            "enable": 1,
            "tracker-width": 960,
            "tracker-height": 544,
            "ll-lib-file": "/opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so",
            "ll-config-file": "/app/configs/NvDCF_accuracy.yml",
            "gpu-id": 0,
            "display-tracking-id": 1
        },
        "tests": {
            "file-loop": 0
        },
        "sources-csvpriority": "high"
    }
}

Originally, secondary-gie1 was primary-gie2 and secondary-gie2 was primary-gie3, lets call this setting as all-primary-mode
in the config file pasted above, I have renamed primary-gie2 as secondary-gie1 and primary-gie3 as secondary-gie2 (lets call it mode-2)

In mode 1, all models are added in primary_gie_bin. What I am expecting is when I move to mode-2,
there should be primary gie bin containing one model, and secondary gie bin containing two models.

but what is happening is, primary gie contains one model as expected but the secondary gie does not contain any model. I am trying to understand why.

Below is my config file.

property:
  gpu-id: 0
  net-scale-factor: 0.0039215697906911373
  model-color-format: 0
  onnx-file:model.onnx
  # int8-calib-file: calib.table
  labelfile-path: labels.txt
  batch-size: 2
  network-mode: 0
  model-engine-file: some-name.engine
  num-detected-classes: 7
  interval: 0
  gie-unique-id: 2
  process-mode: 2
  operate-on-gie-id: 1 
  network-type: 0
  cluster-mode: 2
  maintain-aspect-ratio: 1
  symmetric-padding: 1
  # workspace-size: 2000
  parse-bbox-func-name: NvDsInferParse
  # parse-bbox-func-name: NvDsInferParse
  custom-lib-path: shared_lib.so
  engine-create-func-name: NvDsInferEngineGet

class-attrs-all:
  nms-iou-threshold: 0.45
  pre-cluster-threshold: 0.08
  topk: 300

Please note :- Please ignore model path related things in the config file.

I’m confused by your description.

1.Currently, deepstream-app only supports configuration files in key-file/yaml format. Have you rewritten deepstream-app to support json?

  1. This should also be impossible, deepstream-app only supports one pgie, because the name of the bin is fixed in the create_primary_gie_bin function bin->bin = gst_bin_new ("primary_gie_bin").

3.When creating multiple sgies, you need to change the configuration file items of multiple sgies into config_array

gboolean
create_secondary_gie_bin (guint num_secondary_gie, guint primary_gie_unique_id,
    NvDsGieConfig * config_array, NvDsSecondaryGieBin * bin)

Could you explain how you rewrote your deepstream-app using this config file?

files.zip (26.9 KB)

yes here is the pipeline implementation.

Are you rewriting deepstream-app? Please follow the guidance above to build the correct parameters of API. And build the correct pipeline. We cannot fix bugs in these code snippets.

I think it is deepstream test 5 sample app

I am sorry I gave you the wrong file.

application:
  enable-perf-measurement: 1
  perf-measurement-interval-sec: 2
tiled-display:
  enable: 0
  rows: 2
  columns: 2
  width: 1920
  height: 1080
  gpu-id: 0
  nvbuf-memory-type: 0
source:
  csv-file-path: sources.csv
sink0:
  enable: 1
  type: 1
  sync: 0
  source-id: 0
  gpu-id: 0
  nvbuf-memory-type: 0
sink1:
  enable: 0
  type: 3
  container: 1
  codec: 1
  enc-type: 0
  sync: 0
  bitrate: 2000000
  profile: 0
  output-file: out.mp4
  source-id: 0
sink2:
  enable: 0
  type: None
  codec: 1
  enc-type: 0
  sync: 0
  bitrate: 4000000
  profile: 0
  rtsp-port: 8554
  udp-port: 5400
osd:
  enable: 1
  gpu-id: 0
  border-width: 1
  text-size: 15
  text-color: 1;1;1;1
  text-bg-color: 0.3;0.3;0.3;1
  font: Serif
  show-clock: 0
  clock-x-offset: 800
  clock-y-offset: 820
  clock-text-size: 12
  clock-color: 1;0;0;0
  nvbuf-memory-type: 0
streammux:
  gpu-id: 0
  live-source: 1
  buffer-pool-size: 4
  batch-size: 1
  batched-push-timeout: 40000
  width: 1920
  height: 1080
  enable-padding: 0
  nvbuf-memory-type: 0
primary-gie1:
  enable: 1
  gpu-id: 0
  batch-size: 2
  model-engine-file: model1.engine
  bbox-border-color0: 1;0;0;1
  bbox-border-color1: 0;1;1;1
  bbox-border-color2: 0;0;1;1
  bbox-border-color3: 0;1;0;1
  interval: 0
  gie-unique-id: 1
  nvbuf-memory-type: 0
  config-file: config1.yml
primary-gie2:
  enable: 1
  gpu-id: 0
  batch-size: 2
  model-engine-file: model2.engine
  bbox-border-color0: 1;0;0;1
  bbox-border-color1: 0;1;1;1
  bbox-border-color2: 0;0;1;1
  bbox-border-color3: 0;1;0;1
  interval: 0
  gie-unique-id: 2
  nvbuf-memory-type: 0
  config-file: config.yml
primary-gie3:
  enable: 1
  gpu-id: 0
  batch-size: 2
  model-engine-file: model3.engine
  bbox-border-color0: 1;0;0;1
  bbox-border-color1: 0;1;1;1
  bbox-border-color2: 0;0;1;1
  bbox-border-color3: 0;1;0;1
  interval: 0
  gie-unique-id: 69
  nvbuf-memory-type: 0
  config-file: /app/models/yolov8s-3/config.yml
tracker:
  enable: 1
  tracker-width: 960
  tracker-height: 544
  ll-lib-file: /opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so
  ll-config-file: /app/configs/NvDCF_accuracy.yml
  gpu-id: 0
  display-tracking-id: 1
tests:
  file-loop: 0
sources-csvpriority: high

if I just change primary-gie2 to secondary-gie1 (and process mode of that model) , will it behave like secondary gie ?

It all depends on your code

  1. deepstream-test5 depends on deepstream_app_config_parser.c. This parser only supports one primary-gie and does not support parsing like primary-giex. pgie is usually used as a detector

2.Multiple sgies need to be created using create_secondary_gie_bin and will be treated as one bin. sgie is usually used as a classifier.

Both deepstream-app and deepstream-test5 share these codes