CV / CenterNet
CenterNet (resnet_v1_18)
CenterNet with a ResNet-18 backbone detects 80 COCO object classes in one pass on Hailo-8, using the on-chip max_finder post-processing variant.
Wähle das Gerät, das du verwendest. Die Einrichtungsanleitung und Dokumentation werden entsprechend aktualisiert.
Erste Schritte
sudo docker run --rm \
--name cm5-hailo8-centernet \
--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/centernet_resnet_v1_18_postprocess:latest \
python web_detection.py --model_path model/centernet_resnet_v1_18_postprocess.hef --video_path video/test.mp4REST API
Verwende die REST API für die Inferenz. Kopiere die folgenden Befehle.
curl -X POST "http://<Board_IP>:8000/api/models/centernet_resnet_v1_18_postprocess/predict" \
-F "file=@test.jpg"import requests
response = requests.post(
"http://<Board_IP>:8000/api/models/centernet_resnet_v1_18_postprocess/predict",
files={"file": open("test.jpg", "rb")},
timeout=30,
)
print(response.json())Modelldetails
CenterNet (resnet_v1_18) on reComputer R Series (CM5 + Hailo-8)
CenterNet with a ResNet-18 backbone performs COCO 80-class object detection
on Hailo-8 through HailoRT, using the on-chip max_finder post-processing
variant.
This page targets reComputer R Series (CM5 + Hailo-8) with a PCIe Hailo-8 accelerator.
Model Info
| Property | Value |
|---|---|
| Architecture | CenterNet (ResNet-18 backbone) |
| Task | Object detection |
| Input | 512x512x3 RGB (normalization compiled into the HEF) |
| Output | 3 heads: wh (128x128x2), reg (128x128x2), sparse heatmap (128x128x80) |
| Classes | 80 (COCO) |
| Parameters | 14.22M |
| Operations | 31.21G |
| Hardware mAP | 25.0 (COCO, Hailo Model Zoo reference) |
| HEF | Hailo Model Zoo v2.19.0, Hailo-8 |
The accuracy value comes from the Hailo Model Zoo Hailo-8 object detection table. It is not a benchmark measured on CM5.
Hardware and Host Setup
| Item | Value |
|---|---|
| Board | reComputer R Series with Raspberry Pi CM5 |
| Accelerator | Hailo-8 over PCIe, exposed as /dev/hailo0 |
| Runtime | HailoRT 4.23.x |
| Python in container | 3.11, aarch64 |
Install the Hailo-8 packages on the host and confirm that the driver and device are ready before starting the container:
sudo apt update
# Both candidates must be 4.23.x before installation.
apt-cache policy hailort hailort-pcie-driver
sudo apt install hailort=4.23.0 hailort-pcie-driver=4.23.0
sudo reboot
# After reboot
hailortcli --version
hailortcli fw-control identify
ls -l /dev/hailo0The expected HailoRT version for this image is 4.23.x. Do not continue if
apt-cache policy selects HailoRT 5.x; that runtime targets Hailo-10H and does
not match this Hailo-8 container.
Run With Demo Video
sudo docker run --rm \
--name cm5-hailo8-centernet \
--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/centernet_resnet_v1_18_postprocess:latest \
python web_detection.py --model_path model/centernet_resnet_v1_18_postprocess.hef --video_path video/test.mp4Open http://<Board_IP>:8000 to view the web preview.
USB Camera Mode
sudo docker run --rm \
--name cm5-hailo8-centernet \
--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/centernet_resnet_v1_18_postprocess:latest \
python web_detection.py --model_path model/centernet_resnet_v1_18_postprocess.hef --camera_id 0REST API
Prediction endpoint:
POST http://<Board_IP>:8000/api/models/centernet_resnet_v1_18_postprocess/predictExample image request:
curl -X POST "http://<Board_IP>:8000/api/models/centernet_resnet_v1_18_postprocess/predict" \
-F "file=@test.jpg"| Endpoint | Method | Purpose |
|---|---|---|
/ | GET | Web preview UI |
/api/models/centernet_resnet_v1_18_postprocess/predict | POST | Detections (JSON) |
/api/video_feed | GET | MJPEG preview stream |
Implementation Notes
- The HEF was compiled with
normalize_in_net=true(ImageNet mean/std, RGB), so the app letterboxes to 512x512, converts BGR to RGB, and feeds raw uint8 pixels — no manual normalization. - The heatmap head is already sparse: the on-chip
max_finder+ score threshold (0.2) keep only local maxima above threshold. The decoder takes those peaks, readswh/regat each peak, and reconstructs boxes with the official Hailo Model Zoo formula (stride 4, 128x128 feature map -> 512x512 input), then un-letterboxes back to the original frame. - The two 2-channel heads (wh, reg) are mapped by vstream name when the conv number is exposed (conv3 -> wh, conv5 -> reg), otherwise by network output order. First inference prints every vstream name/shape and the resolved mapping so it can be verified on hardware.
Development Notes
- Source module:
src/rpi5_hailo8_centernet_resnet_v1_18_postprocess/ - Dockerfile:
docker/hailo8/centernet_resnet_v1_18_postprocess.dockerfile - Container:
ghcr.io/seeed-projects/recomputer-hailo8-cv/centernet_resnet_v1_18_postprocess:latest - The module uses the HailoRT 4.23 VStreams API and a Hailo-8-specific HEF.
Eingaben und Ausgaben
Eingabe: Bild, Video oder Einzelbild einer USB-Kamera. Ausgabe: Erkennungsrahmen für 80 COCO-Klassen mit Konfidenzwerten sowie eine annotierte MJPEG-Vorschau.