CV / CenterNet

CenterNet (resnet_v1_50)

CenterNet with a ResNet-50 backbone detects 80 COCO object classes in one pass on Hailo-8, using the on-chip max_finder post-processing variant. It is the higher-accuracy sibling of the resnet_v1_18 build.

2 descargas
Tamaño
30.6 MB
Memoria
4GB+
Precisión
Hailo HEF / HailoRT 4.23.x

Elige el dispositivo que estás usando. La guía de configuración y la documentación se actualizarán en consecuencia.

Primeros pasos

Desplegar
sudo docker run --rm \
  --name cm5-hailo8-centernet-r50 \
  --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_50_postprocess:latest \
  python web_detection.py --model_path model/centernet_resnet_v1_50_postprocess.hef --video_path video/test.mp4

API REST

Usa la API REST para ejecutar inferencia. Copia los comandos siguientes.

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

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

Detalles del modelo

CenterNet (resnet_v1_50) on reComputer R Series (CM5 + Hailo-8)

CenterNet with a ResNet-50 backbone performs COCO 80-class object detection on Hailo-8 through HailoRT, using the on-chip max_finder post-processing variant. It is the higher-accuracy sibling of the resnet_v1_18 build: same input/output contract, deeper backbone.

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

Model Info

PropertyValue
ArchitectureCenterNet (ResNet-50 backbone)
TaskObject detection
Input512x512x3 RGB (normalization compiled into the HEF)
Output3 heads: wh (128x128x2), reg (128x128x2), sparse heatmap (128x128x80)
Classes80 (COCO)
Parameters30.07M
Operations56.92G
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 hailo-all
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-centernet-r50 \
  --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_50_postprocess:latest \
  python web_detection.py --model_path model/centernet_resnet_v1_50_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-r50 \
  --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_50_postprocess:latest \
  python web_detection.py --model_path model/centernet_resnet_v1_50_postprocess.hef --camera_id 0

REST API

Prediction endpoint:

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

Example image request:

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

Implementation Notes

  • Identical input/output contract and post-processing to the resnet_v1_18 build; only the backbone differs (ResNet-50 → more accurate, heavier).
  • 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_50_postprocess/
  • Dockerfile: docker/hailo8/centernet_resnet_v1_50_postprocess.dockerfile
  • Container: ghcr.io/seeed-projects/recomputer-hailo8-cv/centernet_resnet_v1_50_postprocess:latest
  • The module uses the HailoRT 4.23 VStreams API and a Hailo-8-specific HEF.

Entradas y salidas

Entrada: imagen, vídeo o fotograma de cámara USB. Salida: cuadros de detección de 80 clases de COCO con niveles de confianza, además de una vista previa MJPEG anotada.