Modifiyng object meta using python bindings

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
Jetson TX2
• DeepStream Version
5.0-20.07
• JetPack Version (valid for Jetson only)
4.4 [L4T 32.4.3]
• TensorRT Version
7.1.3.0

I want to enlarge the output bounding boxes of my primary detector, before feeding them into the secondary classifier, using the deepstream python bindings.

I think it can be achieved following up on the deepstream ssd parser example:

Basically, I want to do something like:

obj_meta.rect_params.left = obj_meta.rect_params.left -10 
obj_meta.rect_params.width = obj_meta.rect_params.width + 10

I have tried different things with no success, could you give me some clues?

Sorry, after some tries I think I found the answer myself.

l_frame = batch_meta.frame_meta_list
    while l_frame is not None:
        try:
            # Note that l_frame.data 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(l_frame.data)
            frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
        except StopIteration:
            break
        l_obj = frame_meta.obj_meta_list
        new_objs = []
        while l_obj is not None:
            try:
                # Casting l_obj.data to pyds.NvDsObjectMeta
                org_obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
                # insert a single object.
                new_obj_meta = pyds.nvds_acquire_obj_meta_from_pool(batch_meta)
                # Set bbox properties. These are in input resolution.
                rect_params = org_obj_meta.rect_params
                # enlarge original box
                delta_width = org_obj_meta.rect_params.width * width_ratio
                new_left = max(0, (org_obj_meta.rect_params.left - delta_width // 2))
                new_width = org_obj_meta.rect_params.width + delta_width
                delta_height = org_obj_meta.rect_params.height * height_ratio
                new_top = max(0, (org_obj_meta.rect_params.top - delta_height // 2))
                new_height = org_obj_meta.rect_params.width + delta_height
                rect_params.left = new_left
                rect_params.top = new_top
                rect_params.width = new_width
                rect_params.height = new_height
                new_obj_meta.class_id = org_obj_meta.class_id
                new_obj_meta.confidence = org_obj_meta.confidence
                new_objs.append(new_obj_meta)
            except StopIteration:
                break
            try:
                l_obj = l_obj.next
            except StopIteration:
                break
        for new_obj_meta in new_objs:
            pyds.nvds_add_obj_meta_to_frame(frame_meta, new_obj_meta, None)
            print("added new_obj_meta")
        try:
            l_frame = l_frame.next
        except StopIteration:
            break

The important part is to write the new object outside of the reading loop.