I’m currently developing a PPE detection application using DeepStream 6.3 on Jetson Orion, and I’m facing an issue when trying to differentiate between detections of “person” and “goggles” from two different models. Both models assign class_id == 0 to their primary objects.
Pipeline Overview:
PGIE (Primary Inference - Person Detection)
Custom YOLO model
Detects only person
class_id == 0, gie-unique-id = 1
SGIE (Secondary Inference - Goggles Detection)
Custom YOLO model trained on internal dataset
Detects goggles, shoes, etc.
Goggles also assigned class_id == 0, gie-unique-id = 2
The Issue:
Initially, I used the following logic in my probe to identify both person and goggles:
in pgie1_probe
if obj_meta.class_id == 0:
person = True
in sgie1_probe
if obj_meta.class_id == 0:
goggles = True # <-- Conflict happens here
As expected, this caused incorrect results — when a person was detected, it also showed goggles as detected, even if the person wasn’t wearing any.
Attempted Fix:
To resolve the conflict, I tried using unique_component_id (which should match the gie-unique-id from the config):
My gie-unique-id for Human model is 1 and goggles model is 2
# For person detection in pgie1_probe
if obj_meta.class_id == 0:
person = True
# For goggles detection in sgie1_probe
if obj_meta.class_id == 0 and obj_meta.unique_component_id == 2:
goggles = True
Now the goggles detection always returns false, even though I can visually see the bounding boxes for goggles on the output screen
My Questions:
Is using obj_meta.unique_component_id the correct way to differentiate between detections from different inference engines (PGIE vs SGIE), especially when they share the same class_id?
Is there a better way to handle this situation where two different models use the same class_id?
Any insights or suggestions would be greatly appreciated.
But nothing gets printed — it’s as if unique_component_id isn’t being set in the object metadata.
From what I’ve researched, it seems this might happen if the object metadata isn’t being attached correctly, or if the inference component isn’t populating unique_component_id. That said, the model itself is working fine and detecting objects as expected.
Can you suggest what steps I can take to debug this? Specifically:
How can I confirm that the metadata is being added correctly?
Is there a specific configuration required to enable unique_component_id propagation from a secondary model?
Any tips on verifying whether the inference component is actually setting this field?
I already tried cross checking the class id of goggles which is 0 and goggles model config file where gie_unique_id is 2 (which should be equal to the unique_component_id).
The object meta is attached by nvinfer plugin, the plugin (/opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-nvinfer) and its library(/opt/nvidia/deepstream/deepstream/sources/libs/nvdsinfer) are all open source, you can debug it directly.
Based on my research, it looks like there are other metadata components available, such as parent, which can help with differentiating objects when using multiple models.
In my case, the goggles detection model is operating on the human detection model as a secondary classifier. Here’s how it’s defined in the goggles model config:
operate-on-class-id=0
operate-on-gie-id=1
From what I understand is :
can I use something like this to differentiate goggles detections?
if obj_meta.parent == 1 and obj_meta.class_id == 0:
# This should correspond to goggles on a human
Would checking obj_meta.parent in this way be a reliable approach to distinguish between detections from different models when unique_component_id is not available or not working as expected?
You’re correct — I have two models in my application.
The first model is a Primary GIE (PGIE), which performs detection on the full frame and identifies humans.
The second model is a Secondary GIE (SGIE), which runs on the bounding boxes output by the PGIE. This SGIE detects goggles and shoes specifically on the detected humans.
So, the SGIE depends on the results from the PGIE — it operates only on objects detected as humans.