Changing Annotation Appearance in Hailo RPi5 detection example

Hello everyone,

Im working on the detection hailo rpi5 examples : GitHub - hailo-ai/hailo-rpi5-examples

Is there a way to adjust the thickness of the rectangle surrounding detected objects or change the font size of the labels?

thanks for your help

hello,
does somebody knows how to do it please ?

Hey @thomas38 ,

Hailo’s GStreamer-based inference uses hailonet for inference, and post-processing is handled by the hailooverlay element.

Modifying Bounding Box Thickness in Post-Processing

Since hailooverlay does not provide a direct thickness option, you need to modify the C++ post-processing code that generates the overlay.

  1. Locate the function in hailo_common.hpp or hailo_objects.hpp that creates bounding boxes:
cv::rectangle(frame, cv::Point(xmin, ymin), cv::Point(xmax, ymax), color, thickness);
  1. Modify the thickness parameter:
cv::rectangle(frame, cv::Point(xmin, ymin), cv::Point(xmax, ymax), color, 4);
  • Increasing the thickness value makes bounding boxes thicker.
  1. Recompile and test the modified pipeline to ensure the changes take effect.

By modifying the thickness parameter in the C++ post-processing code, you can control the thickness of the bounding boxes generated by hailooverlay. Adjust the value according to your preferences and test the pipeline to achieve the desired visual appearance.

Remember to recompile the post-process before re-running.

If you encounter any issues or need further assistance, please let me know!

hi @omria,
thanks for your answer
I searched on the hailo github and i found that those file are there tappas/core/hailo/general at 7e36ff78bb99c32700efe5dad3820271210c3f58 · hailo-ai/tappas · GitHub

But I dont understand how to apply those changement to my code because those files are not in the file of my code

@thomas38
If you are open to using DeGirum PySDK, I can guide you to show how to do this. We have overlay_line_width and overlay_font_scale parameters in our model info that allow you to control overlay properties.

if the solution of @omria is easy to do i prefer to follow it

Hey @thomas38,

The files are located in our infrastructure repository at GitHub - hailo-ai/hailo-apps-infra. When you install the examples package, this repository is automatically installed in your virtual environment.

To make your changes:

  1. Fork the hailo-apps-infra repository
  2. Clone your forked repository locally
  3. Make your necessary changes
  4. Install the modified version manually in your virtual environment

If you need help with any of these steps or encounter any issues during the process, please don’t hesitate to ask for assistance.

Thanks @omria, but i dont find the files hailo_common.hpp or hailo_objects.hppin GitHub - hailo-ai/hailo-apps-infra. I only find them here : tappas/core/hailo/general at 7e36ff78bb99c32700efe5dad3820271210c3f58 · hailo-ai/tappas · GitHub

hi @omria ,
do you know where i can modify those files, i’m still searching for them

thanks