Exercise Form
Classifier
Real-time exercise form feedback using pose estimation and a per-exercise Random Forest classifier — built as the final project for the Machine Vision course.
Squat
100%
121 / 121 reps correct
Overhead Press
99%
104 / 105 reps correct
Deadlift
100%
113 / 113 reps correct
Overview
A real-time system that watches you exercise through a webcam, segments your reps, and tells you — immediately — whether your form was good or bad.
The system monitors three barbell exercises — squat, overhead press, and deadlift — using MediaPipe's BlazePose model to extract 33 body landmarks per frame. Joint angles are computed from those landmarks, repetitions are segmented automatically, and a per-exercise Random Forest classifier trained on real video data labels each rep. The entire pipeline runs at webcam framerate with audio feedback delivered the moment a rep completes.
Context
Machine Vision Course
Final Project · 2026
Training Data
18 videos
~20 reps each
Exercises
Squat · OHP · Deadlift
Feedback
Real-time audio + UI overlay
The Pipeline
From webcam frame to form verdict
Webcam Input
OpenCV captures live video from the webcam frame by frame and feeds it into the pose estimation model in real time.
OpenCV
Pose Estimation
MediaPipe's BlazePose model detects 33 body landmarks per frame — shoulder, elbow, wrist, hip, knee, ankle — returning normalised 3D coordinates.
MediaPipe BlazePose
Joint Angles
Angles between landmark triplets are computed each frame. For a squat: knee angle, hip angle, trunk lean. These raw angle time-series are the signal the classifier learns from.
NumPy
Rep Segmentation
scipy's find_peaks detects the valleys and peaks in the angle curves, segmenting the continuous signal into individual repetitions. Each detected rep is processed independently.
SciPy find_peaks
Feature Extraction
For each completed rep, five summary statistics are computed per tracked joint angle: minimum, maximum, mean, standard deviation, and range. These form the feature vector fed into the classifier.
Per-rep statistics
Classification
A Random Forest classifier trained per exercise labels the rep as GOOD or BAD. Three separate models — one per exercise — were trained on 18 videos (~20 reps each) of good and bad form.
Random Forest
Feedback
Result renders instantly on the live webcam overlay. Good form triggers a high audio tone; bad form plays a double buzz. The rep counter increments only on good reps.
Flask UI + Audio
Exercises
What the classifier looks for
Squat
100%
Bad Form Definition
Knees don't reach 90° of flexion at the bottom of the movement — a shallow squat that fails to engage the full range of motion.
Tracked Joints
- Knee angle
- Hip angle
- Trunk lean
Overhead Press
99%
Bad Form Definition
Elbows fail to fully extend at the top of the press — the lockout is incomplete, leaving the lift unfinished.
Tracked Joints
- Elbow angle
- Shoulder angle
- Wrist position
Deadlift
100%
Bad Form Definition
Excessive lower back rounding and forward trunk lean during the pull — the spine loses its neutral position under load.
Tracked Joints
- Hip angle
- Trunk angle
- Knee angle
Why Random Forest
Rep-level summary statistics, not raw frame sequences.
Rather than feeding raw per-frame angles into a sequence model, the system reduces each rep to five statistics per joint — min, max, mean, standard deviation, and range. This makes the feature vector compact and interpretable, and means a Random Forest can classify it accurately with a small training set. A separate model is trained per exercise since the biomechanical criteria differ entirely.
Limitations
Single subject, right side only, fixed thresholds.
The model was trained on a single subject's videos, so generalisation to different body proportions is untested. The system requires the user to face right relative to the camera — joint angle calculations are not mirrored. Fixed angle thresholds define bad form, which doesn't account for individual mobility differences. These are known constraints accepted for the scope of a course project.
Tech Stack
Vision
- MediaPipe BlazePose
- OpenCV
ML
- scikit-learn
- Random Forest
- SciPy
Processing
- NumPy
- sounddevice
Server
- Flask
- Python