A clean, professional, production-quality implementation of deep-learning-based Remote Photoplethysmography (rPPG) and PPG-to-ABP (Arterial Blood Pressure) estimation models using PyTorch.
Important
Disclaimer: This project is created for R&D purposes. It is not intended for commercial use or production systems. It is maintained strictly for educational and portfolio purposes only.
This repository provides a comprehensive pipeline for extracting physiological signals (like heart rate and pulse wave) from facial videos using Remote Photoplethysmography (rPPG), and estimating continuous Arterial Blood Pressure (ABP) waveforms from raw PPG signals.
- Facial Image-Based rPPG Models:
- DeepPhys: Video-Based Physiological Measurement Using Convolutional Attention Networks.
- PhysNet: Remote Photoplethysmograph Signal Measurement from Facial Videos.
- 3D-PhysNet: Spatio-Temporal Networks for remote heart rate estimation.
- PhysNet + LSTM / 2D-PhysNet + LSTM integrations.
- PPG-to-ABP Estimation:
- PP-Net: Deep Learning Framework for PPG-based Blood Pressure (SBP/DBP) and Heart Rate estimation.
- vid2bp: Dedicated subsystem for continuous waveform-level blood pressure prediction.
- pyVHR Integration: An assessment tool suite for comparing different Region-of-Interest (ROI) selections.
- Docker Support: Containerized environment for instant reproduction and execution.
- WandB Logging: Built-in support for experimental tracking and performance logging.
Non-contact health monitoring (rPPG) and cuffless continuous blood pressure estimation (PPG-to-ABP) are key frontiers in digital health. This repository standardizes these models to make them reproducible, easy to deploy, and clean for academic or industrial review.
The codebase is split into two primary components:
- rPPG Modeling: Processes facial video datasets (like UBFC, LGI_PPGI) to compute heart rate, BVP (Blood Volume Pulse), and respiratory signals.
- vid2bp: Processes raw PPG signals to output full Arterial Blood Pressure (ABP) waveforms.
graph TD
A[Facial Video Input] --> B[pyVHR / Face Detection]
B --> C[rPPG Deep Learning Models]
C --> D[BVP Signal / Heart Rate]
E[Raw PPG Signal] --> F[vid2bp Pipeline]
F --> G[Continuous ABP Waveform SBP/DBP]
Below is a graph showing how respiration modulates the PPG signal in three ways (baseline, amplitude, and frequency):
- Configuration: Load configuration settings from params.py or environment variable overrides.
- Preprocessing: Parse raw video/signal data and write optimized files (.h5 formats) using scripts in utils/.
- Training/Validation: Run deep learning models via PyTorch train loops in main.py or vid2bp/main.py.
- Evaluation: Generate statistics, plots, and log metrics to Weights & Biases (WandB).
.
├── CAM/ # Class Activation Map utils
├── dataset/ # Dataset loader definitions
├── docs/ # Original specifications and system architecture diagrams
├── nets/ # Core neural network architectures (models, blocks, layers)
├── pyVHR/ # Custom Video Heart Rate framework integration
├── pytorch_grad/ # Gradient computation helpers
├── pytorch_grad_cam/ # Grad-CAM visualization toolkit
├── utils/ # Preprocessing, training, and helper functions
├── vid2bp/ # Subsystem for PPG to Arterial Blood Pressure estimation
├── .env.example # Template environment configuration file
├── Dockerfile # Docker container environment definition
├── LICENSE # Open-source MIT License
├── README.md # This documentation file
├── _1_rppg_assesment.py # Main entry point for pyVHR ROI assessment
├── main.py # Main training/evaluation script
├── params.py # Global model/dataset parameters configuration
└── requirements.txt # Python dependency manifest
- Framework: PyTorch & PyTorch Ignite
- Face Processing: MediaPipe & OpenCV
- Signal Processing: SciPy, MNE, PyEMD
- Visualization: Matplotlib, Plotly
- Experiment Logging: Weights & Biases (WandB)
- Clone the repository:
git clone https://github.com/remotebiosensing/rppg.git cd rppg - Create and activate a virtual environment:
python -m venv .venv # Windows: .venv\Scripts\activate # Linux/macOS: source .venv/bin/activate
- Install Dependencies:
pip install --upgrade pip pip install -r requirements.txt
To run the models in a fully containerized environment with GPU acceleration support:
- Build the Docker Image:
docker build -t rppg-toolbox:latest . - Run the Container (with CUDA GPU support):
docker run --gpus all -it --env-file .env rppg-toolbox:latest
Duplicate .env.example to .env and fill in your local system directories:
cp .env.example .env| Variable Name | Description | Default |
|---|---|---|
SAVE_ROOT_PATH |
Path where preprocessed datasets are saved | /media/hdd1/dy/dataset/ |
DATA_ROOT_PATH |
Base directory containing raw video folders | /media/hdd1/ |
MODEL_ROOT_PATH |
Base directory where trained checkpoints are stored | /media/hdd1/dy/model/ |
WANDB_PROJECT_NAME |
Weights & Biases project name | torch_2023ICCV |
WANDB_ENTITY |
Weights & Biases account name | daeyeolkim |
CUDA_VISIBLE_DEVICES |
GPU index to utilize for training | 0 |
To preprocess data, select a model, and execute training:
- Adjust parameters inside params.py or via environment variables.
- Run the main training loop:
python main.py
Evaluate different region-of-interest (ROI) masking methods on LGI_PPGI or UBFC datasets:
python _1_rppg_assesment.pyTo train/evaluate the blood pressure estimation models:
cd vid2bp
python main.py- OpenCV / MediaPipe Graphics Link Issues (Docker):
If you get
libGL.so.1: cannot open shared object filein containerized environments, ensure the system dependencies in theDockerfilebuilt successfully (libgl1-mesa-glxis present). - CUDA Out of Memory:
Reduce
batch_sizein params.py (e.g. from 32 to 16 or 8). - Missing pyVHR dependencies:
Please make sure
requirements.txthas been fully installed in your virtual environment.
This project is licensed under the MIT License - see the LICENSE file for details.
