AI-Powered Exercise Form Correction
Real-time workout analysis using pose estimation and neural networks
An intelligent system that analyzes workout videos, identifies exercise types, and provides corrective feedback by comparing user form against expert references through joint angle analysis.
GymbrAIn processes workout videos to:
- ✅ Classify exercises - Bench press, lat pulldown, barbell biceps curl, tricep pushdown
- 🦴 Extract skeletal data - 17 keypoints per frame for pose tracking
- 📊 Compare form - User execution vs. expert references
- 🔍 Analyze angles - Calculate joint angle differences and flag errors
Performance: 80% classification accuracy using GRU with self-attention mechanisms
- YOLOv8 Pose - 17 keypoints per frame for skeletal tracking
- OpenCV preprocessing - Gaussian blur + sharpening kernels
- Camera calibration - Zhang's method for 2D→3D joint angles
- Keras/TensorFlow - GRU with self-attention layers
- Temporal sequence classification - 256 neurons, 0.25 dropout
- Reference retrieval - Normalized pose embeddings via L2 norm
- MoviePy - Clip extraction and frame sampling
- Velocity minima detection - L2 norm calculations for rep boundaries
|
Core ML/CV Stack |
Video & Data Processing |
.
├── camera_coeffs/ # Camera calibration matrices per exercise
├── videoTest/ # User workout videos for testing
├── videoLuca/ # Reference execution videos
│ ├── frames/ # Pre-extracted reference frames
│ └── video_720/ # 720p reference videos
├── deep_learning.py # Pose estimation & classification
├── geometry.py # Angle calculation & calibration
├── main.py # Main execution pipeline
├── utils.py # Helper functions & visualization
├── video_processing.py # Video preprocessing
├── poses5.json # Pre-computed pose data
├── poses_finale.json # Normalized pose embeddings
└── model_att.keras # Trained GRU model (not in repo)
| Directory | Purpose |
|---|---|
camera_coeffs/ |
Calibration coefficients (camera matrix & distortion) for each exercise setup |
videoLuca/ |
Expert reference videos and extracted frames for form comparison |
graph LR
A[Input Video] --> B[Preprocessing]
B --> C[Pose Estimation]
C --> D[Exercise Classification]
D --> E[Form Analysis]
E --> F[Feedback]
-
Preprocessing (
video_processing.py)
Extract 5-second clip → Gaussian blur → Sharpening -
Pose Estimation (
deep_learning.py)
YOLOv8 extracts 17 keypoints from 30 frames -
Classification (
deep_learning.py)
GRU network with self-attention identifies exercise type -
Form Analysis (
geometry.py)
Find rep boundaries → Retrieve reference → Calculate 3D angles → Compare -
Feedback (
utils.py)
Display angle differences and visual comparison
| Component | Configuration |
|---|---|
| Hidden Layers | 256 neurons |
| Dropout Rate | 0.25 |
| Attention | Self-attention mechanisms |
| Output | 4-class softmax |
| Accuracy | 80% on test set |
📄 Training details and accuracy plots: Report_GymbrAIn.pdf
This project was developed by students at the University of Modena and Reggio Emilia as an academic exam project. The implementation builds on prior research comparing GRU, LSTM, and feedforward networks for fitness pose classification, with architectural improvements focusing on self-attention and optimized regularization.
Authors: Casali Cristian, Flotta Aldo, Lamberti Francesco
📚 Full Documentation:
Report_GymbrAIn.pdf- Technical reportppt_GymbrAIn.pdf- Presentation slides
- 🔧 Manual camera calibration required
- 📊 80% classification accuracy (room for improvement)
- 🏋️ Limited to 4 exercise types
- 📹 Dataset size constraints (400 videos total)
See Section 6.2 of the report for future improvements.
Casali Cristian |
Flotta Aldo |
Lamberti Francesco |