MediaPipe Hand Landmarker (fastforks)
MediaPipe Hand Landmarker (Google, hand_landmarker.task): the two-stage hand tracker of the MediaPipe Tasks API. The palm detector (192 x 192 input, SSD anchors on the stride 8 / 16 maps, weighted NMS) finds palms with seven keypoints; each palm is cropped 2.6x its longer side, shifted towards the fingers and rotated by the wrist-to-middle-finger direction; the landmark network (224 x 224 crop) returns 21 hand landmarks and a hand-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 relative depth, world landmarks and handedness 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-hand-landmarker@1 |
hand_landmarker.task | fbc2a30080c3 |
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 (about 30k real-world photos annotated with 21 landmarks plus synthetic hand renders; model card); 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-hand-landmarker 3000x4000 (0.4 GiB peak allocated, 0.4 reserved)
Speed and memory
Pose, hand photo (mediapipe-assets woman_hands.jpg, 1080x1920
| model | time (ms): original | portable | peak memory (MiB, allocated / reserved): portable |
|---|---|---|---|
mediapipe-hand-landmarker |
27.8 | 3.10 | 106 / 180 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
mediapipe-hand-landmarker |
0.04 | 0.43 | β | 0.03 | 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-hand-landmarker |
640x960 | 3.07 ms | 1.18 ms | fails: unsupported: torch.export of the generic tflite executor fai | β | 8.55 s | β | 107 / 156 | 50 / 134 | β | β |
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-hand-landmarker |
COCO-WholeBody val2017 hands of at least 64 px, whole image in, error / box size %, keypoints within 10 % %, hands found % | 13.98 / 63.3 / 65.9 | 13.60 / 63.4 / 66.5 | 13.59 / 63.5 / 66.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.2 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.08 and p99 <= 0.3 (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 metric world landmarks and the left / right handedness of the Tasks API are not returned.
- One image per call (batch 1) and no tracking: every call runs the palm detector (the Tasks VIDEO mode reuses the previous frame's hands).
Usage
from fastforks import pose
model = pose.load("mediapipe-hand-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-hand-landmarker.
Kernels backend
No kernels backend: Not needed: two small depthwise-separable graphs (192 px palm detector, 224 px landmark net) run as CUDA graphs in the portable path. RTX 5060 Ti, 960 x 640 image with two hands: 5.5 ms per call, of which the palm net is 0.7 ms and the landmark net 0.7 ms for both hands; the rest is host-side pre- and post-processing. To be 10 % faster, a kernel build would need to cut the network time by about 40 %, and its kernels already take 1 to 10 us each..