DeepFit is an advanced AI-powered fitness assessment platform developed for the Sports Authority of India (SAI) to revolutionize athlete screening and fitness evaluation. Using cutting-edge computer vision and machine learning technologies, the system eliminates the need for expensive equipment and manual measurements, providing accurate, real-time fitness assessments through a simple webcam.
This innovative solution addresses SAI's challenge of conducting large-scale fitness assessments across India by enabling remote, automated evaluation of athletes' physical capabilities. The system provides instant body measurements (height, weight, BMI) and tracks exercise performance (situps, dumbbell curls, vertical jumps) with AI-powered form analysis, making talent identification and fitness monitoring accessible, efficient, and scalable.
Problem Statement: Traditional fitness assessments require expensive equipment, trained personnel, and physical presence, making it difficult for SAI to evaluate thousands of aspiring athletes across remote areas of India.
Solution: DeepFit uses AI and computer vision to transform any smartphone or laptop camera into a professional fitness assessment tool, enabling SAI to conduct nationwide talent hunts and fitness evaluations remotely, accurately, and cost-effectively.
- π Height & Weight Estimation: AI-based body measurement using single camera
- πͺ Exercise Tracking: Real-time tracking of Situps, Dumbbell Curls, and Vertical Jumps
- π Performance Analytics: Comprehensive fitness dashboards and progress tracking
- π― Dynamic Benchmarks: Personalized fitness goals based on athlete data
- π€ User Management: Secure authentication with profile management
- π Leaderboard: Competitive rankings based on performance metrics
Backend:
- Flask (Python Web Framework)
- MongoDB Atlas (Cloud Database)
- MediaPipe (Pose Detection)
- OpenCV (Computer Vision)
- PyTorch (Deep Learning)
- Scikit-learn (Machine Learning)
Frontend:
- HTML5, CSS3, JavaScript
- Responsive Design
- Real-time Video Processing
AI/ML Components:
- MiDaS (Depth Estimation)
- MediaPipe Holistic (Pose Detection)
- Random Forest (Weight Prediction)
- YOLO (Object Detection - Optional)
HeightAndWeightCalculator/
β
βββ Backend/ # Backend application
β βββ models/ # ML models
β β βββ weight_rf_model.pkl # Weight prediction model
β β βββ weight_scaler.pkl # Feature scaler
β β βββ yolov8n.pt # YOLO model (optional)
β β
β βββ logs/ # Application logs
β βββ uploads/ # User uploaded files
β βββ measurements/ # Measurement data
β βββ jump_data/ # Vertical jump data
β βββ validation_results/ # Validation reports
β β
β βββ .env # Environment configuration
β βββ app.py # Main Flask application
β βββ db_config.py # Database configuration
β βββ dynamic_benchmarks.py # Benchmark system
β β
β βββ situp_blueprint.py # Situp exercise module
β βββ dumbbell_blueprint.py # Dumbbell exercise module
β βββ vertical_jump_blueprint.py # Vertical jump module
β βββ advanced_jump_detector.py # Advanced jump detection
β β
β βββ integrated_system.py # Height/Weight estimation
β βββ enhanced_ui.py # UI components
β βββ session_manager.py # Session management
β βββ error_logger.py # Logging system
β βββ train_model.py # Model training script
β
βββ Frontend/ # Frontend application
β βββ templates/ # HTML templates
β β βββ index.html # Home page
β β βββ login.html # Login page
β β βββ signup.html # Registration page
β β βββ dashboard.html # User dashboard
β β βββ performance_dashboard.html # Performance metrics
β β βββ Best_Results.html # Leaderboard
β β βββ index_situp.html # Situp interface
β β βββ index_dumbbell.html # Dumbbell interface
β β βββ index_verticaljump.html # Vertical jump interface
β β βββ errors/ # Error pages
β β
β βββ static/ # Static assets
β βββ css/ # Stylesheets
β βββ js/ # JavaScript files
β βββ images/ # Images
β
βββ Datasets/ # Training data
β βββ AthleteData.csv # Athlete benchmark data
β βββ training_data.csv # Exercise training data
β
βββ requirements.txt # Python dependencies
- Python 3.8 or higher
- MongoDB Atlas account
- Webcam/Camera
- 4GB RAM minimum
- Windows/Linux/macOS
git clone <repository-url>
cd HeightAndWeightCalculatorpip install -r requirements.txt- Create MongoDB Atlas account at https://cloud.mongodb.com/
- Create a new cluster named
sih2573 - Get your connection string
- Create
.envfile inBackend/folder:
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/?retryWrites=true&w=majority
DB_NAME=sih2573The application will automatically create these collections:
users- User accountssitups- Situp exercise dataDumbBell- Dumbbell exercise dataVertical_Jump- Vertical jump dataHeight and Weight- Body measurementsFinal_Estimated_Height_and_Weight- Final estimatesQualified_Results- Leaderboard dataexercise_sessions- Session trackingexercise_results- Exercise resultsheight_videos- Video uploadsmeasurements- Additional measurements
cd Backend
python app.pyAccess the application at: http://localhost:5000
- Navigate to
http://localhost:5000 - Click "Sign Up" to create account
- Fill in details and capture profile photo
- Login with credentials
- Go to Dashboard β Height & Weight
- Stand 2-3 meters from camera
- Ensure full body is visible
- System will auto-measure when stable
- Press 'S' to save measurement
- Press 'F' for final estimate
Controls:
S- Save measurementF- Final estimateR- ResetC- Toggle auto-saveK- Recalibrate cameraQ- Quit
- Go to Dashboard β Situps
- Click "Start Camera"
- Lie down with full body visible
- Perform situps (3-minute timer)
- Click "Stop" when done
- View results in display page
- Go to Dashboard β Dumbbell Curls
- Click "Start Camera"
- Stand with arms visible
- Perform curls with both arms
- System tracks reps and estimates weight
- Click "Stop" when done
- Go to Dashboard β Vertical Jump
- Click "Start Camera"
- Stand in frame for calibration
- Perform vertical jumps
- System measures jump height
- Click "Stop" when done
- View all exercise results
- Compare with benchmarks
- Track progress over time
- See personalized goals
- View top performers
- Compare your rankings
- Filter by exercise type
- See detailed statistics
Edit in respective blueprint files:
camera.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
camera.set(cv2.CAP_PROP_FPS, 30)Edit in blueprint files:
SITUP_DURATION = 180 # 3 minutesModify Datasets/AthleteData.csv to update benchmark data:
Age,Gender,Height_cm,Weight_kg,Situps_per_min,Vertical_Jump_cm,Dumbbell_Curl_per_min
25,M,175,70,30,65,25POST /login- User loginPOST /signup- User registrationGET /logout- User logout
POST /upload_exercise_video- Upload exercise videoGET /height_weight_system- Start height/weight measurementGET /performance_dashboard- View performance metrics
-
GET /situp/start_camera- Start situp tracking -
GET /situp/stop_camera- Stop situp tracking -
GET /situp/get_stats- Get current stats -
POST /api/submit_situp_result- Submit results -
GET /dumbbell/start_camera- Start dumbbell tracking -
GET /dumbbell/stop_camera- Stop dumbbell tracking -
GET /dumbbell/get_stats- Get current stats -
POST /api/submit_dumbbell_result- Submit results -
GET /vertical_jump/start_camera- Start jump tracking -
GET /vertical_jump/stop_camera- Stop jump tracking -
GET /vertical_jump/get_stats- Get current stats -
POST /api/submit_vertical_jump_result- Submit results
GET /api/dynamic_benchmarks?email=<email>- Get personalized benchmarksPOST /api/match_athlete- Find matching athlete profile
GET /api/best_results- Get leaderboard dataPOST /api/save_qualified_results- Save to leaderboard
- Password hashing with bcrypt
- Session management with secure cookies
- CORS protection
- Input validation
- SQL injection prevention (NoSQL)
- XSS protection
{
name: String,
age: Number,
gender: String,
place: String,
phone: String,
email: String (unique),
password: Binary (hashed),
photo: String (base64),
created_at: DateTime
}{
user_email: String,
reps_completed: Number,
form_quality: Number,
timer_time: String,
submission_time: DateTime,
created_at: DateTime
}{
user_email: String,
height_cm: Number,
weight_kg: Number,
confidence_score: Number,
uncertainty_height: Number,
uncertainty_weight: Number,
timestamp: DateTime,
bmi: Number
}- Method: MediaPipe Pose + Depth Estimation
- Accuracy: Β±2-3 cm
- Input: Single RGB image
- Output: Height in cm
- Model: Random Forest Regressor
- Features: Body proportions, height, anthropometric ratios
- Accuracy: Β±3-5 kg
- Training Data: 1000+ samples
- Situps: Angle-based detection (shoulder-hip-knee)
- Dumbbell: Elbow angle tracking
- Vertical Jump: Pose tracking + height calculation
- Algorithm: K-Nearest Neighbors
- Features: Age, gender, height, weight
- Dataset: AthleteData.csv
# Check camera access
python -c "import cv2; print(cv2.VideoCapture(0).isOpened())"- Check
.envfile exists inBackend/folder - Verify MongoDB URI is correct
- Check network connectivity
- Whitelist IP in MongoDB Atlas (0.0.0.0/0 for testing)
pip install -r requirements.txt --upgrade# Change port in app.py
app.run(debug=True, port=5001)- Use GPU for PyTorch models (if available)
- Reduce camera resolution for faster processing
- Enable model caching
- Use connection pooling for MongoDB
- Implement lazy loading for ML models
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is developed for educational purposes.
Developed for Smart India Hackathon 2024 Problem Statement by: Sports Authority of India (SAI) Category: Smart Education & Sports Solution: AI-powered contactless fitness assessment system
For issues and questions:
- Check troubleshooting section
- Review console logs
- Verify MongoDB Atlas connection
- Ensure all dependencies are installed
- v1.0.0 - Initial release with core features
- v1.1.0 - Added MongoDB Atlas integration
- v1.2.0 - Enhanced exercise tracking
- v1.3.0 - Added dynamic benchmarks
- v1.4.0 - Performance dashboard improvements
- Mobile app integration
- Multi-user video sessions
- Advanced analytics with ML insights
- Social features and challenges
- Integration with fitness wearables
- Nutrition tracking
- AI-powered form correction
- Voice commands
- MediaPipe: https://google.github.io/mediapipe/
- OpenCV: https://opencv.org/
- Flask: https://flask.palletsprojects.com/
- MongoDB: https://www.mongodb.com/
Built with β€οΈ for Smart India Hackathon 2024