Hello,
I am encountering a persistent issue when trying to run the official Python object detection example with a live camera feed on my Raspberry Pi 5.
The script fails with an UnboundLocalError
which, after extensive troubleshooting, appears to be a symptom of the camera failing to initialize within the application’s environment. The core problem seems to be a conflict between the Hailo software stack and the camera system when used together in Python.
Here are my system details and the diagnostic steps I’ve taken:
System Details:
- Hardware: Raspberry Pi 5, Official Hailo-8L M.2 AI Acceleration Kit
- Operating System: Debian GNU/Linux 12 (bookworm) (
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
) - Kernel Version:
Linux raspberrypi 6.12.34+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.34-1+rpt1~bookworm (2025-06-26) aarch64 GNU/Linux
- Hailo Software (Installed from official downloads):
hailort-pcie-driver_4.21.0_all.deb
hailort_4.21.0_arm64.deb
hailort-4.21.0-cp311-cp311-linux_aarch64.whl
Diagnostics Performed:
- Hardware is detected by the OS:
lspci | grep Hailo
correctly shows the “Hailo-8 AI Processor”. - C++ Tools work perfectly:
hailortcli benchmark yolov11s.hef
runs successfully and reports ~45 FPS. This confirms the hardware, PCIe driver, and core runtime are functional. - Camera works perfectly in isolation: A minimal, standalone
picamera2
Python script successfully captures images and video. - Display Server is Correct: The system has been configured to use X11 instead of Wayland via
raspi-config
. - User Permissions are Correct: The user is a member of the
video
group. - Clean Reinstallation: All Hailo packages (
hailort
,hailort-pcie-driver
) were completely purged and reinstalled from the official.deb
files, followed by a reboot.
Conclusion: Despite each component working correctly on its own, the official object_detection.py
example from the Hailo-Application-Code-Examples
repository fails to initialize the camera. This points to a specific incompatibility or resource conflict between the Hailo Python environment (perhaps its GStreamer backend) and the Raspberry Pi’s libcamera
/picamera2
stack.
Could you please advise if there is a known issue with this kernel version, or if any special configuration is needed to make the Hailo application pipeline work with the Raspberry Pi camera?
Thank you for your time and assistance.
Best regards, Jiwoo