Open-source AI security camera on Pi 5 + Hailo-8 — two YOLO models on one device, with ANPR

Hi,

I wanted to share an open-source project I’ve been building: a complete edge AI security camera running entirely on a Raspberry Pi 5 + Hailo-8, no cloud. It does real-time object detection plus dual-camera ANPR (number plate recognition), with a live web dashboard and phone alerts. MIT licensed.

Repo: https://github.com/mi0iou/ai-security-camera

Two models on one Hailo-8

The system runs two detectors concurrently on a single Hailo-8:

  • a YOLOv8s object detector (80-class COCO) for the main detection loop, and

  • a dedicated single-class YOLOv8n license-plate detector for the ANPR stage.

Both are loaded against one scheduler-enabled VDevice (HailoSchedulingAlgorithm.ROUND_ROBIN). In shared mode the inference wrapper skips its own VDevice creation and skips manual network_group.activate() — the scheduler arbitrates activation. The object detector holds 40+ FPS (~40ms inference) with the plate detector firing intermittently from another thread, with no measurable contention. There’s a standalone bench (test_shared_vdevice.py) that measures YOLOv8s throughput in baseline → contended → recovery phases so you can see the scheduler’s impact directly.

A couple of gotchas other Hailo devs might find useful

  • The Hailo NMS postprocessor outputs boxes as [y1, x1, y2, x2], not the standard [x1, y1, x2, y2]. That one cost me some head-scratching on misaligned boxes — handled in hailo_detector.py.

  • HEFs are architecture-specific. An 8L-compiled HEF runs on a Hailo-8 in backward-compat mode but gives you no performance benefit, so it’s worth compiling natively for your target.

The wider system

  • Dual camera: IMX296 Global Shutter (6mm, ~55° FOV) for detection, IMX477 HQ (16mm, ~22° FOV) for plate capture. Vehicle bounding boxes are mapped from the detection camera to the ANPR camera using a pixels-per-degree angular FOV ratio.

  • ANPR pipeline: vehicle spotted → bbox mapped to ANPR camera → NPU plate detector localises a tight crop → crop downscaled so the plate is ≤96px tall → EasyOCR reads it (~1.7s live) → validated against UK/NI/US/EU patterns → logged + alerted. Capping plate height and pinning PyTorch to one thread took a representative read from ~9s to ~1.7s with no accuracy loss.

  • Flask dashboard with live MJPEG feed and detection overlays, cross-process frame sharing via /dev/shm, SQLite event logging, ntfy push notifications, and systemd auto-start.

Rough numbers (Pi 5 8GB + Hailo-8): 40+ FPS detection, ~40ms inference, <100ms end-to-end, ~30% CPU, ~8W total.

It’s all documented (README, setup guide, and compilation notes for the plate HEF) and I’d genuinely welcome feedback.

Regards,

Tom

1 Like

Thanks @Thomas_Herbison for sharing this cool project and kudos for all the work!

1 Like