CV / LightFace

LightFace Slim

Ultra-lightweight face detection (0.26M params) on reComputer R Series with Hailo-8 or Hailo-10H.

64 downloads
Memory
4GB+
Precision
Hailo HEF

Choose the device you're using, the set up guide and documentation will update accordingly.

Getting Started

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

REST API

Use the REST API to run inference. Copy the commands below.

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

PropertyValue
ArchitectureUltra-Light-Fast-Generic-Face-Detector-1MB (SSD-style, strides 8/16/32/64)
TaskFace Detection (single "face" class, WIDER FACE)
Input240×320×3 (the app feeds uint8 BGR; mean 127 / std 128 are baked into the HEF)
Output8 raw heads: 4 scales × {bbox deltas, background + face logits}
DecodeHost-side SSD decode (variances 10/5) + softmax + greedy NMS (meta_arch=retinaface)
Parameters0.26M
Operations0.16G
Reference mAP39.71 (WIDER FACE, full precision, Hailo Model Zoo; not measured on this board)
LicenseMIT (Ultra-Light-Fast-Generic-Face-Detector-1MB)
SourceHailo Model Zoo

Hardware and Host Setup

ItemValue
BoardreComputer R Series with Raspberry Pi CM5
AcceleratorHailo-8 over PCIe, exposed as /dev/hailo0
RuntimeHailoRT 4.23.x (host / container must share major.minor)
Python in container3.11, aarch64
bash
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 docker

Install hailort hailort-pcie-driver python3-hailort directly — not hailo-all, which can pull the Hailo-10H / HailoRT 5.x packages.

Run With Demo Video

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

USB Camera Mode

bash
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 0

Open http://<Board_IP>:8000 for the Web preview.

HEF Files

HEFSizeNotes
lightface_slim.hef1,907,332 bytesHailo Model Zoo v2.19.0 Hailo-8 build; 8 raw heads

Source:

text
https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.19.0/hailo8/lightface_slim.hef

SHA256: e448c0f692f9e907bb7328fc2305ced4d3569f1e0aa26d44439d1a6f003e9314

REST API

text
POST http://<Board_IP>:8000/api/models/lightface_slim/predict
bash
curl -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):

json
{
  "predictions": [
    {"box": [220, 156, 260, 196], "confidence": 0.98}
  ]
}
EndpointMethodPurpose
/GETWeb preview UI
/api/models/lightface_slim/predictPOSTFace boxes (JSON)
/api/video_feedGETMJPEG preview stream
/api/configGET / POSTConfidence / 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.