Day 57: MediaPipe Pose: keypoints, landmarks, confidence
MediaPipe: production pose on the CPU
MediaPipe Pose is Google's fast, CPU-friendly pose estimator — 33 body landmarks per person, each with normalized x/y (and a relative z, plus a visibility score). It runs in real time without a GPU, which is exactly why the roadmap puts it in FitXpert's production path: the measurement step stays on the ₹0 CPU droplet.
import mediapipe as mp
import cv2
mp_pose = mp.solutions.pose
pose = mp_pose.Pose(static_image_mode=True, model_complexity=2)
img = cv2.cvtColor(cv2.imread("customer.jpg"), cv2.COLOR_BGR2RGB)
result = pose.process(img)
if result.pose_landmarks:
lm = result.pose_landmarks.landmark
left_shoulder = lm[mp_pose.PoseLandmark.LEFT_SHOULDER]
# normalized 0-1 coords + visibility (occlusion confidence)
print(left_shoulder.x, left_shoulder.y, left_shoulder.visibility)Visibility is your reliability signal
Each landmark carries a visibility score — low when the joint is occluded or out of frame. Trusting a low-visibility keypoint's position is how you get a nonsense measurement. Downstream (Day 59), you'll gate measurements on visibility and fold it into the final confidence number — honest uncertainty rather than a confident wrong answer.
Key terms
- MediaPipe Pose
- Google's fast, CPU-capable pose estimator producing 33 body landmarks per person.
- Landmark
- A predicted body point with normalized x/y (and relative z) coordinates.
- Visibility score
- A per-landmark confidence indicating how likely the joint is visible (not occluded/out of frame).
A landmark returns a low visibility score. What is the correct way to handle it?