CV / Tiny Yolo
Tiny-YOLOv4
reComputer R Series (CM5 + Hailo-8)
在搭载 Hailo-8 的 reComputer R Series 上使用 Tiny-YOLOv4 进行 COCO 80 类目标检测(CPU 端 YOLOv3 解码)。
17 次下载
大小
7.3 MB内存
4GB+精度
Hailo HEF / HailoRT 4.23.x选择你正在使用的设备,设置指南和文档将相应更新。
快速开始
部署
sudo docker run --rm \
--name cm5-hailo8-tiny-yolov4 \
--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/tiny_yolov4:latest \
python web_detection.py --model_path model/tiny_yolov4.hef --video_path video/test.mp4REST API
使用 REST API 进行推理。复制以下命令。
Curl
curl -X POST "http://<Board_IP>:8000/api/models/tiny_yolov4/predict" \
-F "file=@test.jpg"Python
import requests
response = requests.post(
"http://<Board_IP>:8000/api/models/tiny_yolov4/predict",
files={"file": open("test.jpg", "rb")},
timeout=30,
)
print(response.json())模型详情
Tiny-YOLOv4 在 reComputer R Series(CM5 + Hailo-8)上运行
Tiny-YOLOv4 在 Hailo-8 上检测 COCO 80 类目标。输入输出与 Tiny-YOLOv3 相同,但采用 YOLOv4-tiny 骨干网络(更轻量、精度更高)。不使用片上 NMS,原始 YOLOv3 输出头在 CPU 上解码。
本页面向配备 PCIe Hailo-8 加速器的 reComputer R Series(CM5 + Hailo-8)。
模型信息
| 属性 | 值 |
|---|---|
| 架构 | YOLOv4-tiny(base/yolo.yaml) |
| 任务 | 目标检测 |
| 输入 | 416x416x3 RGB(normalize_in_net std=255) |
| 输出 | 2 个原始输出头:13x13x255(步长 32)+ 26x26x255(步长 16) |
| 类别数 | 80(COCO,从 0 编号) |
| 参数量 | 6.05M |
| 运算量 | 6.92G |
| 后处理 | CPU YOLOv3 解码(无片上 NMS) |
| HEF | Hailo Model Zoo v2.19.0, Hailo-8 |
硬件与主机设置
bash
sudo apt update
sudo apt install hailort hailort-pcie-driver python3-hailort
sudo reboot
hailortcli --version
hailortcli fw-control identify
ls -l /dev/hailo0使用演示视频运行
bash
sudo docker run --rm \
--name cm5-hailo8-tiny-yolov4 \
--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/tiny_yolov4:latest \
python web_detection.py --model_path model/tiny_yolov4.hef --video_path video/test.mp4打开 http://<Board_IP>:8000 查看网页预览。
USB 摄像头模式
bash
sudo docker run --rm \
--name cm5-hailo8-tiny-yolov4 \
--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/tiny_yolov4:latest \
python web_detection.py --model_path model/tiny_yolov4.hef --camera_id 0REST API
text
POST http://<Board_IP>:8000/api/models/tiny_yolov4/predictbash
curl -X POST "http://<Board_IP>:8000/api/models/tiny_yolov4/predict" \
-F "file=@test.jpg"| 端点 | 方法 | 用途 |
|---|---|---|
/ | GET | 网页预览界面 |
/api/models/tiny_yolov4/predict | POST | 检测结果(JSON) |
/api/video_feed | GET | MJPEG 预览流 |
实现说明
- 输入输出及后处理与 Tiny-YOLOv3 相同(相同 base/yolo.yaml、锚框和 YOLOv3 CPU 解码);仅骨干网络不同(YOLOv4-tiny)。
- 不使用片上 NMS,原始 YOLOv3 输出头在 CPU 上解码(sigmoid + 锚框 + NMS)。
normalize_in_net的 std=255(÷255)+padding_color=114(灰色)。letterbox 后输入原始 uint8 RGB 数据。
开发说明
- 源码模块:
src/rpi5_hailo8_tiny_yolov4/ - Dockerfile:
docker/hailo8/tiny_yolov4.dockerfile - 容器:
ghcr.io/seeed-projects/recomputer-hailo8-cv/tiny_yolov4:latest - 系列:yolo(变体:tiny_yolov3 / tiny_yolov4);此处为 v4 构建。
输入与输出
Input: image, video, or USB camera frame. Output: COCO 80-class detection boxes with confidences, plus an annotated MJPEG preview.