The lack of focus on strength training programs in related literature and the absence of support from current activity trackers for free weight exercises are challenges faced by many fitness enthusiasts and professionals. With the growing interest in activity monitoring technologies and applications, there is significant potential for developing solutions that can help bridge this gap. Additionally, activity recognition can be employed to address significant societal challenges such as rehabilitation, sustainability, elderly care, and health. In this project, I propose exploring the possibilities of context-aware applications in the field of strength training, utilizing data collected from wrist sensors (smartwatches) to analyze free weight exercises. The goal is to develop models that, like personal trainers, monitor exercises, count repetitions, identify exercises, and detect improper execution forms to assist users in achieving their goals more efficiently and safely.
- Classify basic barbell exercises
- Count the number of repetitions
- Detect improper movement
Create, install, and activate the Anaconda environment: conda env create -f environment.yml
.
Read all the separate raw CSV files, process them, and merge them into a single dataset.
- Dataset located at → data/raw
- Extract features from file name
- Read all files
- Work with datetimes
- Create a custom function
- Merge datasets
- Resample data (frequency conversion)
- Export processed dataset
Original code: make_dataset.py
Explained step-by-step: 01_make_dataset.ipynb
Create scripts to process, visualize, and model accelerometer and gyroscope data.
- Plot time series for all exercises
- Plot all axes (x, y, and z)
- Compare participants
- Create a loop to plot all sensor combinations
- Combine plots into a single figure
- Loop through all combinations and export for both sensors
Original code: visualize.py
Explained step-by-step: 02_visualize.ipynb
Check for any outliers in the data that need to be removed.
- Box plots and interquartile range (IQR)
- Plotting outliers over time
- Function to mark outliers using various methods (IQR, Chauvenet's Criterion, Local Outlier Factor)
- Checking outliers grouped by label
- Replacing outliers
Original code: remove_outliers.py
Explained step-by-step: 03_remove_outliers.ipynb
Filter noise and identify parts of the data that explain most of the variance using PCA. Then, add numerical, temporal, frequency, and clustering features to generate new features.
- Handling missing values
- Lowpass filter (Butterworth)
- Applying PCA
- Square root of sum of squares (vector r)
- Temporal abstraction
- Frequency abstraction
- Handling overlapping data (overfitting)
Original code: build_features.py
Explained step-by-step: 04_build_features.ipynb
Conduct experiments for feature selection, model choice, and hyperparameter tuning to find the combination that results in the highest accuracy for exercise classification.
- Creating training and test sets
- Splitting feature subsets
- Forward feature selection using simple decision tree
- Applying multiple models and grid search for hyperparameter tuning
- Comparing results
- Selecting the best model and evaluating results
- Testing a simpler model
Original code: train_model.py
Explained step-by-step: 05_train_model.ipynb
Create a Python script that can count repetitions and measure code efficiency.
- Visualize data to identify patterns
- Configure LowPassFilter (Butterworth)
- Create a function to count repetitions
- Create a benchmark dataframe
- Evaluate the results (MAE)
Original code: count_repetitions.py
Explained step-by-step: 06_count_repetitions.ipynb