Face recognition
EdgeFace-XS
A 1.8-million-parameter face recognizer built for phones: 512 numbers per face in under 4 ms on a CPU. CC BY-NC-SA 4.0.
About this model
EdgeFace turns a face into an embedding of 512 numbers: the same person gives similar embeddings (cosine similarity near 1), different people low ones. Compare a new face with stored embeddings to verify or identify someone.
It is Idiap's lightweight recognizer: an EdgeNeXt hybrid of convolutions and attention with low-rank linear layers, 1.77 million parameters, first among models under 2 million parameters at the IJCB 2023 efficient face recognition competition. Idiap reports 99.73% on LFW, 96.08% on AgeDB-30, 94.71% on CFP-FP, 95.28% on CALFW and 91.58% on CPLFW.
The pack aligns the face itself: pass the five landmarks from a face detector with the photo, and Slab warps the face onto the 112 x 112 template EdgeFace was trained with (the same as ArcFace's).
What you can build
- Face unlock and verification on phones and small devices
- Group photos by person on the device
- Attendance or access with enrolled faces
- Pair with RetinaFace MobileNet-0.25 for a complete pipeline under 10 MB
Astronaut crew portrait
f16Adam Cuerden, Public domain, https://commons.wikimedia.org/wiki/File:Portrait_of_ASTP_crews_-_restoration.jpg
5 faces, numbered on the photo (CPU, FP16 pack). Each face against the same face in a mirrored copy of the photo (same person): 1: 0.98, 2: 0.97, 3: 0.94, 4: 0.97, 5: 0.97. The faces against each other (different people; 1.00 on the diagonal): face 1: 1.00 -0.12 0.28 0.01 0.14 face 2: -0.12 1.00 0.10 -0.01 0.09 face 3: 0.28 0.10 1.00 0.02 0.02 face 4: 0.01 -0.01 0.02 1.00 0.05 face 5: 0.14 0.09 0.02 0.05 1.00
People laughing
f16State Library and Archives of Florida, Public domain, https://commons.wikimedia.org/wiki/File:People_laughing_at_a_dinner_(4563388022).jpg
6 faces, numbered on the photo (CPU, FP16 pack). Each face against the same face in a mirrored copy of the photo (same person): 1: 0.98, 2: 0.98, 3: 0.98, 4: 0.97, 5: 0.94, 6: 0.92. The faces against each other (different people; 1.00 on the diagonal): face 1: 1.00 0.25 0.34 0.21 0.15 0.12 face 2: 0.25 1.00 0.20 0.11 -0.09 0.08 face 3: 0.34 0.20 1.00 0.29 0.04 0.10 face 4: 0.21 0.11 0.29 1.00 0.16 0.05 face 5: 0.15 -0.09 0.04 0.16 1.00 -0.03 face 6: 0.12 0.08 0.10 0.05 -0.03 1.00
Variants & downloads
Choose the build for your appModel files are hosted on Google Drive. Large files may open a confirmation page before downloading.
Small
SlabWeights stored as int8 in blocks of 64. Slab decodes them to float when loading, so it runs at the same speed; embeddings move slightly more than with FP16 (see Accuracy).
Platforms: macos · android
edgeface-xs-int8.slab
7.5 MB · Hosted download
SHA-256 checksum
044555858c2a92de044b2aff431d744eff4e2ba189634462e1e26fdb9e115044NOTICE-EdgeFace.txt
2 KB
SHA-256 checksum
c4fdcd56928ded830f3389b875b801091b795923c0b62785bbe1e0eadc7bd219Conversion details
- command
- git clone https://github.com/otroshi/edgeface && cd edgeface && git checkout ce86851cfc37979a9cd2558598d0e9bc592cbba3 python -c "import torch; from backbones import get_model; m = get_model('edgeface_xs_gamma_06'); m.load_state_dict(torch.load('checkpoints/edgeface_xs_gamma_06.pt', map_location='cpu', weights_only=True)); torch.onnx.export(m.eval(), torch.randn(1, 3, 112, 112), 'model.onnx', input_names=['input'], output_names=['embedding'], opset_version=17, dynamo=False)" # needs timm slab-load convert model.onnx model.slab --input input=1x3x112x112 --meta task=embed --meta align=arcface --meta resize=stretch --meta color=rgb --meta normalize=neg_one_to_one slab-load quantize model.slab edgeface-xs-int8.slab slab-load meta set edgeface-xs-int8.slab default_backend.macos=cpu
Integration examples
Python
python
import slab
cfg = slab.Config(cache_dir="/tmp/slab_cache", license=open("license.slablic.txt").read())
detector = slab.Session(cfg, "retinaface-mobilenet-f16.slab", warmup=True)
recognizer = slab.Session(cfg, "edgeface-xs-f16.slab", warmup=True)
def embed(path):
photo = slab.Frame.open(path)
face = detector.run(slab.Input(frame=photo)).boxes(score_threshold=0.5, iou_threshold=0.4)[0]
out = recognizer.run(slab.Input(frame=photo, landmarks=face.landmarks)) # the pack aligns the face
out.normalize_l2()
return out
print(embed("a.jpg").cosine_similarity(embed("b.jpg"))) # near 1: same person
Device & backend compatibility
Pack default: macos / CPU. Exact on the CPU and nearly as fast as the Neural Engine (3.6 ms against 1.6 ms per face), with no 7-second preparation.
| Platform | Engine | Status | Precision |
|---|---|---|---|
| apple | CPU CPU | Supported Measured on macOS. The default. | f32 |
| apple | Metal GPU | Supported Measured on macOS. | f32 |
| apple | Apple Neural Engine NPU | Supported Measured on macOS. The Neural Engine computes in FP16. | f16 |
| android | CPU CPU | Supported Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. | f32 |
| android | Vulkan GPU | Supported Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. | f32 |
| android | Qualcomm Hexagon NPU (QNN) NPU | Not supported Tried on a Samsung Galaxy S23 Ultra (Hexagon v73): One of the model's nodes does not translate to QNN in Slab yet. | — |
Performance
Results depend on the device, runtime, and test conditions. Each measurement keeps its own context.
Mac with Apple M1 Max
Slab · CPU
macOS 26.6.2
3.4 ms
Measured time · scope below
Median of 100 warm runs of the model for one face (Slab's run time). Aligning the face from a 1920 x 1080 frame and running the model on the CPU takes 4.0 ms in all (3.6 ms for the model alone).
Mac with Apple M1 Max
Slab · GPU
macOS 26.6.2
5.0 ms
Measured time · scope below
Median of 100 warm runs of the model for one face (Slab's run time). Aligning the face from a 1920 x 1080 frame and running the model on the CPU takes 4.0 ms in all (3.6 ms for the model alone).
Mac with Apple M1 Max
Slab · NPU
macOS 26.6.2
1.6 ms
Measured time · scope below
Median of 100 warm runs of the model for one face (Slab's run time). Aligning the face from a 1920 x 1080 frame and running the model on the CPU takes 4.0 ms in all (3.6 ms for the model alone).
Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)
Slab · CPU
Android 17
10.0 ms
Measured time · scope below
Median of 100 warm runs of the model (Slab's run time). open_ms: opening the session. Peak memory (resident) after the runs: 55 MB.
Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)
Slab · GPU
Android 17
10.7 ms
Measured time · scope below
Median of 100 warm runs of the model (Slab's run time). open_ms: opening the session with the GPU programs already in the cache folder (the first open on a device compiles them, about 0.3 s more). Peak memory (resident) after the runs: 77 MB.
Accuracy checks
macos · CPU · int8
Faces and landmarks from InsightFace's SCRFD (det_10g on ONNX Runtime, score 0.5); reference embeddings from InsightFace's norm_crop (the same template as EdgeFace's alignment) and the upstream PyTorch model; 294 faces in 41 public-domain and CC0 photos (Wikimedia Commons). Scores are cosine similarities between Slab's and the reference embedding of the same face
With the pack's alignment from the photo and landmarks: 0.9978 on average, 0.9833 at worst. On identical aligned tensors: 0.99785 on average, 0.9833 at worst. For scale, the two most similar different faces in the set score 0.73.
macos · GPU · int8
Faces and landmarks from InsightFace's SCRFD (det_10g on ONNX Runtime, score 0.5); reference embeddings from InsightFace's norm_crop (the same template as EdgeFace's alignment) and the upstream PyTorch model; 294 faces in 41 public-domain and CC0 photos (Wikimedia Commons). Scores are cosine similarities between Slab's and the reference embedding of the same face
With the pack's alignment from the photo and landmarks: 0.9978 on average, 0.9833 at worst. On identical aligned tensors: 0.99785 on average, 0.9833 at worst. For scale, the two most similar different faces in the set score 0.73.
macos · NPU · int8
Faces and landmarks from InsightFace's SCRFD (det_10g on ONNX Runtime, score 0.5); reference embeddings from InsightFace's norm_crop (the same template as EdgeFace's alignment) and the upstream PyTorch model; 294 faces in 41 public-domain and CC0 photos (Wikimedia Commons). Scores are cosine similarities between Slab's and the reference embedding of the same face
With the pack's alignment from the photo and landmarks: 0.9955 on average, 0.9714 at worst. On identical aligned tensors: 0.99554 on average, 0.9717 at worst. For scale, the two most similar different faces in the set score 0.73.
Before you choose this model
- Non-commercial use only, and adaptations must be shared alike (CC BY-NC-SA 4.0).
- Needs the five landmarks of a face detector such as RetinaFace or SCRFD for good results.
- It does not detect spoofing: a printed photo or a screen gives the same embedding.
- Its similarities run higher than ArcFace's (different people reached 0.73 in our photos, against 0.58), so thresholds do not carry over between the two.
- On the Neural Engine it takes 7 s to prepare and its embeddings move more (0.997 on average). The model overflows plain FP16 arithmetic (PyTorch in FP16 gives unusable embeddings), so the CPU, which is exact and nearly as fast, is the default.
- Face embeddings are biometric data under laws such as the GDPR and Illinois' BIPA: get consent before storing them.