How to get meta when classifier is pgie

• Jetson AGX Xavier
• Deepstream 6.0
• JetPack 4.6
• TensorRT 8.0.1
• NVIDIA GPU Driver 32.6.1

Hi, i’m trying to a simple classification pipeline, I need to get labels what my model predicted. In osd_sink_pad_buffer_probe() function i’m trying to get obj_meta_list as written there: Primary classifier class_id=-1 and result_prob=0.58 for all frames and there: Access output of Primary Classifier and get NvDsClassifierMeta. But frame_meta.obj_meta_list return None.

Here is my config:

[property]
process-mode=1 # Process full frames
gpu-id=0
net-scale-factor=1
model-engine-file=classifier.onnx_b1_gpu0_fp32.engine
onnx-file=classifier.onnx
model-color-format=0
network-type=1 # Classifier
network-mode=2 # FP16
#num-detected-classes=2
interval=1
gie-unique-id=1
output-blob-names=predictions/Softmax
classifier-threshold=0.5

And here is code

def osd_sink_pad_buffer_probe(pad,info,u_data):
  gst_buffer = info.get_buffer()
      if not gst_buffer:
          print("Unable to get GstBuffer ")
          return
      batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
      l_frame = batch_meta.frame_meta_list
      
      while l_frame is not None:
          try:
              frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
          except StopIteration:
              break
          
          frame_number = frame_meta.frame_num
          l_obj=frame_meta.obj_meta_list
          print(l_obj) --> It prints None

So how can I get labels that classifier returned?

Which model did you use, our demo model or your own model?
You can refer the link below first to get the object:
https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/tree/master/apps/deepstream-test2

I use own resnet50

Well, I used it as a refer. I did the same, but l_obj is None. Why?

It may be your model’s problem. You can verify it by yourself.
1.You can attach your whole code or attach your pipeline graph.
https://forums.developer.nvidia.com/t/deepstream-sdk-faq/80236/10
2.You can modify some code to get the l_obj from our demo code that I attached to see if you can get the value from it.

inference_classifier.py (9.8 KB)

Here is the code. I deleted some buisnes logic. It doesn’t tuch any MetaData.

Well, I can try your network in my code. It willn’t generate any normal results, but it can create object meta.

I used resnet10 with config from deepstream-test3. And l_obj is None

I’ve lounched deepstream-test2 and l_obj is not None. But there is a detector. So culd you tell me, is the problem in my pipeline or in way how i’m trying to get l_obj? I can’t understand

I’ve modified code and made sgie1 a primary detector (process-mode=1), and I didn’t get any objects. frame_meta.obj_meta_list returned None

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

You should make sure that your model works well. You can refer the demo below to get the metadata:
https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/blob/master/apps/deepstream-imagedata-multistream/deepstream_imagedata-multistream.py
You can try to use your model instead of our demo model to see if it works well.

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