This repository contains the official implementation of the paper: "ApSense: Data-driven Algorithm in PPG-based Sleep Apnea Sensing"
ApSense is a novel deep learning approach for detecting Obstructive Sleep Apnea (OSA) events using fingertip Photoplethysmography (PPG) signals. The model demonstrates superior performance in OSA event recognition, particularly on high-variance datasets, while maintaining a relatively small model size.
- Request access to the MESA dataset
- Download the polysomnography (PSG) EDF files
- Use the provided
1_EDF_File_Extract_MESA.ipynb
script to extract PPG signals:
- Request access to the HeartBEAT dataset
- Download the PSG EDF files
- Use the provided
1_EDF_File_Extract_HeartBEAT.ipynb
script to extract PPG signals:
Run the feature extraction script to process the raw PPG signals:
2_Data_prep_MESA.ipynb
and 2_Data_prep_HeartBEAT.ipynb
This script extracts the following features:
- Pulse Wave Amplitude (PWA)
- PP Interval (PPI)
- Derivative of PWA (dPWA)
- Derivative of PPI (dPPI)
- Systolic Phase Duration (SPD)
- Diastolic Phase Duration (DPD)
- Pulse Area (PA)
The annotation process:
- Segments PPG signals into 60-second windows with 50% overlap
- Marks OSA events based on specialist annotations
- Aligns annotations with PPG windows
Train the ApSense model using:
python -u main.py \
--dataset mesa \
--model $YOUR_MODEL \
--dataset_dir $PATH_TO_YOUR_PROCESSED_DATASET \
--log_dir $LOG_DIR \
--weight_dir $WEIGHT_DIR \
--subsampling \
--gpu GPU_NUMBER \
> "stdout/mesa_${YOUR_MODEL}_aug.log" &
Configuration options in models/dsepnet.py
:
- Number of RVarDSepBlocks (M)
- LSTM Variational Dropout settings
- Branch CNN configuration
Evaluate the trained model:
python evaluate.py --dataset mesa \
--model $YOUR_MODEL \
--dataset_dir $PATH_TO_YOUR_PROCESSED_DATASET
The evaluation script reports:
- Accuracy
- Macro F1 Score
- Sensitivity
- Specificity
- AUROC
If you find this work useful, please cite our paper:
@article{choksatchawathi2024apsense,
title={ApSense: Data-Driven Algorithm in PPG-Based Sleep Apnea Sensing},
author={Choksatchawathi, Tanut and Sawadwuthikul, Guntitat and Thuwajit, Punnawish and Kaewlee, Thitikorn and Mateepithaktham, Thee and Saisaard, Siraphop and Sudhawiyangkul, Thapanun and Chaitusaney, Busarakum and Saengmolee, Wanumaidah and Wilaiprasitporn, Theerawit},
journal={IEEE Internet of Things Journal},
year={2024},
publisher={IEEE}
}
We thank the MESA and HeartBEAT studies for providing the datasets used in this research.