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.7 ms per tracked frame on Apple Silicon, ~5× 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.7 ms 1.9 ms
mediapipe (XNNPACK CPU) 3.3 ms 8.7 ms

Landmarks agree with MediaPipe to ~1e-3 (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.1.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.1.0-py3-none-any.whl (5.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasthands-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 5295366a2c8fc5b9b5307a483c345231a6fd1fca5497ec3ebd8047e63a8992cd
MD5 7524e9fb64cbc9e555b04d50ae472b9f
BLAKE2b-256 2e36e1f59662029263e81d3716a7265004240539c10062942a75ce84c4a73d28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasthands-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1291074c89d4ed37ccfe08cacca49b78765dcab9793926bceaed1c37886a43cd
MD5 d666e5e50022a3f9f3077c1501069be7
BLAKE2b-256 56c06ce8915ea5fb1520605bf0059013761ecf4b62aedd298076ed185881b5a1

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