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.

1 次下载
大小
6.3 MB
内存
4GB+
精度
Hailo HEF / HailoRT 4.23.x

选择你正在使用的设备,设置指南和文档将相应更新。

快速开始

部署
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.mp4

REST API

使用 REST API 进行推理。复制以下命令。

Curl
curl -X POST "http://<Board_IP>:8000/api/models/retinaface_mobilenet_v1/predict" \
  -F "file=@test.jpg"
Python
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

PropertyValue
ArchitectureRetinaFace, MobileNet-v1 backbone (biubug6/Pytorch_Retinaface)
TaskFace detection
Input736x1280x3 BGR (normalize_in_net mean [123,117,104])
Output9 heads: 3 scales x {bbox, conf, landmark}
Priors38,640 anchors (2/cell, feature maps 92x160/46x80/23x40)
Classes1 (face) + 5 landmarks per detection
Parameters3.49M
Operations25.14G
mAP (WIDER FACE)81.3% hardware reference
HEFHailo 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

bash
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.mp4

Open http://<Board_IP>:8000 to view the web preview (face boxes + green keypoints overlaid on the MJPEG stream).

REST API

bash
curl -X POST "http://<Board_IP>:8000/api/models/retinaface_mobilenet_v1/predict" \
  -F "file=@test.jpg"
EndpointMethodPurpose
/GETWeb preview UI
/api/models/retinaface_mobilenet_v1/predictPOSTFaces + landmarks (JSON)
/api/video_feedGETMJPEG preview stream
/api/configGET / POSTConfidence / 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's face_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.