Skip to content

phish-tech/PhysioAugment

Repository files navigation

PhysioAugment

English | 简体中文

Python >= 3.7 NumPy License: MIT

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.

✨ Core Features

  • 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.Compose API, 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.

📦 Installation

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 .

🚀 Quick Start

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)

🛠️ Supported Augmentations

The current version includes the following core augmentation modules (more modules are continuously being updated):

1. AddBaselineWander

Simulates low-frequency baseline wander caused by sensor displacement or temperature changes.

  • fs: Sampling frequency
  • amp_ratio: Ratio of the wander amplitude relative to the original signal
  • freq_range: Frequency range of the wander (default: 0.05Hz - 0.3Hz
image

2. AddRespirationInterference

Simulates the inevitable respiration modulation effects in physiological signals.

  • resp_freq_range: Typical respiration frequency range (default: 0.2Hz - 0.4Hz)
image

3. AddMotionArtifact

Simulates burst, high-amplitude noise generated by intense user movement.

  • artifact_ratio: Intensity of the artifact
  • num_artifacts: Range for the number of generated artifacts
image

📄 License

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!

About

A lightweight, pure-NumPy data augmentation library for 1D physiological signals.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors