Real-time AI-powered fitness monitoring system using pose estimation
Features β’ Installation β’ Usage β’ API β’ Architecture β’ Contributing
AI Fitness Monitor is a comprehensive fitness tracking system that uses computer vision and machine learning to analyze exercise form in real-time. The system consists of a Python server with pose detection capabilities and an Android mobile application for user interaction.
- Real-time Squat Analysis: Tracks squat depth, knee angles, and form with instant feedback
- Vertical Jump Measurement: Measures jump height using pose estimation
- Voice Feedback: Audio cues to guide proper exercise form
- Mobile Integration: Android app for convenient mobile workout tracking
- WebSocket Streaming: Low-latency video processing for smooth experience
SIH_SPORTS_proj/
βββ server/ # Python backend server
β βββ src/
β β βββ analyzers/ # Exercise analysis modules
β β β βββ squat_analyzer.py
β β β βββ jump_analyzer.py
β β βββ api/ # Flask API routes
β β β βββ routes.py
β β βββ utils/ # Utility modules
β β βββ camera_manager.py
β β βββ frame_processor.py
β βββ config/ # Configuration files
β β βββ settings.py
β βββ templates/ # HTML templates
β βββ tests/ # Unit & integration tests
β βββ requirements.txt # Python dependencies
β βββ run.py # Main entry point
β
βββ android_app/ # Android mobile application
β βββ app/src/main/
β β βββ java/ # Kotlin source code
β β βββ res/ # Android resources
β βββ build.gradle.kts # Gradle build config
β βββ USER_MANUAL.md # User documentation
β
βββ builds/ # Pre-built APK files
β βββ FitnessMonitor.apk
β
βββ docs/ # Additional documentation
β βββ API.md # API reference
β βββ ARCHITECTURE.md # System architecture
β
βββ README.md # This file
- Python 3.8+ with pip
- Android Studio (for Android development)
- Webcam (for local testing)
-
Clone the repository
git clone https://github.com/your-repo/ai-fitness-monitor.git cd ai-fitness-monitor -
Create virtual environment
python -m venv venv # Windows venv\Scripts\activate # Linux/macOS source venv/bin/activate
-
Install dependencies
cd server pip install -r requirements.txt -
Run the server
python run.py
The server will start at
http://0.0.0.0:5000
-
Install pre-built APK
- Transfer
builds/FitnessMonitor.apkto your Android device - Enable "Install from unknown sources"
- Install the APK
- Transfer
-
Or build from source
cd android_app ./gradlew assembleDebug
- Start the server on your computer
- Connect your phone to the same WiFi network
- Open the app and enter the server IP address
- Select exercise type (Squat or Jump)
- Position yourself in the camera frame
- Start exercising and get real-time feedback!
- Webcam Mode: Uses your computer's webcam
- Mobile Mode: Processes frames from the Android app
- Stand 6-8 feet from camera
- Ensure full body is visible
- Listen for voice feedback on depth
- Stand still for calibration
- Jump straight up
- Wait for height measurement
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Web interface |
| GET | /squat_feed |
MJPEG squat analysis stream |
| GET | /jump_feed |
MJPEG jump analysis stream |
| POST | /process_frame |
Process mobile camera frame |
| POST | /reset_analyzer |
Reset analyzer state |
Request:
{
"image": "base64_encoded_jpeg",
"type": "squat" | "jump"
}Response:
{
"image": "base64_encoded_result",
"count": 5,
"stage": "UP",
"feedback": "Good form!"
}βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Android ββββββΆβ Flask ββββββΆβ MediaPipe β
β App βββββββ Server βββββββ Pose β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β β
β HTTP/WebSocket β Pose Detection β
β β β
βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Camera β β OpenCV β β Numpy β
β Frame β β Processing β β Arrays β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
- MediaPipe Pose: Google's ML model for body pose estimation
- OpenCV: Image processing and video capture
- Flask: Lightweight web framework for API
- pyttsx3: Offline text-to-speech for voice feedback
cd server
# Run all tests
pytest
# Run with coverage
pytest --cov=src tests/
# Run specific test file
pytest tests/test_analyzers.py -v- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ for SIH 2025