{"id":24810866,"url":"https://github.com/vidursatija/blazepalm","last_synced_at":"2025-10-13T12:31:26.262Z","repository":{"id":43780460,"uuid":"329271196","full_name":"vidursatija/BlazePalm","owner":"vidursatija","description":"PyTorch \u0026 CoreML implementation of MediaPipe Hands","archived":false,"fork":false,"pushed_at":"2021-02-01T12:09:58.000Z","size":26367,"stargazers_count":81,"open_issues_count":8,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T10:12:55.269Z","etag":null,"topics":["computer-vision","coreml","google","machine-learning","pytorch","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vidursatija.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-13T10:25:35.000Z","updated_at":"2025-01-27T12:03:15.000Z","dependencies_parsed_at":"2022-08-12T10:42:21.726Z","dependency_job_id":null,"html_url":"https://github.com/vidursatija/BlazePalm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vidursatija/BlazePalm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vidursatija%2FBlazePalm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vidursatija%2FBlazePalm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vidursatija%2FBlazePalm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vidursatija%2FBlazePalm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vidursatija","download_url":"https://codeload.github.com/vidursatija/BlazePalm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vidursatija%2FBlazePalm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015056,"owners_count":26085643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","coreml","google","machine-learning","pytorch","tensorflow"],"created_at":"2025-01-30T12:18:24.748Z","updated_at":"2025-10-13T12:31:21.716Z","avatar_url":"https://github.com/vidursatija.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlazePalm\n\nBlazePalm is a fast, light-weight 2-part hand landmark detector from Google Research. [Read more](https://google.github.io/mediapipe/solutions/hands.html), [Paper on arXiv](https://arxiv.org/abs/2006.10214)\n\nA pretrained model is available as part of Google's [MediaPipe](https://github.com/google/mediapipe/blob/master/mediapipe/docs/hand_tracking_mobile_gpu.md) framework.\n\n![](https://google.github.io/mediapipe/images/mobile/hand_tracking_3d_android_gpu.gif)\n\nBesides a bounding box, BlazePalm also predicts 21 3D keypoints for hand landmarks (5 fingers x 4 keypoints + 1 wrist)\n\nBecause BlazePalm is designed for use on mobile devices, the pretrained model is in TFLite format. However, I wanted to use it in **PyTorch** and not *TensorFlow*. I also ported the PyTorch model to **CoreML** because the model is made for phones.\n\nThere are 2 parts to the model:\n1. Hand detector. It is a classic single shot detector(SSD).\n2. Landmark detector. After getting the hands from the hand detector, we crop them and pass them through the landmark detector to get the 3D landmarks.\n\n## Inside this repo\n\nEssential ML files:\n\n- **ML/blazepalm.py**: defines the `PalmDetector` class that finds the bounding box for the hands in an image.\n\n- **ML/palmdetector.pth**: the weights for the trained model for `PalmDetector`\n\n- **ML/genanchors.py**: creates anchor boxes and saves them as a binary file (ML/anchors.npy)\n\n- **ML/anchors.npy**: lookup table with anchor boxes for `PalmDetector`\n\n- **ML/export_detector.py**: For converting the PyTorch model of  `PalmDetector` to CoreML.\n\n- **ML/handlandmarks.py**: defines the `HandLandmarks` class that finds the 3D landmarks for a hand.\n\n- **ML/HandLandmarks.pth**: the weights for the trained model for `HandLandmarks`\n\n- **ML/export_landmarks.py**: For converting the PyTorch model of `HandLandmarks` to CoreML.\n\nML Notebooks:\n\n- **ML/ConvertPalmDetector.ipynb**: loads the weights from the TFLite model of `PalmDetector` and converts them to PyTorch format (ML/palmdetector.pth)\n\n- **ML/ConvertHandDetector.ipynb**: loads the weights from the TFLite model of `HandLandmarks` and converts them to PyTorch format (ML/HandLandmarks.pth)\n\niOS CoreML App\n\n- **App/**\n\n## Detections\n\n### CoreML\n\nEach hand detection has 2 SIMD2 vectors(bounding box) and 1 Float number(confidence):\n\n- The first 4 numbers describe the bounding box corners: \n    - `xmin, ymin, xmax, ymax`\n\n- These are normalized coordinates (between 0 and 1).\n\n- SIMD2 is used for faster vector math.\n\n- The final number is the confidence score that this detection really is a hand.\n\n\nEach landmark detection has 21 SIMD3 vectors(landmarks) and 1 Float number(confidence):\n![](https://google.github.io/mediapipe/images/mobile/hand_landmarks.png)\n\n- These are normalized coordinates (between 0 and 1).\n\n- SIMD3 is used for faster vector math.\n\n- The final number is the confidence score that this detection really is a hand.\n\n### PyTorch\n\nEach hand detection has 4 Floats(bounding box) and 1 Float number(confidence) as defined in the CoreML section.\nEach landmark detection has 21 Floats(landmarks) and 1 Float number(confidence) as defined in the CoreML section.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvidursatija%2Fblazepalm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvidursatija%2Fblazepalm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvidursatija%2Fblazepalm/lists"}