This repository contains the implementation of Physically Plausible Data Augmentation (PPDA) for wearable Inertial Measurement Unit (IMU)-based Human Activity Recognition (HAR)
Figure: PPDAs introduce physically plausible variations in wearable IMU data using physics simulation, compared to conventional STDAs which directly apply signal transformations.
This repository provides the official implementation of Physically Plausible Data Augmentation (PPDA) for wearable IMU-based Human Activity Recognition (HAR). PPDA uses the WIMUSim physics simulation framework to generate realistic variations in:
- Movement Amplitude
- Movement Speed
- Sensor Placement
- Hardware-related Effects (noise and bias)
These augmentations help improve model generalization and reduce the need for large-scale labeled data collection, compared to traditional Signal Transformation-based Data Augmentations (STDAs).
- Python 3.10 or higher
- Git
- Clone this repository and WIMUSim repository
git clone https://github.com/USERNAME/PPDA.git
git clone https://github.com/STRCWearlab/WIMUSim.git
cd PPDA- Install dependencies
%
pip install -e WIMUSim
pip install -r requirements.txt- Configure environment variables
Set the
WANDB_ENTITYenvironment variable to your Weights & Biases entity name.
WANDB_ENTITY=`replace_with_your_wandb_entity`
- Prepare datasets Download datasets (REALDISP, REALWORLD, MM-Fit) as described in data/README.md.
Run the following command to assess individual augmentations (e.g. MM-Fit dataset):
# Movement amplitude scaling
python scripts/mmfit_ppda_indiv.py --magscale --magscale_sigma 0.2
# Movement amplitude warping
python scripts/mmfit_ppda_indiv.py --magwarp --magwarp_sigma 0.2 --magwarp_knot 4
# Movement speed scaling
python scripts/mmfit_ppda_indiv.py --timescale --timescale_scale_min 0.8 --timescale_scale_max 1.2
# Movement speed warping
python scripts/mmfit_ppda_indiv.py --timewarp --timewarp_sigma 0.1 --timewarp_knot 4
# Sensor rotation/placement variation
python scripts/mmfit_ppda_indiv.py --rotation --rotation_range_x -25,25 --rotation_range_y -25,25 --rotation_range_z -25,25
# Noise and bias addition
python scripts/mmfit_ppda_indiv.py --noisebias --noisebias_sigma 0.2Run the following command to assess multiple augmentations (e.g. MM-Fit dataset):
# Run with default configuration (all augmentations enabled)
python scripts/mmfit_ppda_multi.pyNote: For other datasets, use the corresponding scripts (e.g., realdisp_ppda_indiv.py, realworld_ppda_multi.py).
Parts of this repository are adapted from dl_har_public.
We thank the authors for making their code available.
