cd /news/artificial-intelligence/deploying-custom-yolov8-on-raspberry… Β· home β€Ί topics β€Ί artificial-intelligence β€Ί article
[ARTICLE Β· art-8188] src=gist.github.com β†— pub= topic=artificial-intelligence verified=true sentiment=Β· neutral

Deploying Custom YOLOv8 on Raspberry Pi 5 + Hailo-8L

Practical guide for compiling custom-trained YOLOv8 models into HEF files for deployment on a Raspberry Pi 5 with a Hailo-8L AI HAT+, using the official Hailo AI Software Suite Docker container. The guide bypasses the standard Hailo setup script to allow compilation on any Linux host with Docker, without requiring Ubuntu, a physical Hailo device, or an NVIDIA GPU. It details the full pipeline from exporting a YOLOv8 model to ONNX format, preparing calibration images for INT8 quantization, and running the Docker container to generate the final HEF file.

read8 min views28 publishedApr 12, 2026

A practical guide for compiling custom-trained YOLOv8 models into HEF files using the official Hailo AI Software Suite Docker image β€” without needing Ubuntu, a Hailo PCIe device, or nvidia-docker on your host.

Target: Raspberry Pi 5 + Hailo-8L (13 TOPS) AI HAT+
Pipeline: .pt β†’ .onnx β†’ .har β†’ .hef β†’ deploy on Pi 5
Tested with: Hailo AI SW Suite 2025-10, Docker 28.x, Linux Mint (should work on any Linux with Docker)


Why This Guide Exists #

The official Hailo documentation assumes Ubuntu and provides a shell script (hailo_ai_sw_suite_docker_run.sh) that probes for PCIe drivers and nvidia-docker before launching the container. If you're compiling on a workstation that doesn't have a physical Hailo device installed β€” which is most people's setup β€” that script causes unnecessary problems. This guide bypasses it entirely with a direct docker run command.

What you need on the host:

  • Docker (that's it)
  • 16 GB+ RAM (32 GB recommended)
  • 25 GB+ free disk space
  • An NVIDIA GPU for training (not needed for compilation β€” the DFC runs on CPU)

What you do NOT need on the host:

  • Ubuntu
  • Hailo PCIe driver
  • HailoRT
  • nvidia-docker / NVIDIA Container Toolkit
  • A physical Hailo device

Phase 1: Train Your Model #

Standard Ultralytics training β€” nothing Hailo-specific here:

from ultralytics import YOLO

model = YOLO('yolov8n.pt')  # or yolov8s.pt
model.train(
    data='your_dataset.yaml',
    epochs=100,
    imgsz=640,
    batch=16,
    device=0
)

Phase 2: Export to ONNX #

from ultralytics import YOLO

model = YOLO('runs/detect/train/weights/best.pt')
model.export(format='onnx', imgsz=640, opset=11, simplify=True)

Critical notes:

  • opset=11 β€” Required by the Hailo DFC. Higher opset versions cause parsing failures.
  • imgsz=640 β€” Must match your training input size.
  • simplify=True β€” Runs onnx-simplifier to remove redundant ops.
  • Do NOT add NMS to the ONNX β€” the Hailo pipeline handles NMS on the host CPU during inference.

Phase 3: Prepare Calibration Images #

The DFC needs representative images from your dataset to calibrate INT8 quantisation.

mkdir -p ~/hailo_compile/models
mkdir -p ~/hailo_compile/calib

cp runs/detect/train/weights/best.onnx ~/hailo_compile/models/

ls /path/to/dataset/train/images/ | shuf -n 1000 | \
    xargs -I{} cp /path/to/dataset/train/images/{} ~/hailo_compile/calib/
  • 256 minimum, 1000+ recommended.
  • Images do NOT need to be pre-resized β€” the compiler handles resizing.
  • Should be representative of real-world deployment conditions.
  • Just raw images β€” no labels or annotations needed.

Why calibration matters: The DFC converts your model from FP32 to INT8 (from ~4 billion possible values per weight to 256). It runs your calibration images through the network to observe the min/max activation values at each layer, then uses those to set quantisation scale factors. Poor calibration data β†’ poor accuracy after quantisation.

Phase 4: Set Up the Hailo Docker #

4.1 Install Docker

sudo apt-get update
sudo apt-get install docker.io
sudo usermod -aG docker $USER
docker run hello-world  # verify

4.2 Download the Docker image

  1. Go to https://hailo.ai/developer-zone/ and create a free account.
  2. Navigate to Software Downloads β†’ AI Software Suite β†’ Linux β†’ x86 β†’ Docker.
  3. Download the Docker package (e.g., hailo8_ai_sw_suite_2025-10_docker.zip). This is ~15–20 GB.

⚠️ DOWNLOAD GOTCHA: Some downloads from the Developer Zone are stubs β€” tiny files (a few KB) instead of the real image. The real .tar.gz is 5–10 GB. If it's under 1 GB, re-download while fully logged in, or try a different browser.

4.3 Load and run the container

unzip hailo8_ai_sw_suite_2025-10_docker.zip

docker load -i hailo8_ai_sw_suite_2025-10.tar.gz

docker images | grep hailo

docker run -it \
    --name hailo_compile \
    -v ~/hailo_compile:/local/shared_with_docker \
    hailo8_ai_sw_suite_2025-10:1

Note: The image name prefix is hailo8_ (not just hailo_). Always verify with docker images after .

What this command deliberately omits:

  • --privileged β€” not needed (no device access)
  • -v /dev:/dev β€” not needed (no hardware to pass through)
  • --gpus β€” not needed (DFC runs on CPU)
  • --rm β€” deliberately omitted so the container persists (re-enter with docker start -i hailo_compile)

4.4 Fix volume permissions (required!)

The hailo user inside the container runs as UID 10642, not your host UID (typically 1000). Without fixing this, the container can read your mounted files but cannot write to the shared volume.

sudo chown -R 10642:10600 ~/hailo_compile

docker start -i hailo_compile

touch /local/shared_with_docker/test_write
rm /local/shared_with_docker/test_write

⚠️ If you skip this step, compilation may fail or the output HEF may not be accessible from the host.

4.5 Verify the environment

hailo -h              # DFC CLI
hailomz --help        # Model Zoo CLI
ls /local/shared_with_docker/models/    # your ONNX
ls /local/shared_with_docker/calib/ | wc -l   # calibration images

You will see [info] PCIe: No Hailo PCIe device was found β€” this is normal. The DFC does not need a physical device.

Before compiling your custom model, verify the toolchain with the stock pretrained YOLOv8n.

Download COCO calibration images

The Model Zoo's automatic calibration download may fail silently. Download manually:

cd /local/shared_with_docker
mkdir -p calib_coco && cd calib_coco
wget http://images.cocodataset.org/zips/val2017.zip
unzip val2017.zip && mv val2017/* . && rmdir val2017 && rm val2017.zip

Compile

cd /local/shared_with_docker

hailomz compile yolov8n \
    --calib-path /local/shared_with_docker/calib_coco \
    --yaml /local/workspace/hailo_model_zoo/hailo_model_zoo/cfg/networks/yolov8n.yaml \
    --hw-arch hailo8l

If the --yaml path doesn't work, find it: find /local/workspace/hailo_model_zoo -name "yolov8n.yaml"

This takes ~15–30 minutes on a modern CPU. You'll see [info] No GPU chosen β€” this is normal. Output: yolov8n.hef in your current directory.

Phase 5: Compile Your Custom Model #

cd /local/shared_with_docker

hailomz compile yolov8n \
    --ckpt /local/shared_with_docker/models/best.onnx \
    --calib-path /local/shared_with_docker/calib/ \
    --yaml /local/workspace/hailo_model_zoo/hailo_model_zoo/cfg/networks/yolov8n.yaml \
    --hw-arch hailo8l \
    --classes <YOUR_CLASS_COUNT>

Key flags:

Flag Purpose
yolov8n / yolov8s Selects the Model Zoo config. Must match your trained model variant.
--ckpt Path to your ONNX file inside the container.
--calib-path Directory of calibration images.
--yaml Full path to the Model Zoo YAML config.
--hw-arch hailo8l CRITICAL: Targets the Hailo-8L (13 TOPS). hailo8 = 26 TOPS β€” not interchangeable.
--classes N Your custom class count. Overrides the default 80 (COCO).
--performance Optional. Better FPS via NPU scheduling optimisation. Longer compile time.

Phase 6: Set Up the Pi 5 + Hailo-8L #

sudo apt update && sudo apt full-upgrade -y && sudo reboot

dtparam=pciex1_gen=3

sudo apt install hailo-all -y && sudo reboot

hailortcli fw-control identify

git clone https://github.com/hailo-ai/hailo-apps.git
cd hailo-apps && sudo ./install.sh

Phase 7: Deploy and Run #

scp ~/hailo_compile/models/yolov8n.hef pi@<pi_ip>:~/models/


cd ~/hailo-apps && source setup_env.sh
python basic_pipelines/detection.py \
    --hef ~/models/yolov8n.hef \
    --labels-json ~/models/labels.json \
    --input /path/to/test_video.mp4

python basic_pipelines/detection.py \
    --hef ~/models/yolov8n.hef \
    --labels-json ~/models/labels.json \
    --input "rtsp://user:pass@camera_ip:554/stream"

Container Management #

docker start -i hailo_compile

docker rm hailo_compile
docker run -it --name hailo_compile \
    -v ~/hailo_compile:/local/shared_with_docker \
    hailo8_ai_sw_suite_2025-10:1

Troubleshooting #

Issue Solution
Permission denied on mounted volume UID mismatch. Run on host: sudo chown -R 10642:10600 ~/hailo_compile
Calibration data not found (FileNotFoundError for .tfrecord) Model Zoo auto-download fails silently. Download COCO val2017 manually and use --calib-path.
--yaml "cfg file is missing" Use full path. Find with: find /local/workspace/hailo_model_zoo -name "yolov8n.yaml"
"unsupported op" during compilation ONNX export must use opset=11. Don't include NMS.
hailo8l not recognised as --hw-arch Older DFC version. Need suite 2025-10 or later.
Compilation runs out of memory DFC needs 16 GB RAM minimum (32 GB recommended).
Low FPS on the Pi Check PCIe Gen 3: sudo lspci -vv | grep -i LnkSta β†’ Speed 8GT/s. Try --performance flag.
Poor accuracy after quantisation Use more calibration images (1000+). Ensure they're representative. Use hailomz eval to compare.
HEF not working on Pi --hw-arch must match hardware: hailo8l = 13 TOPS, hailo8 = 26 TOPS. NOT interchangeable.
"No GPU chosen" during compilation Normal. DFC runs on CPU.
"No Hailo PCIe device found" Normal. DFC doesn't need a physical device.

Tested April 2026 with Hailo AI SW Suite 2025-10, Docker 28.x on Linux Mint. Verify commands against current Hailo documentation.

Author: Tom Herbison β€” part of the AI Security Camera project.

── more in #artificial-intelligence 4 stories Β· sorted by recency
── more on @raspberry pi 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/deploying-custom-yol…] indexed:0 read:8min 2026-04-12 Β· β€”