Skip to main content

Fastest MediaPipe-compatible hand tracker: hand landmarks on the Apple Neural Engine at 0.7 ms/frame

Project description

fasthands

The fastest MediaPipe-compatible hand tracker. MediaPipe Hands' official models running on the Apple Neural Engine via CoreML — 0.55 ms per tracked frame on Apple Silicon (1800 FPS), ~6× faster than MediaPipe itself, with a faithful port of the full HandLandmarker pipeline (SSD anchors, weighted NMS, ROI tracking, landmark projection, deduplication).

macOS / Apple Silicon only.

Install

pip install fasthands

Use

import cv2
import fasthands

tracker = fasthands.load(num_hands=1)

image = cv2.cvtColor(cv2.imread("hand.jpg"), cv2.COLOR_BGR2RGB)
hands = tracker(image)                 # single image
# hands = tracker.detect_video(frame)  # video: tracks between frames, ~0.7 ms

for hand in hands:
    print(hand["handedness"], hand["score"])
    print(hand["landmarks"])        # 21 x (x, y, z), normalized image coords
    print(hand["world_landmarks"])  # 21 x (x, y, z), meters, hand-centered

Or from the command line:

fasthands photo.jpg --out annotated.jpg
fasthands-webcam --mirror     # live demo with FPS overlay

Speed (Apple M4, 540×720 frame, one hand)

tracking detect + track
fasthands (ANE) 0.55 ms (1800 FPS) 1.65 ms (600 FPS)
mediapipe (XNNPACK CPU) 3.25 ms (310 FPS) 8.77 ms (115 FPS)
5.9× faster 5.3× faster

Landmarks agree with MediaPipe to ~9e-4 (Neural Engine fp16); the pipeline logic itself is verified to MediaPipe's own float32 reproducibility floor.

How

The hand_landmarker.task models are converted to CoreML, and every MediaPipe calculator in the pipeline (anchors, decode, weighted NMS, rect transforms, rotated crops, projections, VIDEO-mode ROI tracking, dedup) is reimplemented in numpy with float32 op-order fidelity. Model weights © Google, Apache 2.0.

Source, the PyTorch reference implementation, and the full verification harness: https://github.com/VimalMollyn/fasthands

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fasthands-0.2.0.tar.gz (5.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fasthands-0.2.0-py3-none-any.whl (5.8 MB view details)

Uploaded Python 3

File details

Details for the file fasthands-0.2.0.tar.gz.

File metadata

  • Download URL: fasthands-0.2.0.tar.gz
  • Upload date:
  • Size: 5.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fasthands-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f2d00ba8ed43dc1197ef978a4c10c9ec1cc5d0488990423970e16164800827a3
MD5 47f46f67cc3ac169284a70a5403300de
BLAKE2b-256 81248e9d9c88f3ba7b32f6454e5212911c4e96bfb6b55e95d3f44b3034461e06

See more details on using hashes here.

File details

Details for the file fasthands-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fasthands-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fasthands-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21ee03fa6ba43fa87b39749aa23621ad84a5e6b5e01c51a7fad27c152ab4dfd0
MD5 dae77e73afeb63ef55057c1672ef8d79
BLAKE2b-256 707303a3331e51f84ebc3556909345ce1f80344ce0fcbbab30c02cb61db9b41a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page