How to save bbox info to json file

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) RTX3090
• DeepStream Version 6.2
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only) 520
• Issue Type( questions, new requirements, bugs) questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

As title, how to save bbox info to json file or other log file?

I use this command : sudo deepstream-app -c deepstream_app_source1_facedetectir.txt

config file is under this path:


The bbox infor cannot be collected from deepstream-app, but you can get it from other samples.
The object detector bbox info is stored in detector_bbox_info of NvDsObjectMeta. You can refer to the function osd_sink_pad_buffer_probe
in deepstream-test1.c on how to get the pointer of NvDsObjectMeta (obj_meta), then you can store this info in the format you needed.

If you want got bbox , just modify function all_bbox_generated in deepstream_app_main.c.
member detector_bbox_info in struct NvDsObjectMeta is which you want.

If you want more osd-plugin information. you can refer deepstream_osd_bin.c at sources/apps/apps-common/src/deepstream_osd_bin.c

Hi yingliu,

command : deepstream-test1-app /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_1080p_h264.mp4

I ran the command above, but I got the error below.

error message:

Added elements to bin
Using file: /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_1080p_h264.mp4
ERROR from element stream-muxer: Output width not set
Error details: gstnvstreammux.c(2910): gst_nvstreammux_change_state (): /GstPipeline:dstest1-pipeline/GstNvStreamMux:stream-muxer
Returned, stopping playback
Deleting pipeline


Hi junshengy,

I add g_print/printf in function all_bbox_generated in deepstream_app_main.c, but can’t print anything out.
Then I add g_print/printf in main (int argc, char *argv[]) in deepstream_app_main.c has the some result.
It seems I can’t enter those functions above.

Do you have bbox ? Add this patch in all_bbox_generated

+        printf("left %.2f top %.2f with %.2f height %.2f\n",
+              obj->detector_bbox_info.org_bbox_coords.left,
+              obj->,
+              obj->detector_bbox_info.org_bbox_coords.width,
+              obj->detector_bbox_info.org_bbox_coords.height);

and use the command line

./deepstream-app -c /opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt

I can got log such as

left 788.81 top 471.77 with 59.30 height 57.76
left 591.27 top 483.48 with 40.99 height 33.03
left 435.56 top 480.54 with 29.01 height 65.35
left 414.36 top 481.69 with 24.90 height 62.10
left 454.72 top 473.69 with 21.18 height 68.04
1 Like

Hi junshengy,

I add your code in all_bbox_generated, then I can got the bbox info.
Maybe I added some wrong code in the function.
Thank you so much!!!

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