Draw Bounding Boxes for One Specific Class

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 5.0 (5.0-20.07 docker)
• NVIDIA GPU Driver Version (valid for GPU only) 465
• Issue Type( questions, new requirements, bugs) Question

I’m using deepstream-test3 and only want to display bounding boxes for Vehicle class.

I have tried using function nvds_remove_obj_meta_from_frame to remove obj_meta for objects belong to other classes but not success.

    for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
      l_frame = l_frame->next) {
        NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
        //int offset = 0;
        for (l_obj = frame_meta->obj_meta_list; l_obj != NULL;
                l_obj = l_obj->next) {
            obj_meta = (NvDsObjectMeta *) (l_obj->data);
            if (obj_meta->class_id == PGIE_CLASS_ID_VEHICLE) {
                vehicle_count++;
                num_rects++;
                obj_meta->rect_params.border_color.red = 0.0;
                obj_meta->rect_params.border_color.green = 1.0;
                obj_meta->rect_params.border_color.blue = 0.0;
            }
            else {
                obj_meta->rect_params.border_color.red = 0.0;
                obj_meta->rect_params.border_color.green = 0.0;
                obj_meta->rect_params.border_color.blue = 1.0;

                nvds_remove_obj_meta_from_frame(frame_meta, obj_meta);
            }
        }
          g_print ("Frame Number = %d Number of objects = %d "
            "Vehicle Count = %d Person Count = %d\n",
            frame_meta->frame_num, num_rects, vehicle_count, person_count);
    }

Bounding boxes for people are still showing in output frames but in default red color. May I know why this happened and what is the correct way to remove obj_meta?

deepstream_test3_app.c (17.9 KB)

Here is my modified codes.

I haven’t changed engine configuration and other files.

Can you have a check if there is only Vehical class obj in the meta after your remove function?

Hi kesong,

I have checked and found non-vehical class metadata are still there after I call nvds_remove_obj_meta_from_frame function.

May I know the correct way to remove obj_meta from frame_meta?

Thank you!

Suppose it should work.

Here is api doc.

https://docs.nvidia.com/metropolis/deepstream/sdk-api/index.html

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