Getting metadata from secondary clasifier nvinfer

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) t4
• DeepStream Version 7.0
• JetPack Version (valid for Jetson only)
• TensorRT Version deepstream 7.0 installation guide
• NVIDIA GPU Driver Version (valid for GPU only) 535
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Hi
I want to get obj_lable and class_id of my secondary nvinfer which is classier but i can only get object detection metadata using add probe in nvdsosd refer to deepstream-test2
i even check unique-component-id but is always 1 which is my primary nvinfer !
For the sake of clarity when i change my secondary ncinfer to object detection i can olso see its meta data and unique-component-id which is 2.

Even When i want to get classifier meta list i get this error:
Pyds.Glist object has no attribute unique_component_id

The following patch uses test2 as an example to obtain the label output by nvinfer unique_component_id==3

diff --git a/apps/deepstream-test2/deepstream_test_2.py b/apps/deepstream-test2/deepstream_test_2.py
index f787a7f5..05639a39 100755
--- a/apps/deepstream-test2/deepstream_test_2.py
+++ b/apps/deepstream-test2/deepstream_test_2.py
@@ -74,6 +74,30 @@ def osd_sink_pad_buffer_probe(pad,info,u_data):
             try:
                 # Casting l_obj.data to pyds.NvDsObjectMeta
                 obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
+                l_classifier = obj_meta.classifier_meta_list
+                while l_classifier is not None:
+                    try:
+                        classifier_meta = pyds.NvDsClassifierMeta.cast(l_classifier.data)
+                        # Casting l_classifier.data to pyds.NvDsClassifierMeta
+                        if classifier_meta.unique_component_id == 3:
+                            # Print the classifier label
+                            l_label = classifier_meta.label_info_list
+                            while l_label is not None:
+                                try:
+                                    label_info = pyds.NvDsLabelInfo.cast(l_label.data)
+                                    print("label:---> ", label_info.result_label)
+                                except StopIteration:
+                                    break
+                                try:
+                                    l_label = l_label.next
+                                except StopIteration:
+                                    break
+                    except StopIteration:
+                        break
+                    try:
+                        l_classifier = l_classifier.next
+                    except StopIteration:
+                        break
             except StopIteration:
                 break
             obj_counter[obj_meta.class_id] += 1
@@ -244,7 +268,8 @@ def main(args):
             sink = Gst.ElementFactory.make("nv3dsink", "nv3d-sink")
         else:
             print("Creating EGLSink \n")
-            sink = Gst.ElementFactory.make("nveglglessink", "nvvideo-renderer")
+            # sink = Gst.ElementFactory.make("nveglglessink", "nvvideo-renderer")
+            sink = Gst.ElementFactory.make("fakesink", "nvvideo-renderer")
         if not sink:
             sys.stderr.write(" Unable to create egl sink \n")

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.