CV / RetinaFace
RetinaFace MobileNet-v1
RetinaFace (MobileNet-v1 backbone) detects faces plus 5 keypoints (eyes, nose, mouth corners) on Hailo-8. The HEF exposes 9 raw heads; anchors, SSD decode, NMS and landmark decode run on the host CPU.
使用しているデバイスを選択してください。セットアップガイドとドキュメントがそれに応じて更新されます。
はじめる
sudo docker run --rm \
--name cm5-hailo8-retinaface \
--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/retinaface_mobilenet_v1:latest \
python web_detection.py --model_path model/retinaface_mobilenet_v1.hef --video_path video/test.mp4REST API
REST API を使用して推論を実行します。以下のコマンドをコピーしてください。
curl -X POST "http://<Board_IP>:8000/api/models/retinaface_mobilenet_v1/predict" \
-F "file=@test.jpg"import requests
response = requests.post(
"http://<Board_IP>:8000/api/models/retinaface_mobilenet_v1/predict",
files={"file": open("test.jpg", "rb")},
timeout=30,
)
print(response.json())モデル詳細
RetinaFace MobileNet-v1 on reComputer R Series (CM5 + Hailo-8)
RetinaFace detects faces — plus 5 keypoints (eyes, nose tip, mouth corners) per face — on Hailo-8 through HailoRT. The HEF exposes 9 raw heads and the decode runs on the host CPU.
Model Info
| Property | Value |
|---|---|
| Architecture | RetinaFace, MobileNet-v1 backbone (biubug6/Pytorch_Retinaface) |
| Task | Face detection |
| Input | 736x1280x3 BGR (normalize_in_net mean [123,117,104]) |
| Output | 9 heads: 3 scales x {bbox, conf, landmark} |
| Priors | 38,640 anchors (2/cell, feature maps 92x160/46x80/23x40) |
| Classes | 1 (face) + 5 landmarks per detection |
| Parameters | 3.49M |
| Operations | 25.14G |
| mAP (WIDER FACE) | 81.3% hardware reference |
| HEF | Hailo Model Zoo v2.19.0, Hailo-8 |
The accuracy value above is Hailo's Model Zoo reference. It is not a benchmark measured on CM5.
Run With Demo Video
sudo docker run --rm \
--name cm5-hailo8-retinaface \
--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/retinaface_mobilenet_v1:latest \
python web_detection.py --model_path model/retinaface_mobilenet_v1.hef --video_path video/test.mp4Open http://<Board_IP>:8000 to view the web preview (face boxes + green
keypoints overlaid on the MJPEG stream).
REST API
curl -X POST "http://<Board_IP>:8000/api/models/retinaface_mobilenet_v1/predict" \
-F "file=@test.jpg"| Endpoint | Method | Purpose |
|---|---|---|
/ | GET | Web preview UI |
/api/models/retinaface_mobilenet_v1/predict | POST | Faces + landmarks (JSON) |
/api/video_feed | GET | MJPEG preview stream |
/api/config | GET / POST | Confidence / NMS IOU thresholds |
Implementation Notes
- CPU post-processing (
meta_arch=retinaface): no on-chip NMS. Anchor generation, SSD decode (variances 10/5), softmax confidence, greedy NMS and landmark decode are a numpy port of the Model Zoo'sface_detection_postprocessing.py. - Head layout per the official reshapes: 8-channel head = bbox (2 anchors x 4 coords), 4-channel head = confidence (2 anchors x {background, face}), 20-channel head = landmarks (2 anchors x 10 coords).
- The alls script applies
input_conversion(bgr_to_rgb)in the HEF — the app feeds raw uint8 BGR frames. - Preprocessing: aspect-ratio-preserving resize + bottom/right pad (color 0) to 736x1280.
Development Notes
- Source module:
src/rpi5_hailo8_retinaface_mobilenet_v1/ - Dockerfile:
docker/hailo8/retinaface_mobilenet_v1.dockerfile - Container:
ghcr.io/seeed-projects/recomputer-hailo8-cv/retinaface_mobilenet_v1:latest - Family: RetinaFace (variant: mobilenet_v1)
入力と出力
Input: image, video, or USB camera frame. Output: face boxes with confidences, 5 keypoints per face (eyes, nose, mouth corners), and an annotated MJPEG preview.