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.

5 downloads
Size
12.4 MB
Memory
4GB+
Precision
Hailo HEF / HailoRT 4.23.x

Choose the device you're using, the set up guide and documentation will update accordingly.

Getting Started

Deploy
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.mp4

REST API

Use the REST API to run inference. Copy the commands below.

Curl
curl -X POST "http://<Board_IP>:8000/api/models/centernet_resnet_v1_18_postprocess/predict" \
  -F "file=@test.jpg"
Python
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())

Model Details

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

PropertyValue
ArchitectureCenterNet (ResNet-18 backbone)
TaskObject detection
Input512x512x3 RGB (normalization compiled into the HEF)
Output3 heads: wh (128x128x2), reg (128x128x2), sparse heatmap (128x128x80)
Classes80 (COCO)
Parameters14.22M
Operations31.21G
Hardware mAP25.0 (COCO, Hailo Model Zoo reference)
HEFHailo 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

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

# 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/hailo0

The 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

bash
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.mp4

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

USB Camera Mode

bash
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 0

REST API

Prediction endpoint:

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

Example image request:

bash
curl -X POST "http://<Board_IP>:8000/api/models/centernet_resnet_v1_18_postprocess/predict" \
  -F "file=@test.jpg"
EndpointMethodPurpose
/GETWeb preview UI
/api/models/centernet_resnet_v1_18_postprocess/predictPOSTDetections (JSON)
/api/video_feedGETMJPEG 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, reads wh/reg at 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.

Inputs and Outputs

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