CV / YOLOv7
YOLOv7
reComputer R Series (CM5 + Hailo-10H)
YOLOv7 COCO object detection accelerated by RKNN on reComputer RK3576 and RK3588, and through HailoRT on reComputer R Series with Hailo-10H.
Choose the device you're using, the set up guide and documentation will update accordingly.
Getting Started
sudo docker run --rm \
--name cm5-hailo10h-yolov7_tiny \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7_tiny:latest \
python web_detection.py --model_path model/yolov7_tiny.hef --video_path video/test.mp4REST API
Use the REST API to run inference. Copy the commands below.
curl http://localhost:8080/v1/chat/completions -d '{
"model": "yolov7-rknn",
"messages": [{"role": "user", "content": "Hello"}]
}'import requests
resp = requests.post(
"http://localhost:8080/v1/chat/completions",
json={"model": "yolov7-rknn", "messages": [{"role": "user", "content": "Hello"}]},
)
print(resp.json())Model Details
reComputer R Series (CM5 + Hailo-10H)YOLOv7 on reComputer R Series (CM5 + Hailo-10H)
YOLOv7 / YOLOv7-tiny / YOLOv7e6 / YOLOv7x perform COCO 80-class object detection on Hailo-10H through HailoRT. The compiled HEF runs NMS on-chip (HPP, meta_arch=yolov5, at most 80 boxes per class), so the application only parses the compact NMS-by-class buffer HailoRT 5.1.1 returns.
This page targets reComputer R Series (CM5 + Hailo-10H) with a PCIe Hailo-10H accelerator.
Hardware and Host Setup
| Item | Value |
|---|---|
| Board | reComputer R Series with Raspberry Pi CM5 |
| Accelerator | Hailo-10H over PCIe, exposed as /dev/hailo0 |
| Runtime | HailoRT 5.1.1 |
| Python in container | 3.13, aarch64 |
Install the Hailo-10H packages on the host and confirm that the driver and device are ready before starting the container:
sudo apt update
sudo apt install hailo-h10-all -y
sudo reboot
# After reboot
hailortcli --version
hailortcli fw-control identify
ls -l /dev/hailo0The expected HailoRT version for these images is 5.1.1.
Run With Demo Video
YOLOv7:
sudo docker run --rm \
--name cm5-hailo10h-yolov7 \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7:latest \
python web_detection.py --model_path model/yolov7.hef --video_path video/test.mp4YOLOv7-tiny:
sudo docker run --rm \
--name cm5-hailo10h-yolov7_tiny \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7_tiny:latest \
python web_detection.py --model_path model/yolov7_tiny.hef --video_path video/test.mp4YOLOv7e6:
sudo docker run --rm \
--name cm5-hailo10h-yolov7e6 \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7e6:latest \
python web_detection.py --model_path model/yolov7e6.hef --video_path video/test.mp4YOLOv7x:
sudo docker run --rm \
--name cm5-hailo10h-yolov7x \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
-v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7x:latest \
python web_detection.py --model_path model/yolov7x.hef --video_path video/test.mp4Open http://<Board_IP>:8000 to view the web preview.
USB Camera Mode
sudo docker run --rm \
--name cm5-hailo10h-yolov7 \
--privileged \
--net=host \
-e PYTHONUNBUFFERED=1 \
--device /dev/hailo0:/dev/hailo0 \
--device /dev/video0:/dev/video0 \
-v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7:latest \
python web_detection.py --model_path model/yolov7.hef --camera_id 0Swap yolov7 for yolov7_tiny, yolov7e6 or yolov7x to use another variant.
HEF Files
| Model | Input | Size | Notes |
|---|---|---|---|
yolov7.hef | 640x640x3 | 28,106,752 (28.1 MB) | 36.91M params, 104.51G ops, hardware mAP 48.8, 63.6 FPS |
yolov7_tiny.hef | 640x640x3 | 9,199,616 (9.2 MB) | 6.22M params, 13.74G ops, hardware mAP 36.3, 288 FPS |
yolov7e6.hef | 1280x1280x3 | 73,072,640 (73.1 MB) | 97.20M params, 515.12G ops, hardware mAP 53.1, 16.4 FPS |
yolov7x.hef | 640x640x3 | 56,406,016 (56.4 MB) | 71.46M params, 189.68G ops, hardware mAP 51.0, 34.7 FPS |
All four variants are Hailo Model Zoo v5.4.0 Hailo-10H builds. mAP and FPS are the Model Zoo's published Hailo-10H numbers.
Source: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v5.4.0/hailo10h/yolov7.hef (yolov7_tiny.hef, yolov7e6.hef, yolov7x.hef in the same directory).
REST API
Each variant has its own endpoint:
| Variant | Endpoint |
|---|---|
| YOLOv7 | POST /api/models/yolov7/predict |
| YOLOv7-tiny | POST /api/models/yolov7_tiny/predict |
| YOLOv7e6 | POST /api/models/yolov7e6/predict |
| YOLOv7x | POST /api/models/yolov7x/predict |
curl -X POST "http://<Board_IP>:8000/api/models/yolov7/predict" \
-F "file=@bus.jpg" -F "conf=0.25"The response contains predictions entries with class, confidence and box fields.
Implementation Notes
- The ALLS recipe is
change_output_activation(sigmoid)plusnms_postprocess(<model>_nms_config.json, meta_arch=yolov5, engine=cpu); the NMS config usesnms_scores_th 0.2,nms_iou_th 0.6andmax_proposals_per_class 80, so the host runs no box decode and no NMS. - HPP output on HailoRT 5.1.1 is the flat compact NMS-by-class buffer (per class: detection count followed by that many
[ymin, xmin, ymax, xmax, score]rows, all normalized to [0, 1]). Fixed-stride readers misalign every class after the first; the parser stops at the first implausible header and also keeps handlers for the ragged NMS-by-score and dense(1,C,5,D)/(1,C,D,5)layouts. yolov7e6uses a 1280x1280x3 input; the other three use 640x640x3. The application reads the size from the HEF at startup.- Pre-processing letterboxes to the HEF input size with gray (114) padding, converts BGR to RGB and feeds raw uint8; the
/255normalization is compiled into the HEF. - Class IDs 0..79 index the standard COCO class list directly.
- First-inference diagnostics are disabled in production (
_OUTPUT_LOGGED = True); set it toFalseinweb_detection.pyto dump the raw output type, shape, value range and per-class rows when validating a new HEF.
Development Notes
- Source modules:
src/hailo10h_yolov7/,src/hailo10h_yolov7_tiny/,src/hailo10h_yolov7e6/,src/hailo10h_yolov7x/in thereComputer-Hailo10H-CVrepository - Containers:
ghcr.io/seeed-projects/recomputer-hailo10h-cv/yolov7{,_tiny,e6,x}:latest - The Hailo Model Zoo also publishes Hailo-8 builds of all four variants (v2.19.0 / v2.20.0); only the Hailo-10H modules are published here so far.
- Model licence: GPL-3.0 (upstream WongKinYiu/yolov7).
Inputs and Outputs
Input: image, video frame, or camera frame. Output: COCO classes, confidence scores, and boxes.