Unofficial Obico Spaghetti Detection on Hailo-8/8L (Home Assistant) — working PoC

Hi all,

I wanted to share a proof of concept I built on a Raspberry Pi 5 + AI HAT+ (Hailo-8/8L): running Obico ( GitHub - TheSpaghettiDetective/obico-server: Obico is a community-built, open-source smart 3D printing platform used by makers, enthusiasts, and tinkerers around the world. · GitHub )'s spaghetti-detection model natively on the Hailo, as a Home Assistant addon + companion integration.

Disclaimer: this is vibecoded end to end — I built it with opencode (https://opencode.ai) (Big Pickle model) and it was made mainly for my own personal use, because I couldn’t find any usable spaghetti-detection that ran right on an RPi, and so I figured it was a nice excuse to make one with vibecoding and use the Hailo accelerator.

What it does

  • Runs Obico’s YOLOv5 (1 class, failure, 416×416) on the Hailo and only on the Hailo — the neural part, that is.
  • Snapshots the camera via the HA/Supervisor API, runs inference, serves an annotated bounding-box stream + detection state to real HA entities.
  • Entities: binary_sensor.obico_failure, sensor.obico_confidence, camera.obico_ml_detection_camera, switch.obico_ml_detection.

The Hailo-specific part
Obico’s graph is a small shared-weight YOLOv5 whose decoding head isn’t supported on the accelerator. So it was split into two HEF models — part1 backbone+neck, part2 detection tail — with the neck’s space-to-depth fusion done on the host between the two, because the ONNX parser chokes on the native Reshape/Concat (two separate known bugs), and the AI model took all the porting decisions on how to restructure the graph. A host-side decode.onnx (ONNX Runtime) finishes the YOLOv5 head. Hailo-8 vs 8L is auto-detected and the matching HEF set is loaded.
The full rebuild toolchain (split → calibrate → compile) lives in the repo’s model/ ( ha-obico-hailo/model at main · mpeex/ha-obico-hailo · GitHub ) folder — see the model/README ( ha-obico-hailo/model/README.md at main · mpeex/ha-obico-hailo · GitHub ) which explains step by step how to go from Obico’s official ONNX export to the compiled .hef files.

If anyone fancies improving that procedure (or the porting itself), it would be great if you could share it.

Validation on a 100-image set: ~72 ms/frame on Hailo-8 (RPi5), HEF vs ONNX reference hit rate 92.5% (IoU≥0.5), mean IoU 0.936, mAP50 identical to ONNX — the gap is a model, not a conversion, limitation.
There’s a short demo of my Bambu P1S printing a spaghetti test (MP4):

Repo: GitHub - mpeex/ha-obico-hailo: Home Assistant Spaghetti detection app using (a port of) Obico model for Hailo8/8L on RPI5 · GitHub
Install is via HA Addon + HACS companion integration (RPi5 with HailoRT, HA ≥ 2026.9).
Cheers,
mpeex

2 Likes

Thank you for sharing your project with the Hailo Community.