PhysioAugment is a lightweight, pure-NumPy data augmentation library tailored for 1D physiological signals (e.g., PPG, ECG, respiration signals).
High-quality data augmentation is crucial for improving model robustness in deep learning. While the computer vision domain has abundant toolkits, lightweight augmentation tools specifically for 1D physiological signals are relatively scarce. PhysioAugment aims to fill this gap by providing a plug-and-play, highly customizable augmentation pipeline.
- Pure NumPy Implementation: Extremely lightweight, requiring no heavy deep learning frameworks to run.
- Realistic Scenarios: Built-in noise and interference models that mimic real-world physiological signal artifacts (e.g., baseline wander, respiration interference, motion artifacts).
- Deep Learning Oriented: Features a PyTorch-like
transforms.ComposeAPI, allowing seamless integration into existing Dataloaders and training pipelines. - Probabilistic Control: Supports setting trigger probabilities (
p) for each augmentation operation to easily construct diverse training batches.
You can install the latest version directly from GitHub using pip:
pip install git+[https://github.com/phish-tech/PhysioAugment.git](https://github.com/phish-tech/PhysioAugment.git)Alternatively, clone the repository for local development (editable mode recommended):
git clone [https://github.com/phish-tech/PhysioAugment.git](https://github.com/phish-tech/PhysioAugment.git)
cd PhysioAugment
pip install -e .PhysioAugment's API design is highly intuitive. You can use Compose to chain multiple augmentation operations together:
import numpy as np
from core import Compose, AddMotionArtifact
from baseline import AddBaselineWander, AddRespirationInterference
# 1. Initialize the data augmentation pipeline
augment_pipeline = Compose([
AddBaselineWander(fs=100, amp_ratio=0.3, p=0.8), # Add baseline wander (80% probability)
AddRespirationInterference(fs=100, amp_ratio=0.2, p=0.5), # Add respiration interference (50% probability)
AddMotionArtifact(fs=100, artifact_ratio=1.5, p=0.3) # Add motion artifacts (30% probability)
])
# 2. Prepare your 1D signal data (e.g., a PPG signal of length 1000)
# x = np.load('your_signal.npy')
x = np.sin(2 * np.pi * 1.5 * np.arange(1000) / 100) # Simulated signal
# 3. Apply data augmentation
augmented_x = augment_pipeline(x)The current version includes the following core augmentation modules (more modules are continuously being updated):
Simulates low-frequency baseline wander caused by sensor displacement or temperature changes.
fs: Sampling frequencyamp_ratio: Ratio of the wander amplitude relative to the original signalfreq_range: Frequency range of the wander (default: 0.05Hz - 0.3Hz
Simulates the inevitable respiration modulation effects in physiological signals.
resp_freq_range: Typical respiration frequency range (default: 0.2Hz - 0.4Hz)
Simulates burst, high-amplitude noise generated by intense user movement.
artifact_ratio: Intensity of the artifactnum_artifacts: Range for the number of generated artifacts
This project is open-sourced under the MIT License. You are welcome to use it freely in your research or projects. If you find this library helpful, please consider giving it a ⭐️ Star!