CV / ArcFace
ArcFace MobileFaceNet
ArcFace face recognition (2.04M params, 99.4% LFW) 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-arcface \
--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/arcface_mobilefacenet:latest \
python web_detection.py --model_path model/arcface_mobilefacenet.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/arcface_mobilefacenet/predict" \
-F "file=@face.jpg"import requests
resp = requests.post(
"http://<Board_IP>:8000/api/models/arcface_mobilefacenet/predict",
files={"file": open("face.jpg", "rb")},
timeout=30,
)
print(resp.json())Model Details
reComputer R Series (CM5 + Hailo-8)ArcFace MobileFaceNet on reComputer R Series (CM5 + Hailo-8)
ArcFace with a MobileFaceNet backbone extracts 512-dim face embeddings on Hailo-8 through HailoRT. The embedding is used for face verification and identification; face comparison itself is done by the client with cosine similarity.
This page targets reComputer R Series (CM5 + Hailo-8) with a PCIe Hailo-8 accelerator.
Model Info
| Property | Value |
|---|---|
| Architecture | ArcFace with MobileFaceNet backbone |
| Task | Face recognition (embedding extraction) |
| Input | 112x112x3 RGB (letterboxed, normalization compiled into the HEF) |
| Output | 512-dim face embedding |
| Parameters | 2.04M |
| LFW accuracy | 99.4% (Hailo Model Zoo reference) |
| HEF | Hailo Model Zoo v2.19.0, Hailo-8 |
The accuracy value is Hailo's Model Zoo reference. It is not a benchmark measured on CM5.
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 |
| Python in container | 3.11, aarch64 |
Install the Hailo-8 packages on the host and confirm that the driver and device are ready before starting the container:
sudo apt update
# Both candidates must be 4.23.x before installation.
apt-cache policy hailort hailort-pcie-driver
sudo apt install hailort=4.23.0 hailort-pcie-driver=4.23.0
sudo reboot
# After reboot
hailortcli --version
hailortcli fw-control identify
ls -l /dev/hailo0The expected HailoRT version for this image is 4.23.x. Do not continue if
apt-cache policy selects HailoRT 5.x; that runtime targets Hailo-10H and does
not match this Hailo-8 container.
Run With Demo Video
sudo docker run --rm \
--name cm5-hailo8-arcface \
--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/arcface_mobilefacenet:latest \
python web_detection.py --model_path model/arcface_mobilefacenet.hef --video_path video/test.mp4Open http://<Board_IP>:8000 to view the web preview. Each frame is annotated
with the embedding dimension, and the REST API returns the full 512-dim vector.
USB Camera Mode
sudo docker run --rm \
--name cm5-hailo8-arcface \
--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/arcface_mobilefacenet:latest \
python web_detection.py --model_path model/arcface_mobilefacenet.hef --camera_id 0REST API
Prediction endpoint:
POST http://<Board_IP>:8000/api/models/arcface_mobilefacenet/predictcurl -X POST "http://<Board_IP>:8000/api/models/arcface_mobilefacenet/predict" \
-F "file=@face.jpg"{
"success": true,
"source": "uploaded image",
"embedding": [0.023, -0.156, 0.089, "..."],
"dimension": 512,
"image": { "width": 1280, "height": 720 }
}| Endpoint | Method | Purpose |
|---|---|---|
/ | GET | Web preview UI |
/api/models/arcface_mobilefacenet/predict | POST | Face embedding (JSON) |
/api/video_feed | GET | MJPEG preview stream |
/api/config | GET / POST | Read or change runtime thresholds |
/api/video/upload | POST | Upload a source video |
/api/video/analyze | POST | Start offline video analysis |
/api/video/status | GET | Read analysis progress |
/api/video/download/{filename} | GET | Download the annotated result |
Face verification is not exposed as a separate endpoint: compare two returned embeddings with cosine similarity on the client side (L2-normalize both vectors first).
Implementation Notes
- The HEF contains its own normalization layer, so the application letterboxes frames to 112x112, converts BGR to RGB, and feeds raw uint8 pixels.
- The embedding is read from the
arcface_mobilefacenet/fc1output when the vstream name is exposed; otherwise the first output tensor is used. The first inference logs every vstream name and shape so the mapping can be verified on hardware. - Empty or non-finite embeddings are rejected instead of being returned as a valid result.
--class_pathis accepted for CLI compatibility but has no effect: ArcFace has no class label table.
Development Notes
- Source module:
src/rpi5_hailo8_arcface_mobilefacenet/ - Dockerfile:
docker/hailo8/arcface_mobilefacenet.dockerfile - Container:
ghcr.io/seeed-projects/recomputer-hailo8-cv/arcface_mobilefacenet:latest - HEF:
model/arcface_mobilefacenet.hef(4,100,573 bytes) - The module uses the HailoRT 4.23 VStreams API and a Hailo-8-specific HEF.
Inputs and Outputs
Input: image (112x112 RGB). Output: 512-dim face embedding vector.