Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lifting Pose Estimation

A robust tool for analyzing weightlifting form (Squat, Deadlift) using computer vision. It uses MoveNet Thunder for high-accuracy tracking and Adaptive Geometry to correct for camera angles.

Features

  • High-Stability Tracking: Uses Google's MoveNet Thunder model (optimized for fitness) + Kalman Filtering to track limbs smoothly even during occlusions.
  • Adaptive View Detection: Automatically detects if the video is Front, Side, or Oblique (e.g., 10 o'clock view).
  • Perspective Correction: Mathematically "un-rotates" oblique views to provide accurate angles (e.g., true Squat Depth) regardless of camera placement.
  • Physics-Based Smoothing: Uses velocity tracking to predict limb positions when they disappear behind weights.
  • Phase Detection: Automatically identifies the Eccentric (down) and Concentric (up) phases of the lift.

Installation

  1. Clone the repo.
  2. Install dependencies:
    pip install opencv-python numpy mediapipe tensorflow tensorflow-hub

Usage

1. Robust Analysis (Recommended)

Use the new MoveNet-based script for the most stable results and angle correction.

python src/pose_infer_movenet.py --video path/to/video.mp4 \
  --out_overlay outputs/overlay.mp4 \
  --out_json outputs/data.json

Auto-Calibration Note: The system attempts to learn your body proportions to detect the camera angle. This requires the video to contain at least a few frames where you are facing the camera (e.g., at the start or end).

Manual Override: If your video is only from the side/oblique (no front view), you must specify the angle manually to avoid distortion:

# For a "10 o'clock" view (approx 60 degrees)
python src/pose_infer_movenet.py --video path/to/video.mp4 --yaw 60
  • 0: Front View
  • 90: Side View

2. Legacy 3D Analysis (MediaPipe)

If you specifically need 3D world coordinates (X,Y,Z), you can use the older MediaPipe script. Note that this is less stable during occlusions.

python src/pose_infer_3d.py --video path/to/video.mp4

Output

The tool generates:

  1. Overlay Video: Visualizes the corrected skeleton, joint angles, and lift phase.
  2. JSON Data: Contains frame-by-frame keypoints (raw and corrected) and angle data for further analysis.

How it Works

  1. Inference: MoveNet detects 17 keypoints.
  2. Kalman Filter: Predicts motion to smooth out jitter.
  3. Geometry Engine:
    • Measures shoulder width to estimate body rotation.
    • Projects points onto the ideal analysis plane (Sagittal for depth, Frontal for knees).
  4. Angle Engine: Calculates biomechanical angles (Hip Flexion, Knee Valgus, etc.).

About

Project that takes in videos of people performing specific weight lifts and performs pose estimation on them. It then calculates a variety of metrics from the joint angles.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages