Skip to content
imaged

Face detection

RetinaFace MobileNet-0.25

A tiny face detector (1.7 MB of weights) that finds faces and five landmarks on each: eyes, nose tip and mouth corners.

MIT (code and weights); training data non-commercialface detectionlandmarksretinafacemobilenetwiderfacesmall
Choose a variant

About this model

RetinaFace finds every face in a photo and marks five points on each one: both eyes, the tip of the nose and the corners of the mouth. This version uses a MobileNet-0.25 backbone with 0.43 million parameters, small enough for any phone.

The author of this PyTorch implementation reports WIDER FACE validation AP of 90.7 / 88.2 / 73.8 (easy / medium / hard) when the photo is used at its own size. Slab runs it on a fixed 640 x 640 letterbox, which is faster but misses more of the smallest faces.

What you can build

  • Count the people facing a camera
  • Crop or center faces for thumbnails and video calls
  • Align faces with the five landmarks before face recognition
  • Blur faces for privacy

People laughing

f16
Input
People laughing at a dinner (4563388022)

State Library and Archives of Florida, Public domain, https://commons.wikimedia.org/wiki/File:People_laughing_at_a_dinner_(4563388022).jpg

Output
The photo with 22 faces and their landmarks found by RetinaFace MobileNet-0.25
22 faces on the Apple Neural Engine (FP16 pack), score 0.5 or more, duplicates removed at IoU 0.4:
1.00 at [301, 246, 353, 312]
1.00 at [96, 269, 144, 331]
1.00 at [46, 97, 73, 131]
1.00 at [514, 287, 572, 362]
0.99 at [431, 130, 467, 173]
0.99 at [452, 54, 477, 86]
0.99 at [395, 89, 427, 130]
0.98 at [314, 113, 338, 143]
0.98 at [23, 64, 46, 93]
0.97 at [52, 46, 74, 76]
0.96 at [0, 138, 26, 179]
0.96 at [234, 136, 266, 179]
0.96 at [155, 46, 175, 73]
0.94 at [183, 29, 203, 56]
0.94 at [452, 8, 477, 41]
0.93 at [397, 14, 421, 45]
0.93 at [222, 7, 241, 32]
0.92 at [137, 13, 154, 35]
0.90 at [332, 48, 356, 78]
0.88 at [506, 14, 526, 39]
0.85 at [94, 74, 116, 101]
0.78 at [92, 22, 114, 50]

Students campus

f16
Input
Xhosa Students Association Students from UFS Bloemfontein Campus

Lusanda Madikane, CC0, https://commons.wikimedia.org/wiki/File:Xhosa_Students_Association_Students_from_UFS_Bloemfontein_Campus.jpg

Output
The photo with 19 faces and their landmarks found by RetinaFace MobileNet-0.25
19 faces on the Apple Neural Engine (FP16 pack), score 0.5 or more, duplicates removed at IoU 0.4:
0.98 at [269, 656, 294, 690]
0.92 at [570, 659, 588, 681]
0.90 at [808, 670, 828, 696]
0.89 at [234, 576, 255, 602]
0.85 at [201, 653, 225, 684]
0.85 at [433, 658, 455, 685]
0.80 at [298, 579, 315, 599]
0.78 at [38, 586, 58, 614]
0.77 at [346, 656, 368, 684]
0.77 at [632, 651, 653, 678]
0.75 at [773, 687, 793, 714]
0.74 at [728, 680, 748, 707]
0.73 at [495, 656, 519, 687]
0.70 at [691, 559, 709, 581]
0.69 at [159, 585, 178, 608]
0.68 at [460, 557, 477, 579]
0.67 at [71, 602, 90, 625]
0.59 at [554, 575, 572, 597]
0.53 at [597, 573, 613, 592]

Astronaut crew portrait

f16
Input
Portrait of ASTP crews - restoration

Adam Cuerden, Public domain, https://commons.wikimedia.org/wiki/File:Portrait_of_ASTP_crews_-_restoration.jpg

