marcoslucianops / DeepStream-Yolo

NVIDIA DeepStream SDK 7.0 / 6.4 / 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 / 5.1 implementation for YOLO models
MIT License
1.39k stars 344 forks source link

post process for bounding box coordinates in deepstream_app_config.txt #446

Open k-khosravi opened 10 months ago

k-khosravi commented 10 months ago

Hello! how can i use the bounding boxes for real-time post processing in Deepstream pipeline? Actually, I want to use the bounding box coordinates to calculate the distance of the object to camera in real-time and I don't know in which header with which attribute i can do that because when running the Deepstream with config files i have only headers and their attribute.

emad555 commented 10 months ago

Step 1: You can print that by adding the following lines to all_bbox_generated function in deepstream_app_main.c:

        float left = (float)obj->rect_params.left;
        float top = (float)obj->rect_params.top;
        float width = (float)obj->rect_params.width;
        float height = (float)obj->rect_params.height;

        g_print("Object ID: %d\n", obj->object_id);
        g_print("Class ID: %d\n", obj->class_id);
        g_print("Bounding Box (Left, Top, Width, Height): %.2f, %.2f, %.2f, %.2f\n", left, top, width, height);

Step 2: Compile the folder using: sudo CUDA_VER=10.2 make -C deepstream-app

Step 3: Copy the generated file deepstream-app to the bin folder inside.

marcoslucianops commented 10 months ago

https://github.com/marcoslucianops/DeepStream-Yolo#extract-metadata

emad555 commented 10 months ago

https://github.com/marcoslucianops/DeepStream-Yolo#extract-metadata

This would be the right way to do it. Adding a probe or playing around with NvDsObjectMeta element. My code above is a simple example to print out the metadata on the terminal, but it could be implemented in a different way.

emad555 commented 10 months ago

Step 1: You can print that by adding the following lines to all_bbox_generated function in deepstream_app_main.c:

        float left = (float)obj->rect_params.left;
        float top = (float)obj->rect_params.top;
        float width = (float)obj->rect_params.width;
        float height = (float)obj->rect_params.height;

        g_print("Object ID: %d\n", obj->object_id);
        g_print("Class ID: %d\n", obj->class_id);
        g_print("Bounding Box (Left, Top, Width, Height): %.2f, %.2f, %.2f, %.2f\n", left, top, width, height);

Step 2: Compile the folder using: sudo CUDA_VER=10.2 make -C deepstream-app

Step 3: Copy the generated file deepstream-app to the bin folder inside.

@k-khosravi if this resolved the issue, please close it over there.

Strinkin commented 3 months ago

in the folder: DeepStream-Yolo/ nvdsinfer_custom_impl_Yolo/ nvdsparsebbox_Yolo.cpp