Real-time exercise form correction using YOLOv8 pose estimation — your personal AI fitness assistant.
Posture Insights Vision is a computer vision-based system designed to provide real-time feedback on exercise posture and form. Leveraging YOLOv8's pose estimation, this project helps users self-correct during workouts by identifying improper alignment and joint angles, all through a simple web interface powered by Flask and OpenCV.
Whether you're doing push-ups, planks, or curls, this tool acts as your virtual personal trainer to ensure you're doing it right.
-
Web Interface Launch: Users open a Flask-powered web interface and select an exercise.
-
Webcam Activation: The app activates the webcam to begin capturing live video.
-
Pose Estimation: Each frame is passed through YOLOv8's pose estimation model, detecting 17 key body joints in real-time.
-
Heuristic Analysis: Based on selected exercise, relevant joints are analyzed for:
-
Joint angles
-
Body alignment
-
Motion flow
-
-
Real-Time Feedback: If poor posture is detected, alerts are displayed on the UI instantly.
-
✅ Real-time posture detection
-
🎯 Accurate joint tracking with YOLOv8
-
🧩 Modular exercise-specific heuristics
-
💻 Lightweight Flask app with webcam streaming
-
📈 Designed to work on local machines with webcam access
Each heuristic is designed using joint angle thresholds and motion trajectory tracking based on keypoints detected per frame:
-
Plank – Ensures shoulder, hip, and ankle are aligned in a straight line.
-
Push-up – Tracks elbow flexion and extension, back curvature, and wrist alignment.
-
Bicep Curl – Measures elbow joint angle to ensure full range of motion and controlled return.
-
Clone the Repository:
git clone https://github.com/RohitKrish46/posture-insights-vision.git cd posture-insights-vision
-
Create a Virtual Environment:
python -m venv env
-
Activate the Virtual Environment:
-
On Windows
env\Scripts\activate
-
On macOS and Linux
source env/bin/activate
-
-
Install Dependencies:
pip install -r requirements.txt
-
Download the YOLOV8 Model:
-
Download the desired YOLOV8 model and store it under the 'models' folder.
-
You can download ultralytics models using:
from ultralytics import YOLO model = YOLO('yolov8m-pose.pt')
-
-
Launch the Flask App:
flask run
-
Open in Browser:
Navigate to http://127.0.0.1:5000 to start using the app.
YOLOv8's pose model is ideal for this use case due to:
-
Single-pass detection of all keypoints
-
High FPS for real-time inference
-
Strong accuracy for joint localization
The model outputs coordinates for 17 joints, which are further processed using geometric and motion-based heuristics.
posture-insights-vision/
│
├── app.py # Flask app entry point
├── models/ # YOLOv8 model files
├── static/ # CSS and JS files
├── templates/ # HTML templates
├── utils/
│ └── heuristics.py # Heuristic functions for posture detection
├── requirements.txt
└── README.md
-
Add more exercises (e.g., squats, lunges)
-
Add feedback history and performance metrics
-
Integrate with fitness APIs for tracking
-
Port to mobile or desktop apps