CV / NanoDet

NanoDet-RepVGG-a12

nanodet_repvgg_a12 detects 80 COCO object classes on Hailo-8. Despite the "nanodet" name this variant is built on the YOLOX architecture (base/yolox.yaml), 640x640 input. NMS runs on-chip (Hailo HPP, meta_arch=yolox), so the app only parses the post-NMS tensor.

4 ダウンロード
サイズ
7.5 MB
メモリ
4GB+
精度
Hailo HEF / HailoRT

使用しているデバイスを選択してください。セットアップガイドとドキュメントがそれに応じて更新されます。

はじめる

デプロイ
sudo docker run --rm \
  --name cm5-hailo8-nanodet-repvgg-a12 \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  -v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo8-cv/nanodet_repvgg_a12:latest \
  python web_detection.py --model_path model/nanodet_repvgg_a12.hef --video_path video/test.mp4

REST API

REST API を使用して推論を実行します。以下のコマンドをコピーしてください。

Curl
curl -X POST "http://<Board_IP>:8000/api/models/nanodet_repvgg_a12/predict" \
  -F "file=@test.jpg"
Python
import requests

response = requests.post(
    "http://<Board_IP>:8000/api/models/nanodet_repvgg_a12/predict",
    files={"file": open("test.jpg", "rb")},
    timeout=30,
)
print(response.json())

モデル詳細

NanoDet-RepVGG-a12 on reComputer R Series (CM5 + Hailo-8)

nanodet_repvgg_a12 performs COCO 80-class object detection on Hailo-8 through HailoRT. Despite the "nanodet" name this variant is built on the YOLOX architecture (base/yolox.yaml), 640x640 input. NMS runs on-chip (Hailo HPP, meta_arch=yolox), so the host only parses the post-NMS tensor.

This page targets reComputer R Series (CM5 + Hailo-8) with a PCIe Hailo-8 accelerator.

Model Info

PropertyValue
ArchitectureYOLOX-based (base/yolox.yaml) + RepVGG-A12 backbone
TaskObject detection
Input640x640x3 BGR (input_conversion bgr_to_rgb + no-op normalize_in_net)
Outputon-chip NMS tensor, post-NMS shape 80x5x100
Classes80 (COCO, 0-indexed; labels_offset=1 eval-only)
Parameters5.13M
Operations28.23G
Postprocesson-chip NMS (HPP); host parses post-NMS tensor
HEFHailo Model Zoo v2.19.0, Hailo-8

The accuracy value is Hailo's Model Zoo reference. It is not a benchmark measured on CM5.

Hardware and Host Setup

ItemValue
BoardreComputer R Series with Raspberry Pi CM5
AcceleratorHailo-8 over PCIe, exposed as /dev/hailo0
RuntimeHailoRT 4.23.x
Python in container3.11, aarch64

Install the Hailo-8 packages on the host and confirm that the driver and device are ready before starting the container:

bash
sudo apt update
sudo apt install hailort hailort-pcie-driver python3-hailort
sudo reboot

# After reboot
hailortcli --version
hailortcli fw-control identify
ls -l /dev/hailo0

The expected HailoRT version for this image is 4.23.x.

Run With Demo Video

bash
sudo docker run --rm \
  --name cm5-hailo8-nanodet-repvgg-a12 \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  -v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo8-cv/nanodet_repvgg_a12:latest \
  python web_detection.py --model_path model/nanodet_repvgg_a12.hef --video_path video/test.mp4

Open http://<Board_IP>:8000 to view the web preview.

USB Camera Mode

bash
sudo docker run --rm \
  --name cm5-hailo8-nanodet-repvgg-a12 \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  --device /dev/video0:/dev/video0 \
  -v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo8-cv/nanodet_repvgg_a12:latest \
  python web_detection.py --model_path model/nanodet_repvgg_a12.hef --camera_id 0

REST API

Prediction endpoint:

text
POST http://<Board_IP>:8000/api/models/nanodet_repvgg_a12/predict

Example image request:

bash
curl -X POST "http://<Board_IP>:8000/api/models/nanodet_repvgg_a12/predict" \
  -F "file=@test.jpg"
EndpointMethodPurpose
/GETWeb preview UI
/api/models/nanodet_repvgg_a12/predictPOSTDetections (JSON)
/api/video_feedGETMJPEG preview stream

Implementation Notes

  • Same on-chip NMS (HPP) post-processing as nanodet_repvgg (80-class HPP parse), but this variant uses base/yolox.yaml: meta_arch=yolox, 640x640 input, padding_color=114 (gray, YOLOX convention).
  • The HEF runs NMS on-chip (device_pre_post_layers: nms=true, hpp=true); the app only parses the post-NMS tensor (per the official tf_postproc_nms), so nms_thresh is ignored (API parity only).
  • Post-NMS rows are [ymin, xmin, ymax, xmax, score], normalized to [0,1] of the 640x640 letterboxed input; the app scales to pixels and un-letterboxes.
  • normalize_in_net no-op (mean=0/std=1) + on-chip input_conversion(bgr_to_rgb): the app letterboxes with gray (114) padding and feeds raw uint8 BGR pixels — no manual normalization, no cvtColor.
  • HailoRT returns the NMS vstream as a ragged per-class list (NMS-by-score); the parser handles that plus object/dense layouts. First inference logs the raw type/shape so it can be verified on hardware.
  • Class mapping: cls_id (0..79) → standard COCO 80-class list directly (labels_offset=1 is eval-only; if labels look shifted, re-derive from the first-inference log).
  • Defaults: confidence 0.25, IOU 0.45 (IOU has no effect — NMS on-chip). Model Zoo eval uses 0.01 / 0.65 — lower the confidence slider to inspect more.

Development Notes

  • Source module: src/rpi5_hailo8_nanodet_repvgg_a12/
  • Dockerfile: docker/hailo8/nanodet_repvgg_a12.dockerfile
  • Container: ghcr.io/seeed-projects/recomputer-hailo8-cv/nanodet_repvgg_a12:latest
  • The module uses the HailoRT 4.23 VStreams API and a Hailo-8-specific HEF.
  • Family: nanodet (variants nanodet_repvgg / nanodet_repvgg_a12 / nanodet_repvgg_a1_640); this is the nanodet_repvgg_a12 build.

入力と出力

Input: image, video, or USB camera frame. Output: COCO 80-class detection boxes with confidences, plus an annotated MJPEG preview.