Integrating Existing OpenCV System with Hailo NPU on Raspberry Pi 5

Hello Hailo community,

Our team has developed a vision system using OpenCV and YOLOv5 for detection and tracking. We’re now exploring how to migrate this system to utilize the Hailo NPU acceleration on Raspberry Pi 5, and we’re looking for guidance on the best approach.

Current system:

  • Using YOLOv5 models for object detection (particularly interested in barcode detection)
  • OpenCV for image processing and visualization
  • Custom tracking algorithms for persistent object identification
  • Python-based application running on standard CPU

What we’ve tried:

  • We’ve installed the Hailo SDK on our Raspberry Pi 5
  • Run some basic examples from the hailo-rpi5-examples repository
  • Looked at the GStreamer-based pipeline architecture

Specific challenges:

  1. Understanding how to replace our YOLOv5 inference with Hailo-accelerated inference while maintaining our custom post-processing
  2. Accessing raw frame data with OpenCV in the Hailo callback system
  3. Determining the origin and usage of callback parameters (e.g., app_callback(pad, info, user_data))
  4. Finding the best way to integrate our existing OpenCV-based tracking and visualization code

Questions:

  1. Is there documentation or examples specifically for migrating YOLOv5-based systems to Hailo?
  2. What’s the recommended approach for integrating custom OpenCV processing in the Hailo callback function?
  3. Are there specific optimizations we should consider when moving from a pure CPU implementation to Hailo-accelerated inference?
  4. How can we preserve our custom tracking logic while benefiting from Hailo’s acceleration?
  5. What’s the learning path you’d recommend for someone familiar with OpenCV/YOLOv5 but new to Hailo?

Any guidance, examples, or recommended resources would be greatly appreciated. We’re particularly interested in a step-by-step integration path rather than completely rewriting our application.

Thank you!

Hi @SHENG-HSUN_CHEN
AT DeGirum we developed PySDK, a python package to simplify development with Hailo easier. For your particular use case, we believe it is a good fit because you just need to replace a couple of lines in your existing code with code that performs inference on Hailo. You can see some examples at: DeGirum/hailo_examples: DeGirum PySDK with Hailo AI Accelerators. We can provide more customized help if you share the code snippet where yolov5s inference happens.