CV / ResNet

ResNet v1

reComputer R Series (CM5 + Hailo-8)

ResNet v1-18/34/50 ImageNet classification on reComputer R Series with Hailo-8 or Hailo-10H.

9 downloads
Size
12.5 MB
Memory
4GB+
Precision
Hailo HEF

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

Getting Started

Deploy
sudo docker run --rm \
  --name pi5-hailo8-resnet-v1-18 \
  --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/resnet_v1_18:latest \
  python web_detection.py --model_path model/resnet_v1_18.hef --video_path video/test.mp4

Model Details

reComputer R Series (CM5 + Hailo-8)

ResNet v1-18/v1-34/v1-50 ImageNet Classification on reComputer R Series (CM5 + Hailo-8)

ResNet v1-18/v1-34/v1-50 classify 1000 ImageNet classes on Hailo-8 through HailoRT 4.23. Each HEF takes a 224×224 RGB frame and returns 1000 scores; the host applies softmax, smooths the scores over time and overlays a Top-K panel on the MJPEG preview. All three variants share the same web service and the official Hailo demo video.

Model Info

VariantInputPackaged HEFTop-1 float / Hailo-8Params / OpsContainer
ResNet v1-18224×224×3 RGB12.5 MB71.3 / 71.111.68M / 3.64Gresnet_v1_18
ResNet v1-34224×224×3 RGB15.7 MB72.7 / 72.221.79M / 7.34Gresnet_v1_34
ResNet v1-50224×224×3 RGB18.0 MB75.2 / 74.725.53M / 6.98Gresnet_v1_50

Hardware and Host Setup

ItemValue
BoardreComputer R Series with Raspberry Pi CM5
AcceleratorHailo-8 over PCIe, exposed as /dev/hailo0
RuntimeHailoRT 4.23.x (host / container must share major.minor)
Python in container3.11, aarch64
bash
sudo apt update
sudo apt install hailo-all -y
sudo reboot

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

# Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
sudo systemctl enable docker
sudo systemctl start docker

Run With Demo Video

Select the command matching the model variant.

ResNet v1-18

bash
sudo docker run --rm \
  --name pi5-hailo8-resnet-v1-18 \
  --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/resnet_v1_18:latest \
  python web_detection.py --model_path model/resnet_v1_18.hef --video_path video/test.mp4

ResNet v1-34

bash
sudo docker run --rm \
  --name pi5-hailo8-resnet-v1-34 \
  --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/resnet_v1_34:latest \
  python web_detection.py --model_path model/resnet_v1_34.hef --video_path video/test.mp4

ResNet v1-50

bash
sudo docker run --rm \
  --name pi5-hailo8-resnet-v1-50 \
  --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/resnet_v1_50:latest \
  python web_detection.py --model_path model/resnet_v1_50.hef --video_path video/test.mp4

Open http://<Board_IP>:8000 to view the Top-K overlay. The bundled video/test.mp4 is Hailo's official classifier demo clip (example.mp4, a street scene with cars and people).

USB Camera Mode

bash
sudo docker run --rm \
  --name pi5-hailo8-resnet-v1-18 \
  --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/resnet_v1_18:latest \
  python web_detection.py --model_path model/resnet_v1_18.hef --camera_id 0

REST API

Each variant has its own endpoint:

VariantEndpoint
ResNet v1-18POST /api/models/resnet_v1_18/predict
ResNet v1-34POST /api/models/resnet_v1_34/predict
ResNet v1-50POST /api/models/resnet_v1_50/predict
bash
curl -X POST "http://<Board_IP>:8000/api/models/resnet_v1_18/predict" \
  -F "file=@test.jpg" -F "conf=0.30" -F "iou=5"

Returns predictions entries with the ImageNet class name, a short label and the confidence. iou is reused as the Top-K count for API parity with the detection modules.

Implementation Notes

  • Each HEF exposes a single 1000-way score vector; softmax and argmax are disabled in the compile, so the host runs softmax and Top-K.
  • Pre-processing is a plain resize to 224×224 and BGR→RGB; the ImageNet mean/std normalization is compiled into the HEF. No letterbox is used.
  • The live preview smooths the probability vector (0.6 previous + 0.4 current) to stop the label flickering, then draws the Top-K panel.
  • The HEF input size is read at startup (224×224).

Development Notes

  • Sources: src/rpi5_hailo8_resnet_v1_{18,34,50}/
  • Dockerfiles: docker/hailo8/resnet_v1_{18,34,50}.dockerfile
  • Containers: ghcr.io/seeed-projects/recomputer-hailo8-cv/resnet_v1_{18,34,50}:latest
  • HEFs: Hailo Model Zoo v2.20.0 (hailo8), sizes and SHA256 recorded in each module's model/README.md
  • Demo video: https://hailo-csdata.s3.eu-west-2.amazonaws.com/resources/video/example.mp4 (from hailo-ai/hailo-apps, MIT)

Inputs and Outputs

Input: image, video frame, or camera frame. Output: Top-K ImageNet labels and confidence scores.