MediaPipe Face Landmarker (fastforks)
MediaPipe Face Landmarker (Google, face_landmarker.task): the two-stage face mesh of the MediaPipe Tasks API. BlazeFace (short range, 128 x 128 input, SSD anchors on the stride 8 / 16 maps, weighted NMS) finds the faces with six keypoints; each face is cropped 1.5x its longer side and rotated so the eyes are level; the face-mesh network (256 x 256 crop) returns 468 face landmarks, 10 iris landmarks and a face-presence score. The portable runner reads the bundle's two TFLite graphs and runs them as plain torch operators (no TFLite runtime, ONNX-exportable module()); detection, rotated crops and projection follow the Tasks graphs. Landmarks are returned in input pixels (x, y; the network's relative depth is dropped, blendshapes and the facial transform matrix are not part of this port).
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/google-ai-edge/mediapipe at cad7f3ab99eb.
Task: pose. Tier: stable. Outputs: keypoints, keypoint_scores, boxes, scores. Backends: portable.
Input: one RGB image and a box per person. Output: keypoints with confidence scores for every person.
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
mediapipe-face-landmarker@1 |
face_landmarker.task | 64184e229b26 |
Apache-2.0 | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.
Training data: Google's own training images (BlazeFace: about 66k geographically diverse photos; face mesh: about 30k mobile-camera photos plus synthetic renders; model cards); not a public dataset.
Licence evidence: https://github.com/google-ai-edge/mediapipe/blob/cad7f3ab99ebf175947e40c5252c642612aae927/LICENSE
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): mediapipe-face-landmarker 3000x4000 (0.4 GiB peak allocated, 0.4 reserved)
Speed and memory
Pose, face photo (mediapipe-assets portrait.jpg), 1080x1920
| model | time (ms): original | portable | peak memory (MiB, allocated / reserved): portable |
|---|---|---|---|
mediapipe-face-landmarker |
7.86 | 3.04 | 35 / 98 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
mediapipe-face-landmarker |
0.04 | 0.35 | β | 0.01 | 0.00 | β |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT (fp16 unless shown) | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
mediapipe-face-landmarker |
256x256 | 3.00 ms | 2.54 ms | fails: unsupported: the ONNX export traces the 128x128 net input to | β | 12.4 s | β | 28 / 74 | 38 / 94 | β | β |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | portable | portable fp32 | note |
|---|---|---|---|---|---|
mediapipe-face-landmarker |
LaPa test (2000 faces), six eye / mouth corners, error / outer eye-corner distance %, faces found % | 2.353 / 98.5 | 2.371 / 98.5 | 2.375 / 98.5 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c774f5fe, 2026-11-30.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 and p99 <= 0.15 (absolute error of the output keypoints).
Limitations
- module() is the landmark network on crops (landmarks in crop pixels and the presence probability); detection, crops and projection stay outside the exported graph.
- x, y only: the relative z, the 52 blendshape scores and the facial transformation matrix of the Tasks API are not returned.
- Short-range detector: faces smaller than about 1/10 of the image side are missed, and the input is one image per call (batch 1).
Usage
from fastforks import pose
model = pose.load("mediapipe-face-landmarker") # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg", boxes=[[x0, y0, x1, y1]]) # one box per person, or a fastforks.detection result
result.keypoints, result.keypoint_scores # [P, K, 2] input pixels, [P, K]
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: mediapipe-face-landmarker.
Kernels backend
No kernels backend: Not needed: two small depthwise-separable graphs (128 px detector, 256 px mesh) run as CUDA graphs in the portable path. RTX 5060 Ti, 512 px image with one face: 5.5 ms per call, of which the detector net is 0.3 ms and the mesh net 1.0 ms; the rest is host-side pre- and post-processing. To be 10 % faster, a kernel build would need to cut the network time by over 40 %, and its convolutions already take 1 to 3 us each..