Back to projects

Machine learning case study

IMU-Based Exercise Classification

Deep learning for automated workout recognition from wrist-worn sensor data.

October 2025Independent ML project
Python
Pandas
NumPy
PyTorch
CNN
LSTM
Time Series
scikit-learn
IMU exercise classification cover image
Wrist-worn IMU signals powering exercise recognition.

90%

reported accuracy

Held-out performance after weighted training and careful preprocessing.

CNN-LSTM

hybrid model

Local pattern extraction plus temporal sequence modeling.

Wrist IMU

input modality

A wearable setup with multivariate motion channels.

Introduction

The goal was to turn raw motion signals into reliable activity labels for fitness tracking and form analysis.

This project explores automatic recognition of gym exercises from Inertial Measurement Unit data collected with a wrist-worn device.

The interesting part is not just the model choice, but the discipline needed around preprocessing, leakage control and evaluation so the result remains believable.

Data

The dataset is a collection of per-set CSV files with multivariate motion channels aligned by timestamp.

  • Dataset: the public 'Gym Workout IMU' collection from Kaggle with one CSV file per set.
  • Signals include rotation rate, gravity, linear acceleration and quaternion-based orientation values.
  • The target is the exercise label and the features are multivariate time-series windows.

Methodology

The pipeline combines disciplined preprocessing with a hybrid CNN-LSTM architecture.

  • Trim noisy leading and trailing seconds and repair or remove NaNs.
  • Apply smoothing and downsampling to reduce noise and improve efficiency.
  • Create fixed-length windows to transform continuous signals into model-ready inputs.
  • Split by session/file rather than by random time windows to avoid leakage.
  • Fit the scaler on training only and use class weighting for imbalance.
  • Train a CNN-LSTM model so local feature extraction and temporal dynamics both matter.
  • Evaluate using confusion matrix and per-class metrics rather than accuracy alone.

Results

The strongest outcome is not only the score, but the fact that the evaluation setup tries hard not to flatter the model.

The model achieved strong separation across common exercises in the held-out set, with more stable training once class weighting was introduced.

Per-class confusion still revealed understandable errors between biomechanically similar movements, which is exactly the kind of signal that should guide future data collection.

Key insights

  • Hybrid CNN-LSTM models are a solid default for wearable IMU classification.
  • Session-wise splits are essential; random windows would make the numbers look better than they deserve.
  • Weighted losses help under-represented exercises meaningfully.

Next steps

  • Add rep counting on top of class predictions for richer workout analytics.
  • Prototype a lighter on-device model for real-time feedback.
  • Compare against Transformer or GRU variants and add augmentation such as jitter or time-warp.
  • Collect more users and exercise classes to improve generalization.

Next move

Interested in the rest of the portfolio?

The same editorial layout is now used to keep machine-learning projects, optimization work and technical writing under one visual system.