How can modify the people lable text color size and box color

In deepsteam-test,how can modify the people lable text color size and box color


• Hardware Platform (Jetson / GPU) jetson
• DeepStream Version6.1
• JetPack Version (valid for Jetson only) 5.1

HI, i know the color part but don’t know the label size and other properties.
you can use this code for color.

#place this code above the osd_sink_pad_probe function 
color_list = {"PERSON":  (0, 0, 1),
              "BICYCLE:0": (0.6, 0.2, 1),
              "ROADSIGN":  (1, 0, 0),

def osd_sink_pad_buffer_probe(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.NvDsFrameMeta.cast()
            # 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.NvDsFrameMeta.cast(
        except StopIteration:

        #Intiallizing object counter with 0.
        obj_counter = {
        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

            #---------the below code is for setting different color to each class------------------ ========       
            color = color_list[obj_meta.obj_label.split("\\")[0]]
            rect_params = obj_meta.rect_params
            rect_params.border_color.set(*color, 1)
            except StopIteration:

        # Acquiring a display meta object. The memory ownership remains in
        # the C code so downstream plugins can still access it. Otherwise
        # the garbage collector will claim it when this probe function exits.
        display_meta.num_labels = 1
        py_nvosd_text_params = display_meta.text_params[0]
        # Setting display text to be shown on screen
        # Note that the pyds module allocates a buffer for the string, and the
        # memory will not be claimed by the garbage collector.
        # Reading the display_text field here will return the C address of the
        # allocated string. Use pyds.get_string() to get the string content.
        py_nvosd_text_params.display_text = "Frame Number={} Number of Objects={} Vehicle_count={} Person_count={}".format(frame_number, num_rects, obj_counter[PGIE_CLASS_ID_VEHICLE], obj_counter[PGIE_CLASS_ID_PERSON])

        # Now set the offsets where the string should appear
        py_nvosd_text_params.x_offset = 10
        py_nvosd_text_params.y_offset = 12

        # Font , font-color and font-size
        py_nvosd_text_params.font_params.font_name = "Serif"
        py_nvosd_text_params.font_params.font_size = 10
        # set(red, green, blue, alpha); set to White
        py_nvosd_text_params.font_params.font_color.set(1.0, 1.0, 1.0, 1.0)

        # Text background color
        py_nvosd_text_params.set_bg_clr = 1
        # set(red, green, blue, alpha); set to Black
        py_nvosd_text_params.text_bg_clr.set(0.0, 0.0, 0.0, 1.0)
        # Using pyds.get_string() to get display_text as string
        pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta)
        except StopIteration:
    return Gst.PadProbeReturn.OK	

thanke you , I try

use the mothed only get the box inf (top, left, and so on),but can not get the label text inf , how can i do, please

You can try to get the NvDsObjectMeta and set the paras to the text_params.

use NvDsObjectMetacan get the label text and box info , then I use test3 add nvtracker and yolo4 model, yolo4 is used .so mothed to add. use NvDsObjectMeta can not get the number in label , how can I do ,please


You can refer to NvDsPastFrameObjList structure. You can open a new topic if you got new problems.