Output
The photo with 5 faces and their landmarks found by RetinaFace MobileNet-0.25
5 faces on the Apple Neural Engine (FP16 pack), score 0.5 or more, duplicates removed at IoU 0.4:
1.00 at [315, 143, 368, 213]
1.00 at [607, 175, 664, 250]
1.00 at [207, 342, 269, 425]
0.99 at [690, 322, 754, 405]
0.99 at [462, 321, 523, 399]

Variants & downloads

Choose the build for your app

Model files are hosted on Google Drive. Large files may open a confirmation page before downloading.

Small

Slab

Weights stored as int8 in blocks of 64. Slab decodes them to float when loading, so it runs at the same speed; boxes and landmarks move slightly more than with FP16 (see Accuracy).

Platforms: macos · android

retinaface-mobilenet-int8.slab

2.2 MB · Hosted download

Download
SHA-256 checksum
6171ead3909434f306f25351fea617fd1c2c50f2100128a2b466a39db08d540a

LICENSE-Pytorch_Retinaface.txt

1 KB

Download
SHA-256 checksum
41034e3430e3b7fd63031bcc6f9dd9740fa910328f3168208ca032807f026147
Conversion details
command
git clone https://github.com/biubug6/Pytorch_Retinaface && cd Pytorch_Retinaface && git checkout b984b4b775b2c4dced95c1eadd195a5c7d32a60b gdown --folder https://drive.google.com/drive/folders/1oZRSG0ZegbVkVwUd8wUIQx8W7yfZ_ki1 -O weights # the README's Google Drive folder (pip install gdown) python -c "import torch; from data import cfg_mnet; from models.retinaface import RetinaFace; net = RetinaFace(cfg=dict(cfg_mnet, pretrain=False), phase='test'); sd = torch.load('weights/mobilenet0.25_Final.pth', map_location='cpu', weights_only=True); net.load_state_dict({k[7:] if k.startswith('module.') else k: v for k, v in sd.items()}); torch.onnx.export(net.eval(), torch.randn(1, 3, 640, 640), 'model.onnx', input_names=['input'], output_names=['loc', 'conf', 'landms'], opset_version=17, dynamo=False)" echo face > labels.txt slab-load convert model.onnx model.slab --input input=1x3x640x640 --meta task=detect --meta resize=letterbox --meta color=bgr --meta normalize=raw255 --meta mean:f32=104,117,123 --meta decode=retinaface --meta labels:labels=@labels.txt slab-load quantize model.slab retinaface-mobilenet-int8.slab slab-load meta set retinaface-mobilenet-int8.slab default_backend.macos=npu

Integration examples

Python

python

import slab

cfg = slab.Config(cache_dir="/tmp/slab_cache", license=open("license.slablic.txt").read())
session = slab.Session(cfg, "retinaface-mobilenet-f16.slab", warmup=True)
out = session.run(slab.Input(frame=slab.Frame.open("photo.jpg")))
for b in out.boxes(score_threshold=0.5, iou_threshold=0.4):
    print(round(b.score, 2), b.x1, b.y1, b.x2, b.y2, b.landmarks)

Device & backend compatibility

Pack default: macos / NPU. Fastest on the Mac (about 2 ms per frame) with the same faces as the CPU.

Available execution backends for RetinaFace MobileNet-0.25
PlatformEngineStatusPrecision
apple

CPU

CPU

Supported

Measured on macOS.

f32
apple

Metal

GPU

Supported

Measured on macOS.

f32
apple

Apple Neural Engine

NPU

Supported

Measured on macOS. The default. 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

