CV / ArcFace

ArcFace MobileFaceNet

reComputer R Series (CM5 + Hailo-10H)

ArcFace face recognition (2.04M params, 99.4% LFW) on reComputer R Series with Hailo-8 or Hailo-10H.

58 downloads
Size
3.91 MB
Memory
4GB+
Precision
Hailo HEF / HailoRT

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

Getting Started

Deploy
sudo docker run --rm \
  --name cm5-hailo-arcface \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  -v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo10h-cv/arcface_mobilefacenet:latest \
  python web_detection.py --model_path model/arcface_mobilefacenet.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/arcface_mobilefacenet/predict" \
  -F "file=@face.jpg"
Python
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-10H)

ArcFace MobileFaceNet on reComputer R Series (CM5 + Hailo-10H)

ArcFace with a MobileFaceNet backbone extracts 512-dim face embeddings on Hailo-10H 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-10H) with a PCIe Hailo-10H accelerator.

Model Info

PropertyValue
ArchitectureArcFace with MobileFaceNet backbone
TaskFace recognition (embedding extraction)
Input112x112x3 RGB (letterboxed, normalization compiled into the HEF)
Output512-dim face embedding
Parameters2.04M
LFW accuracy99.4% (Hailo Model Zoo reference)
HEFHailo Model Zoo v5.4.0, Hailo-10H

The accuracy value is Hailo's Model Zoo reference. It is not a benchmark measured on CM5.

Hardware and Host Setup

ItemValue
BoardreComputer R Series with Raspberry Pi CM5
AcceleratorHailo-10H over PCIe, exposed as /dev/hailo0
RuntimeHailoRT 5.1.1
Python in container3.13, aarch64

Install the Hailo-10H packages on the host and confirm that the driver and device are ready before starting the container:

bash
sudo apt update
sudo apt install hailo-h10-all -y
sudo reboot

# After reboot
hailortcli --version
hailortcli fw-control identify
ls -l /dev/hailo0

Run With Demo Video

bash
sudo docker run --rm \
  --name cm5-hailo-arcface \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  -v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo10h-cv/arcface_mobilefacenet:latest \
  python web_detection.py --model_path model/arcface_mobilefacenet.hef --video_path video/test.mp4

Open 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

bash
sudo docker run --rm \
  --name cm5-hailo-arcface \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  --device /dev/video0:/dev/video0 \
  -v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo10h-cv/arcface_mobilefacenet:latest \
  python web_detection.py --model_path model/arcface_mobilefacenet.hef --camera_id 0

REST API

Prediction endpoint:

text
POST http://<Board_IP>:8000/api/models/arcface_mobilefacenet/predict
bash
curl -X POST "http://<Board_IP>:8000/api/models/arcface_mobilefacenet/predict" \
  -F "file=@face.jpg"
json
{
  "success": true,
  "source": "uploaded image",
  "embedding": [0.023, -0.156, 0.089, "..."],
  "dimension": 512,
  "image": { "width": 1280, "height": 720 }
}
EndpointMethodPurpose
/GETWeb preview UI
/api/models/arcface_mobilefacenet/predictPOSTFace embedding (JSON)
/api/video_feedGETMJPEG preview stream
/api/video/uploadPOSTUpload a source video
/api/video/analyzePOSTStart offline video analysis
/api/video/statusGETRead analysis progress
/api/video/download/{filename}GETDownload 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).

HEF Files

HEFSizeNotes
arcface_mobilefacenet.hef2,666,496 bytesHailo-10H build, Model Zoo v5.4.0

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 fc1 output 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.

Development Notes

  • Source module: src/hailo10h_arcface_mobilefacenet/
  • Dockerfile: docker/hailo10h/arcface_mobilefacenet.dockerfile
  • Container: ghcr.io/seeed-projects/recomputer-hailo10h-cv/arcface_mobilefacenet:latest
  • The module uses the HailoRT 5.1.1 InferModel API and a Hailo-10H-specific HEF.

Inputs and Outputs

Input: image (112x112 RGB). Output: 512-dim face embedding vector.