Models · Pose estimation

MediaPipe Face Landmarker

MediaPipe Face Landmarker (Google, face_landmarker.task): finds faces and places 478 landmarks on each (face contour, eyes, lips, brows and both irises). BlazeFace detector plus a face-mesh network from the MediaPipe Tasks bundle. Apache-2.0 code and weights.

stable Fork of google-ai-edge/mediapipe@cad7f3a · backends: portable

Checkpoint mediapipe-face-landmarker

Paper 2019 Added in 0.4.0 Evaluated with 0.4.0

Portable, RTX 5060 Ti 16 GB 3.04 ms 1080x1920, fp16
vs the faster original 2.6× original float16 weights (CPU XNNPACK): 7.86 ms
Peak memory 35 MiB original not measured
Accuracy vs original fp32 +0.018 portable nme, LaPa test (2000 faces) (2.353 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import pose

model = pose.load("mediapipe-face-landmarker")  # fastest backend that runs here
result = model("photo.jpg", boxes=[[100, 50, 400, 700]])  # person boxes (x0, y0, x1, y1)

# result fields: keypoints, keypoint_scores, boxes, scores
keypoints = result.keypoints  # a torch tensor
arrays = result.numpy()  # the tensor fields as NumPy arrays: arrays["keypoints"]
result.backend  # what ran: mode, device, dtype
Other ways to run it
  • Precision: pose.load("mediapipe-face-landmarker", dtype="float32") # full precision: slower, portable only
  • Options: pose.load("mediapipe-face-landmarker", options={"score_threshold": 0.5, "presence_threshold": 0.5})
fastforks bench mediapipe-face-landmarker

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32not measured ––––
Original (own default)CPU run on all 16 cores of the host (the GPU is unused): memory columns are the process peak RSS above the idle process, not GPU memoryfloat16 weights (CPU XNNPACK) 7.86––0.00.01
Portable fp32fp32not measured ––––
Portablefp16 3.042.6×35 MiB/98 MiB0.30.00
Kernelsnot measured ––––
Portable + torch.compilenot measured here ––––
TensorRTnot measured here ––––

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-28. Median of 10 after 3 warm-up, uint8 CUDA image, detector + mesh per call (CUDA graphs), peak = max over the timed calls. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

Not measured on other devices yet.

Licence and weights

Commercial use allowed

Code
Apache-2.0 LICENSE
Weights
Apache-2.0 source
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

Our reading of the licences, not legal advice.

Weights

face_landmarker.task 3.8 MB· hosted on Google Drive

fastforks downloads and checks these files on first use (fastforks download mediapipe-face-landmarker).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

LaPa test (2000 faces)

six eye / mouth corners, error / outer eye-corner distance %, faces found %

Rundtypenme ↑found ↑Δ nme vs fp32 originalfacesms / face
Original fp32float16 weights2.35398.5 reference 2000 8.58
Original fp16not measured
Portable fp32fp322.37598.5 +0.022 2000 3.50
Portablefp162.37198.5 +0.018 2000 3.38
Kernelsnot measured

Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: CPU (XNNPACK), torch null, 2026-11-30; portable fp32, portable: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c774f5fe, 2026-11-30.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.05 not recorded
GPU default dtypes, mean |diff|≤ 0.05 not recorded
GPU default dtypes, p99 |diff|≤ 0.15 not recorded

No GPU comparison recorded for mediapipe-face-landmarker.

Details

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).

Input / output
Input: one RGB image and a box per person. Output: keypoints with confidence scores for every person.
Input size
any H x W >= 32, padded to a multiple of 32; tested up to 3000x4000 (417 MiB allocated)
Options
  • score_threshold=0.50.0 to 1.0· changes the output
  • presence_threshold=0.50.0 to 1.0· changes the output
Outputs
keypoints, keypoint_scores, boxes, scores
CUDA kernels
none: 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.

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).
Full reference, generated from the repository

MediaPipe Face Landmarker (Google, face_landmarker.task): finds faces and places 478 landmarks on each (face contour, eyes, lips, brows and both irises). BlazeFace detector plus a face-mesh network from the MediaPipe Tasks bundle. Apache-2.0 code and weights.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
mediapipe-face-landmarkerface photo (mediapipe-assets portrait.jpg) (1080x1920)original
portable
kernels
7.86
3.04
no kernels
–
35 / 98
no kernels
mediapipe-face-landmarkerface photo (mediapipe-assets portrait.jpg) (256x256)original
portable
kernels
portable + torch.compile
TensorRT fp16
7.60
3.00
no kernels
2.54
fails: unsupported: the ONNX export traces the 128x128 net input to
–
28 / 74
no kernels
38 / 94
–
Details
  • Original code: https://github.com/google-ai-edge/mediapipe at cad7f3ab99eb
  • Code licence: Apache-2.0 (permissive); files: LICENSE
  • Weights licence: Apache-2.0
  • Licence evidence: https://github.com/google-ai-edge/mediapipe/blob/cad7f3ab99ebf175947e40c5252c642612aae927/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
  • Options: score_threshold = 0.5 (0.0 to 1.0), presence_threshold = 0.5 (0.0 to 1.0)
  • Kernel libraries: none (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.)
  • Variants: mediapipe-face-landmarker
  • Outputs: keypoints, keypoint_scores, boxes, scores; label_set: face-478
  • 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)
  • no kernels: 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.
  • mediapipe-face-landmarker 256x256, first call: portable + torch.compile 12 s (cold Inductor cache).
  • mediapipe-face-landmarker original 1080x1920, original 256x256: CPU run on all 16 cores of the host (the GPU is unused): memory columns are the process peak RSS above the idle process, not GPU memory
  • mediapipe-face-landmarker load / first call: original 0.04 s / 0.008 s, portable 0.35 s / 0.003 s
  • Protocol, median of 10 after 3 warm-up, uint8 CUDA image, detector + mesh per call (CUDA graphs), peak = max over the timed calls

Measured

Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32portableportable fp32note
mediapipe-face-landmarkerLaPa test (2000 faces), six eye / mouth corners, error / outer eye-corner distance %, faces found %2.353 / 98.52.371 / 98.52.375 / 98.5

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c774f5fe, 2026-11-30.

Parity

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).

variantkernels error vs original, mean / p99GPU, torchkernels used
mediapipe-face-landmarkerno kernels backend--

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).

Example output

No example rendered for this checkpoint yet.