Corresponding Author: Hanchen David Wang
If you use this work, please cite our paper:
@inproceedings{wang2025exact,
title={EXACT: A Meta-Learning Framework for Precise Exercise Segmentation in Physical Therapy},
author={Wang, Hanchen David and Bae, Siwoo and Sun, Xutong and Thatigotla, Yashvitha and Ma, Meiyi},
booktitle={Proceedings of the ACM/IEEE 16th International Conference on Cyber-Physical Systems (with CPS-IoT Week 2025)},
pages={1--11},
year={2025}
}This repository provides an implementation for meta-learning on dense labeling tasks using various deep learning models. The project includes customizable support for models and datasets, with augmentation, training, and evaluation configurations. It leverages the WandB logging framework for experiment tracking.
- Clone this repository:
git clone https://github.com/yourusername/yourproject.git cd yourproject - Install dependencies:
pip install -r requirements.txt
- Install WandB for experiment tracking (optional):
pip install wandb
To train a model, use:
python main.py --dataset <dataset_name> --model <model_name> --data_root <path_to_data>Example:
python main.py --dataset physiq --model unet --data_root ./data--data_root: Root directory for the dataset.--dataset: Dataset to use for training (physiq,spar,mmfit).--model: Model to use for training (unet,transformer,ex,segmenter,cnn).
--window_size: Window size for sliding window (default: 500).--window_step: Step size for sliding window (default: 25).--rotation_chance: Probability of applying random rotation to data (default: 0).
--lr: Learning rate for the meta-optimizer (default: 1e-3).--meta_lr: Learning rate for the inner optimizer (default: 1e-2).--n_inner_iter: Number of inner-loop iterations (default: 1).--n_epochs: Number of training epochs (default: 30).--device: Device to use for training (default: "cuda").
--wandb_project: Name of the WandB project for logging experiments.--nowandb: Disable WandB logging.
--loocv: Enable Leave-One-Out Cross-Validation.
For a complete list of options, please refer to the get_args function in the main script.
- UNet: Designed for dense labeling with encoder-decoder architecture.
- Transformer: Transformer model adapted for dense labeling tasks.
- EX (EXACT): Custom model for dense labeling.
- Segmenter: A model for segmentation tasks.
- CNN: Simple Convolutional Neural Network for dense labeling tasks.
Please go to data folder to download the datasets.
-
PhysiQ: Dataset with IMU data used for exercise and physical activity monitoring.
-
SPAR: Another IMU-based dataset.
-
MMFIT: Dataset for physical fitness with dense labeling tasks.
Training a UNet on the PhysiQ dataset:
python main.py --dataset physiq --model unet --window_size 500 --window_step 25 --n_epochs 30 --lr 1e-3Using WandB logging:
python main.py --dataset spar --model transformer --wandb_project EXACTLeave-One-Out Cross-Validation:
python main.py --dataset mmfit --model segmenter --loocvThis section explains how to use EXACT via a Docker container. You can either build the Docker image yourself or pull a prebuilt image from Docker Hub.
If you just want to run EXACT without building from source, pull the image from Docker Hub:
docker pull wang584041187/exact:latest- On a machine with NVIDIA GPU (for CUDA):
docker run -it --rm --gpus all wang584041187/exact:latest
- On a Mac M1/M2/M3 (ARM64):
docker run -it --rm --platform=linux/arm64 wang584041187/exact:latest
- On a CPU-only machine:
docker run -it --rm wang584041187/exact:latest
Once inside the container, you can run any of the commands you normally would in your local environment (e.g., python main.py ...).
If you’d prefer to build the Docker image using your latest code changes, do the following in the project directory:
docker build -t exact .Then, you can run:
docker run -it --rm --gpus all exact(Adjust --gpus all or --platform=linux/arm64 as needed.)
If you don’t want to use WandB or don’t have an account, remove or comment out the relevant lines in any scripts (e.g., train.sh, main.py) that call wandb:
# wandb.init(project="EXACT")
# wandb.log({...})Or, when running your Python scripts, you can pass the --nowandb argument to disable WandB logging:
python main.py --dataset physiq --model unet --nowandbThis prevents WandB from initializing or tracking metrics.
If you have a dedicated .sh script (e.g., scripts/train.sh):
-
Run the script:
bash run_normal.sh
or
bash run_loocv.sh
or if you want to check results only:
bash repeat.sh
-
If you removed WandB lines or used
--nowandb, ensure the script does not callwandb.
When you’re finished, type:
exitto stop the container. If you used --rm, the container is automatically removed.
- CUDA: To verify CUDA is working, run:
If it prints
python -c "import torch; print(torch.cuda.is_available())"True, CUDA is enabled. - Modifying Scripts: If your
.shscripts were created on Windows, convert line endings to Unix (e.g., usingdos2unix) to avoid the^Minterpreter error. - Updating the Image: If you change code in this repo and want an updated Docker image, rebuild or push a new version to Docker Hub.
With Docker, you can now replicate the environment quickly on any system—GPU or CPU—without worrying about local dependencies.
