How to get bboxes and confidence from metadata inferred by the model in python?

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU)**Jetson
• DeepStream Version5.1
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• 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)
In test1 of python api.
I tried to use my pretrained Yolov5 model on deepstream. When I tried to get some results inferred by the model in deepstream, the results seemed wrong. I just modified the function osd_sink_pad_buffer_probe in test1 and changed the model to yolov5. I tried to get information from NvDsObjectMeta.detector_bbox_info but it said there was no attribute called this. Then I turned to rect_params, but this gave me wrong datas, which were too big. (btw, input video was created with 1024×1024 images)
Also, I’ve tried to add_probe to the pgie’s sink. This gave me even none data. I’m not sure but I guess it’s the video-convertor’s cause. However, where should I get the true results inferred by my model from? Of course, the confidence was also very big with an average of more than 200.
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
Here is my sink_pad_buffer_probe

def pgie_sink_pad_buffer_probe(self,pad,info,u_data):

        gst_buffer = info.get_buffer()
        if not gst_buffer:
            print("Unable to get GstBuffer ")

        # Retrieve batch metadata from the gst_buffer
        # Note that pyds.gst_buffer_get_nvds_batch_meta() expects the
        # C address of gst_buffer as input, which is obtained with hash(gst_buffer)
        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:
                # Note that needs a cast to pyds.NvDsFrameMeta
                # The casting is done by pyds.glist_get_nvds_frame_meta()
                # The casting also keeps ownership of the underlying memory
                # in the C code, so the Python garbage collector will leave
                # it alone.
                frame_meta = pyds.glist_get_nvds_frame_meta(
            except StopIteration:
            num_rects = frame_meta.num_obj_meta
            while l_obj is not None:
                    # Casting to pyds.NvDsObjectMeta
                except StopIteration:
                #obj_counter[obj_meta.class_id] += 1
                except StopIteration:
            except StopIteration:
        return Gst.PadProbeReturn.OK

And I tried to add_probe to pgie,nvosd…

        osdsinkpad = pgie.get_static_pad("sink")
        if not osdsinkpad:
            sys.stderr.write(" Unable to get sink pad of pgie \n")
                    self.pgie_sink_pad_buffer_probe, 0)

So, what should I do to get my bboxes and confidence?

My pyds only get a version of 0.5 but the deepstream is 5.1.
Maybe the fault is here.

Now I can get the real bbox from rect_params but the confidence is always -0.1. How can this be?

Alright, now I know that this was because I had chosen the group rectangles in config file. It works well when I chose not use this.

Good to know issue fixed. Thanks

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