Supported

Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17. The NPU computes in FP16 (the int8 pack's weights are widened to FP16).

f16

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

14.7 ms

Measured time · scope below

int8Session open (ms): 10 Platform: macos Runs: 100 Input: 1, 3, 640, 640 Measured: 2026-10-28

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, letterboxing included: 15.77 ms median.

Mac with Apple M1 Max

Slab · GPU

macOS 26.6.2

2.5 ms

Measured time · scope below

int8Session open (ms): 9 Platform: macos Runs: 100 Input: 1, 3, 640, 640 Measured: 2026-10-28

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, letterboxing included: 5.44 ms median.

Mac with Apple M1 Max

Slab · NPU

macOS 26.6.2

2.0 ms

Measured time · scope below

int8Session open (ms): 617 Platform: macos Runs: 100 Input: 1, 3, 640, 640 Measured: 2026-10-28

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, letterboxing included: 3.90 ms median.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · CPU

Android 17

44.1 ms

Measured time · scope below

int8Session open (ms): 19 Platform: android Runs: 100 Input: 1, 3, 640, 640 Measured: 2026-11-06

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, letterboxing and decoding boxes included: 42.5 ms median. open_ms: opening the session. Peak memory (resident) after the runs: 93 MB.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · GPU

Android 17

18.4 ms

Measured time · scope below

int8Session open (ms): 62 Platform: android Runs: 100 Input: 1, 3, 640, 640 Measured: 2026-11-06

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, letterboxing and decoding boxes included: 25.3 ms median. 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: 81 MB.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · NPU

Android 17

6.7 ms

Measured time · scope below

int8Session open (ms): 266 Platform: android Runs: 100 Input: 1, 3, 640, 640 Measured: 2026-11-06

Median of 100 warm runs of the model (Slab's run time). From a 1920 x 1080 photo, preprocessing on the CPU included: 15.0 ms median. open_ms: opening the session, including preparing the model for the Hexagon NPU. Peak memory (resident) after the runs: 68 MB.

Accuracy checks

macos · CPU · int8

The upstream PyTorch network with the upstream prior-box decoding and NMS (score 0.5, NMS IoU 0.4), on the same 640 x 640 letterbox, 41 public-domain and CC0 photos with faces (Wikimedia Commons); a face matches with IoU 0.5 or more; landmark error is the mean distance of the five points as a share of the face box's diagonal

With Slab preprocessing and decoding: 228 of 228 faces matched (mean IoU 0.992), 0 extra, landmark error 0.19%. On identical input tensors, decoded by the upstream code: 228 of 228 matched (mean IoU 0.992), 0 extra, landmark error 0.19%, largest score difference 0.021.

macos · GPU · int8

The upstream PyTorch network with the upstream prior-box decoding and NMS (score 0.5, NMS IoU 0.4), on the same 640 x 640 letterbox, 41 public-domain and CC0 photos with faces (Wikimedia Commons); a face matches with IoU 0.5 or more; landmark error is the mean distance of the five points as a share of the face box's diagonal

With Slab preprocessing and decoding: 228 of 228 faces matched (mean IoU 0.992), 0 extra, landmark error 0.19%. On identical input tensors, decoded by the upstream code: 228 of 228 matched (mean IoU 0.992), 0 extra, landmark error 0.19%, largest score difference 0.021.

macos · NPU · int8

The upstream PyTorch network with the upstream prior-box decoding and NMS (score 0.5, NMS IoU 0.4), on the same 640 x 640 letterbox, 41 public-domain and CC0 photos with faces (Wikimedia Commons); a face matches with IoU 0.5 or more; landmark error is the mean distance of the five points as a share of the face box's diagonal

With Slab preprocessing and decoding: 228 of 228 faces matched (mean IoU 0.990), 0 extra, landmark error 0.22%. On identical input tensors, decoded by the upstream code: 228 of 228 matched (mean IoU 0.990), 0 extra, landmark error 0.22%, largest score difference 0.024.

android · NPU · int8

Slab's CPU engine (FP32) on the same 1920 x 1080 photo

Cosine similarity of the output with the CPU's: 0.99995.

Before you choose this model

  • Finds faces only; it does not tell who a person is.
  • At 640 x 640, faces smaller than about 16 pixels in the letterboxed image are often missed (crowds in large photos).
  • Faces in profile, heavily covered or in very dark scenes score lower.
  • The training data's terms restrict commercial use (see License).