CV / LightFace
LightFace Slim
Ultra-lightweight face detection (0.26M params) on reComputer R Series with Hailo-8 or 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-hailo8-lightface \
--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/lightface_slim:latest \
python web_detection.py --model_path model/lightface_slim.hef --video_path video/test.mp4REST API
Use the REST API to run inference. Copy the commands below.
curl -X POST "http://<Board_IP>:8000/api/models/lightface_slim/predict" \
-F "file=@test.jpg"import requests
resp = requests.post(
"http://<Board_IP>:8000/api/models/lightface_slim/predict",
files={"file": open("test.jpg", "rb")},
timeout=30,
)
print(resp.json())Model Details
reComputer R Series (CM5 + Hailo-8)LightFace Slim on reComputer R Series (CM5 + Hailo-8)
Ultra-lightweight face detection (0.26M params) running on Hailo-8 via HailoRT 4.23. The HEF exposes raw SSD-style heads (no on-chip NMS): the host builds the 4,420 anchors, runs the SSD box decode (variances 10/5), the softmax over the background/face logits, the score cut and greedy NMS.
This page targets reComputer R Series (CM5 + Hailo-8) with a PCIe Hailo-8 accelerator.
Model Info
| Property | Value |
|---|---|
| Architecture | Ultra-Light-Fast-Generic-Face-Detector-1MB (SSD-style, strides 8/16/32/64) |
| Task | Face Detection (single "face" class, WIDER FACE) |
| Input | 240×320×3 (the app feeds uint8 BGR; mean 127 / std 128 are baked into the HEF) |
| Output | 8 raw heads: 4 scales × {bbox deltas, background + face logits} |
| Decode | Host-side SSD decode (variances 10/5) + softmax + greedy NMS (meta_arch=retinaface) |
| Parameters | 0.26M |
| Operations | 0.16G |
| Reference mAP | 39.71 (WIDER FACE, full precision, Hailo Model Zoo; not measured on this board) |
| License | MIT (Ultra-Light-Fast-Generic-Face-Detector-1MB) |
| Source | Hailo Model Zoo |
Hardware and Host Setup
| Item | Value |
|---|---|
| Board | reComputer R Series with Raspberry Pi CM5 |
| Accelerator | Hailo-8 over PCIe, exposed as /dev/hailo0 |
| Runtime | HailoRT 4.23.x (host / container must share major.minor) |
| Python in container | 3.11, aarch64 |
sudo apt update
sudo apt install hailort hailort-pcie-driver python3-hailort
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 dockerInstall
hailort hailort-pcie-driver python3-hailortdirectly — nothailo-all, which can pull the Hailo-10H / HailoRT 5.x packages.
Run With Demo Video
sudo docker run --rm --privileged --net=host \
--name cm5-hailo8-lightface \
-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/lightface_slim:latest \
python web_detection.py --model_path model/lightface_slim.hef --video_path video/test.mp4USB Camera Mode
sudo docker run --rm --privileged --net=host \
--name cm5-hailo8-lightface \
-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/lightface_slim:latest \
python web_detection.py --model_path model/lightface_slim.hef --camera_id 0Open http://<Board_IP>:8000 for the Web preview.
HEF Files
| HEF | Size | Notes |
|---|---|---|
lightface_slim.hef | 1,907,332 bytes | Hailo Model Zoo v2.19.0 Hailo-8 build; 8 raw heads |
Source:
https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.19.0/hailo8/lightface_slim.hefSHA256: e448c0f692f9e907bb7328fc2305ced4d3569f1e0aa26d44439d1a6f003e9314
REST API
POST http://<Board_IP>:8000/api/models/lightface_slim/predictcurl -X POST "http://<Board_IP>:8000/api/models/lightface_slim/predict" \
-F "file=@test.jpg"Response (box is [x1, y1, x2, y2] in original-frame pixels):
{
"predictions": [
{"box": [220, 156, 260, 196], "confidence": 0.98}
]
}| Endpoint | Method | Purpose |
|---|---|---|
/ | GET | Web preview UI |
/api/models/lightface_slim/predict | POST | Face boxes (JSON) |
/api/video_feed | GET | MJPEG preview stream |
/api/config | GET / POST | Confidence / IoU thresholds |
Implementation Notes
- Anchor set from the zoo config: steps 8/16/32/64, min_sizes [10,16,24] / [32,48] / [64,96] / [128,192,256] → 4,420 anchors.
- Preview confidence cut 0.5; the zoo evaluation uses 0.1 with NMS IoU 0.3.
- The frame is resized with the aspect ratio preserved and padded bottom/right with 0, matching the zoo's face-detection preprocessing.
Development
- Source:
src/rpi5_hailo8_lightface_slim/ - Dockerfile:
docker/hailo8/lightface_slim.dockerfile - Validation log:
src/rpi5_hailo8_lightface_slim/TEST_REPORT.md
Inputs and Outputs
Input: image (240x320 RGB). Output: face bounding boxes with confidence scores.