- Green Zone (Correct Range): Indicates ideal posture for optimal and safe form.
- Red Zone (Incorrect Range): Indicates unsafe or improper posture, with increased risk of injury.
TrackFit AI is a machine learning-driven fitness tracking system designed to detect and analyze workout movements from sensor data. This project utilizes posture detection, motion tracking, and data analysis to provide insights into exercise performance. It supports tracking of barbell exercises, including Squat, Bench Press, Deadlift, Overhead Press, and Barbell Row, with machine learning models to evaluate form and count repetitions accurately.
TrackFit AI uses sensor data from a wristband or similar wearable to classify exercises, track repetitions, and evaluate form. By analyzing accelerometer and gyroscope data, the system can recognize distinct workout patterns and assess form with machine learning, enhancing the accuracy and depth of workout tracking.
This project can be integrated with wearables(any smart watch), enabling users to enhance workouts through data-driven insights. Potential future enhancements include new exercises, improved model accuracy, and real-time tracking.
-
Data Processing and Outlier Detection
- Data Cleansing: Standardizes raw sensor data (accelerometer and gyroscope readings), removing irrelevant data.
- Outlier Detection:
- Interquartile Range (IQR): Identifies and removes extreme values.
- Chauvenet’s Criterion: Filters improbable values under normal distribution.
- Local Outlier Factor (LOF): A distance-based approach to flag low-density points.
-
Feature Engineering
- Signal Processing and Transformation:
- Low-pass Filtering: Reduces noise for clarity in sensor data.
- Principal Component Analysis (PCA): Reduces dimensionality, keeping essential features.
- Temporal and Frequency Abstractions:
- Temporal Abstraction: Captures trends over time.
- Frequency Abstraction: Uses Fourier Transformation to identify frequency patterns.
- Feature Selection: Extracts important features like movement angles, joint velocities, and frequencies.
- Signal Processing and Transformation:
-
Predictive Modeling
- Model Training and Selection: Trains various algorithms, including Decision Trees, K-Nearest Neighbors, SVM, Neural Networks, and Random Forests.
- Hyperparameter Tuning: Uses Grid Search for cross-validation and model optimization.
- Exercise Classification: Achieves ~97% accuracy in identifying exercises.
-
Repetition Counting
- Repetition Detection: Uses peak detection in signal data to count exercise repetitions.
- Counting Algorithm: Detects cycles in accelerometer or gyroscope data.
- Real-time Counting Integration: Designed for real-time applications.
-
Visualization and Analysis
- Exercise Visualization: Graphs showing sensor data and filtered signals.
- Form Evaluation Visualization: Shows posture analysis with correct (green) and incorrect (red) zones.
- Model Evaluation Metrics: Confusion matrices, accuracy scores, precision-recall curves, etc.
|
├── environment.yml <- Contains dependencies required to run the code correctly.
├── README.md <- Overview and usage of the project for developers and users.
├── data
│ ├── external <- Third-party data sources.
│ ├── interim <- Intermediate, transformed datasets.
│ │ └── 01_data_processed.pkl
│ │ └── 02_outliers_removed_chauvenets.pkl
│ │ └── 03_data_features.pkl
│ ├── processed <- Final, model-ready datasets.
│ └── raw <- Original, unmodified data.
│ └── MetaMotion
│ └── MetaMotion.zip
|
├── extras <- Pictures for Readme File
│
├── reports <- Analysis reports in HTML, PDF, or LaTeX.
│ └── figures <- Generated figures for reporting.
│
├── requirements.txt <- Python package dependencies.
│
├── src <- Source code organized by functionality.
│ ├── data <- Scripts for dataset generation and processing.
│ │ └── make_dataset.py
│ │
│ ├── features <- Scripts to engineer and transform features.
│ │ └── build_features.py
│ │ └── count_repetitions.py
│ │ └── DataTransformation.py
│ │ └── FrequencyAbstraction.py
│ │ └── remove_outliers.py
│ │ └── TemporalAbstraction.py
│ │
│ ├── models <- Scripts for model training and prediction.
│ │ └── __init__.py
│ │ └── train_model.py
│ │ └── LearningAlgorithms.py
│ │
│ └── visualization <- Scripts to generate visualizations.
│ │ └── plot_settings.py
│ │ └── visualize.py
│ │
│ ├── models <- Scripts for model training and prediction.
│ └── __init__.py
|
├── LICENSE
- Clone the repository.
- Install dependencies from
requirements.txt
orenvironment.yml
(for conda environments).pip install -r requirements.txt
- Ensure the directory structure is as specified above, with all data folders in place.
Run the make_dataset.py
script to preprocess the raw sensor data:
python src/data/make_dataset.py
Execute build_features.py
to create advanced features:
python src/features/build_features.py
Use train_model.py
to train and optimize classification models:
python src/models/train_model.py
Run count_repetitions.py
to apply filters and count repetitions:
python src/features/count_repetitions.py
Generate workout and feature visualizations with visualize.py
:
python src/visualization/visualize.py
Integrating data from fitness bands enables TrackFit AI to track and correct exercise postures in real time. This feature enhances productivity by promoting correct form, which reduces the risk of injuries significantly. With AI-driven posture analysis, the need for a personal trainer is minimized, helping users save on training costs while achieving a safer and more effective workout experience.
The classification model achieves ~97% accuracy in detecting exercise types, ensuring highly reliable tracking of workout patterns.
Repetition counting is calibrated against known repetitions, providing accurate tracking.
- Blue Bars: Actual
- Red Bars: Predicted
TrackFit AI has the potential to revolutionize personal fitness training by introducing machine learning insights into workouts:
- Improves Form and Safety: Provides real-time feedback on posture.
- Enhances Training Efficiency: Tracks repetitions and exercises without manual input.
- Makes Fitness Data Actionable: Provides insights for data-driven workout adjustments.
- Supports Personalized Training: Enables feedback and recommendations based on past performance.
-
Integration with Additional Wearables
Extend support to more wearable devices like Apple HealthKit and Google Fit. Develop a Bluetooth interface for real-time data input. -
Enhanced Model Accuracy with Multi-sensor Data
Improve accuracy by integrating data from multiple sources (e.g., heart rate, oxygen levels). Use data fusion and multi-modal learning for enhanced context. -
Addition of New Exercises and Activities
Expand recognition to bodyweight exercises, cardio, and complex movements. Use transfer learning to generalize across a broader range of activities. -
Advanced Real-time Feedback and Personalized Insights
Implement reinforcement learning to adjust exercise feedback based on user form, fatigue, and progress. Track user history and provide personalized recommendations.
Contributions are wholeheartedly welcomed! To get started, fork this repository, make your changes, and submit a pull request. Let’s build a better fitness tracking experience together.
Distributed under the MIT License. See LICENSE
for more information.