https://github.com/emanuel-poblano/image-recognition
Built a production-grade Gym Form Correction AI using Python, MediaPipe, and OpenCV that analyzes exercise posture in real time, counts repetitions, and provides corrective feedback through a modular, scalable architecture.
https://github.com/emanuel-poblano/image-recognition
mediapipe opencv python
Last synced: 2 months ago
JSON representation
Built a production-grade Gym Form Correction AI using Python, MediaPipe, and OpenCV that analyzes exercise posture in real time, counts repetitions, and provides corrective feedback through a modular, scalable architecture.
- Host: GitHub
- URL: https://github.com/emanuel-poblano/image-recognition
- Owner: emanuel-poblano
- Created: 2025-12-17T19:12:28.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-18T00:00:51.000Z (7 months ago)
- Last Synced: 2025-12-21T10:31:13.326Z (6 months ago)
- Topics: mediapipe, opencv, python
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐๏ธ Gym Form Correction AI
A **production-grade computer vision application** that analyzes exercise form in real time using a webcam or video input. The system detects body posture, counts repetitions, and provides corrective feedback for common gym exercises such as squats, push-ups, and deadlifts.
Built with **Python, MediaPipe, and OpenCV**, this project demonstrates clean architecture, real-time pose estimation, and scalable design suitable for deployment or further ML enhancement.
---
## ๐ Features
* โ
Real-time pose estimation using MediaPipe
* โ
Exercise-specific form analysis (Squat, Push-up, Deadlift)
* โ
Rep counting with state tracking
* โ
Live visual feedback overlay
* โ
Modular, production-ready architecture
* โ
Robust error handling for camera and pose detection
---
## ๐ง System Architecture
```
Camera / Video Input
โ
Pose Estimator (MediaPipe)
โ
Landmark Processing & Angle Calculation
โ
Exercise Analyzer (Rules / Logic)
โ
Rep Counter & Feedback Engine
โ
Live UI Overlay (OpenCV)
```
---
## ๐ Project Structure
```
image-recognition/
โโโ app/
โ โโโ main.py # Application entry point
โ
โโโ pose/
โ โโโ estimator.py # MediaPipe pose wrapper
โ
โโโ exercises/
โ โโโ base.py # Abstract exercise class
โ โโโ squat.py # Squat logic (angles, reps, feedback)
โ
โโโ analysis/
โ โโโ angles.py # Joint angle calculations
โ
โโโ feedback/
โ โโโ overlay.py # UI text overlay helpers
โ
โโโ tests/
โ โโโ test_angles.py # Unit tests
โ
โโโ requirements.txt
โโโ README.md
```
---
## ๐ ๏ธ Installation
### 1๏ธโฃ Clone Repository
```bash
git clone https://github.com/your-username/gym-form-ai.git
cd gym-form-ai
```
### 2๏ธโฃ Create Virtual Environment (Recommended)
```bash
python3 -m venv venv
source venv/bin/activate
```
### 3๏ธโฃ Install Dependencies
#### Intel Mac
```bash
pip install opencv-python mediapipe==0.10.12 numpy
```
#### Apple Silicon (M1/M2)
```bash
pip install opencv-python mediapipe-silicon==0.10.12 numpy
```
---
## โถ๏ธ Running the App
From the **project root directory**:
```bash
python3 -m app.main
```
* Press **`q`** to exit the application
* Ensure your webcam is connected and accessible
---
## ๐๏ธ Supported Exercises
| Exercise | Features |
| -------- | ----------------------------------------------- |
| Squat | Rep counting, depth detection, posture feedback |
| Push-up | (Planned) |
| Deadlift | (Planned) |
---
## ๐ Metrics Tracked
* Total repetitions
* Joint angles per rep
* Depth consistency
* Form warnings frequency
These metrics can be extended to generate **session reports** or **performance scores**.
---
## ๐งช Testing
Run unit tests from the root directory:
```bash
pytest tests/
```
---
## ๐ฎ Future Improvements
* ๐น ML-based form scoring (Random Forest / LSTM)
* ๐น Streamlit web dashboard
* ๐น REST API with FastAPI
* ๐น Mobile app frontend (React Native)
* ๐น User profiles & workout history
---
## ๐ง Key Technical Concepts Demonstrated
* Real-time computer vision
* Human pose estimation
* Modular Python architecture
* State-based rep counting
* Noise handling & smoothing
* Production-level error handling
---
## ๐ Resume Description
> Built a production-grade Gym Form Correction AI using Python, MediaPipe, and OpenCV that analyzes exercise posture in real time, counts repetitions, and provides corrective feedback through a modular, scalable architecture.
---
## ๐ License
MIT License
---
## ๐ค Author
**Emanuel Poblano**
Computer Vision / Software Engineering Project