GitOrigin-RevId: 9295f8ea2339edb71073695ed4fb3fded2f48c60
8.8 KiB
layout | title | parent | nav_order |
---|---|---|---|
default | Pose | Solutions | 5 |
MediaPipe Pose
{: .no_toc }
- TOC {:toc}
Overview
Human pose estimation from video plays a critical role in various applications such as quantifying physical exercises, sign language recognition, and full-body gesture control. For example, it can form the basis for yoga, dance, and fitness applications. It can also enable the overlay of digital content and information on top of the physical world in augmented reality.
MediaPipe Pose is a ML solution for high-fidelity upper-body pose tracking, inferring 25 2D upper-body landmarks from RGB video frames utilizing our BlazePose research. Current state-of-the-art approaches rely primarily on powerful desktop environments for inference, whereas our method achieves real-time performance on most modern mobile phones, desktops/laptops, in python and even on the web. A variant of MediaPipe Pose that performs full-body pose tracking on mobile phones will be included in an upcoming release of ML Kit.
Fig 1. Example of MediaPipe Pose for upper-body pose tracking. |
ML Pipeline
The solution utilizes a two-step detector-tracker ML pipeline, proven to be effective in our MediaPipe Hands and MediaPipe Face Mesh solutions. Using a detector, the pipeline first locates the pose region-of-interest (ROI) within the frame. The tracker subsequently predicts the pose landmarks within the ROI using the ROI-cropped frame as input. Note that for video use cases the detector is invoked only as needed, i.e., for the very first frame and when the tracker could no longer identify body pose presence in the previous frame. For other frames the pipeline simply derives the ROI from the previous frame’s pose landmarks.
The pipeline is implemented as a MediaPipe graph that uses a pose landmark subgraph from the pose landmark module and renders using a dedicated upper-body pose renderer subgraph. The pose landmark subgraph internally uses a pose detection subgraph from the pose detection module.
Note: To visualize a graph, copy the graph and paste it into MediaPipe Visualizer. For more information on how to visualize its associated subgraphs, please see visualizer documentation.
Models
Pose Detection Model (BlazePose Detector)
The detector is inspired by our own lightweight BlazeFace model, used in MediaPipe Face Detection, as a proxy for a person detector. It explicitly predicts two additional virtual keypoints that firmly describe the human body center, rotation and scale as a circle. Inspired by Leonardo’s Vitruvian man, we predict the midpoint of a person's hips, the radius of a circle circumscribing the whole person, and the incline angle of the line connecting the shoulder and hip midpoints.
Fig 2. Vitruvian man aligned via two virtual keypoints predicted by BlazePose detector in addition to the face bounding box. |
Pose Landmark Model (BlazePose Tracker)
The landmark model currently included in MediaPipe Pose predicts the location of 25 upper-body landmarks (see figure below), with three degrees of freedom each (x, y location and visibility), plus two virtual alignment keypoints. It shares the same architecture as the full-body version that predicts 33 landmarks, described in more detail in the BlazePose Google AI Blog and in this paper.
Fig 3. 25 upper-body pose landmarks. |
Example Apps
Please first see general instructions for Android, iOS, desktop and Python on how to build MediaPipe examples.
Note: To visualize a graph, copy the graph and paste it into MediaPipe Visualizer. For more information on how to visualize its associated subgraphs, please see visualizer documentation.
Mobile
- Graph:
mediapipe/graphs/pose_tracking/upper_body_pose_tracking_gpu.pbtxt
- Android target:
(or download prebuilt ARM64 APK)
mediapipe/examples/android/src/java/com/google/mediapipe/apps/upperbodyposetrackinggpu:upperbodyposetrackinggpu
- iOS target:
mediapipe/examples/ios/upperbodyposetrackinggpu:UpperBodyPoseTrackingGpuApp
Desktop
Please first see general instructions for desktop on how to build MediaPipe examples.
- Running on CPU
- Running on GPU
Python
Please first see general instructions for Python examples.
(mp_env)$ python3
>>> import mediapipe as mp
>>> pose_tracker = mp.examples.UpperBodyPoseTracker()
# For image input
>>> pose_landmarks, _ = pose_tracker.run(input_file='/path/to/input/file', output_file='/path/to/output/file')
>>> pose_landmarks, annotated_image = pose_tracker.run(input_file='/path/to/file')
# For live camera input
# (Press Esc within the output image window to stop the run or let it self terminate after 30 seconds.)
>>> pose_tracker.run_live()
# Close the tracker.
>>> pose_tracker.close()
Web
Please refer to these instructions.
Resources
- Google AI Blog: BlazePose - On-device Real-time Body Pose Tracking
- Paper: BlazePose: On-device Real-time Body Pose Tracking (presentation)
- Pose detection model: TFLite model
- Upper-body pose landmark model: TFLite model
- Model card