Increase MAX_ELEMENTS_IN_DISPLAY_META for pyds

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 6.2
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only) 525
• Issue Type( questions, new requirements, bugs) questions
I’m trying to run dense object detections with lots of bounding boxes and visualize them with python deepstream. My approach is doing output parsing in python, compute boxes, each of which is a type of x and y, and then run pyds.nvds_add_obj_meta_to_frame(object_meta). However, it seems that each object_meta has max 16 MAX_ELEMENTS_IN_DISPLAY_META while I need more than 16 boxes in a frame. Is it possible to increase this number to 17+?
Maybe change #define MAX_ELEMENTS_IN_DISPLAY_META 16 to #define MAX_ELEMENTS_IN_DISPLAY_META 200 inside deepstream source code?

Another scenario is to visualize 17 keypoints for pose estimation with pyds.NvDsDisplayMeta’s num_circles, which only allows 16 keypoints at maximum. In this case, I also need to increase this limit.

what is the whole media pipeline?

  1. nvds_add_obj_meta_to_frame is used to add object meta to frame, the number of object meta is unlimited, please refer to nvdsmeta.h
    MAX_ELEMENTS_IN_DISPLAY_META is a limitation number of display meta, nvds_add_display_meta_to_frame is used to add display meta.
  2. do you mean you want to draw every object’s 17 keypoints? currently in NvDsDisplayMeta, the max of num_circles should be MAX_ELEMENTS_IN_DISPLAY_META=16.
1 Like

Hi @fanzh, this is my current pipeline for the keypoints:

for kid in range(num_kpts):
    r, g, b = pose_kpt_color[kid]
    x_coord, y_coord = kpts[steps * kid], kpts[steps * kid + 1]
    if not (x_coord % 640 == 0 or y_coord % 640 == 0):
        if steps == 3:
            conf = kpts[steps * kid + 2]
            if conf < 0.5:
                continue

    display_meta_kpts = pyds.nvds_acquire_display_meta_from_pool(
        batch_meta
    )
    display_meta_kpts.num_circles = 1
    circle_params = display_meta_kpts.circle_params[0]
    circle_params.xc = int(x_coord)
    circle_params.yc = int(y_coord)
    circle_params.radius = 2
    circle_params.circle_color.set(1, 0, 0, 1)
    circle_params.has_bg_color = 1
    circle_params.bg_color.set(1, 0, 0, 1)
    pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta_kpts)

as you can see because a display_meta has a limit of 16 circles (keypoints), so I have to assign each keypoint to a different display_meta. However, if the limit is 17, I could assign 17 keypoints to display_meta_kpts.circle_params directly, which is easier to understand.

MAX_ELEMENTS_IN_DISPLAY_META is defined in head file, the SDK need to be rebuilt if this value is modified. maybe MAX_ELEMENTS_IN_DISPLAY_META=17 still need to be changed, the right way is add more displaymeta, which is unlimited.

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