Skip to main content

Taking multi-channel PPG and Accelerometer signals as input, BeliefPPG predicts the instantaneous heart rate and provides an uncertainty estimate for the prediction.

Project description

BeliefPPG: Uncertainty-aware Heart Rate Estimation from PPG signals via Belief Propagation

BeliefPPG is a novel learning-based method that achieves state-of-the-art performance on several heart rate estimation benchmarks extracted from photoplethysmography signals (PPG). It considers the evolution of the heart rate in the context of a discrete-time stochastic process that is represented as a hidden Markov model. It derives a distribution over possible heart rate values for a given PPG signal window through a trained neural network. Using belief propagation, it incorporates the statistical distribution of heart rate changes to refine these estimates in a temporal context. From this, it obtains a quantized probability distribution over the range of possible heart rate values that captures a meaningful and well-calibrated estimate of the inherent predictive uncertainty.

Install

You can install the pip package using:

pip install beliefppg

Quick Start

To start inferring heart rate from PPG and accelerometer data, you first need to import the infer_hr function from the beliefppg package.

from beliefppg import infer_hr

sampling_rate = 128  # Hz (sampling rate of accelerometer and ppg sensor)

# Load data item containing the PPG, HR, and IMU signals --- challenging custom dataset
data = np.load('Data/example.npy', allow_pickle=True).item()

ppg = data['PPG head'].reshape((-1,1)) # reshape ppg to (n_samples, n_channels)
IMU_X = data['IMU X head']
IMU_Y = data['IMU Y head']
IMU_Z = data['IMU Z head']
acc = np.stack([IMU_X,IMU_X, IMU_Z], axis=-1)

y_pred, y_uncertainty, time_intervals = infer_hr(
    ppg=ppg, # PPG signal data with shape (n_samples, n_channels)
    acc=acc, # Accelerometer signal data with shape (n_samples, n_channels)
    ppg_freq=sampling_rate, # Sampling frequency of the PPG signal in Hz 
    acc_freq=sampling_rate, # Sampling frequency of the accelerometer signal in Hz
    decoding='sumproduct', # Decoding method to use, either "sumproduct" or "viterbi"
    use_time_backbone=True, # Whether to use the time-domain backbone or not
    uncertainty="std" # Metric for predictive uncertainty, either "entropy" or "std"
)
# The function returns predicted heart rates in BPM, uncertainties, and time intervals in seconds.

For a complete example demonstrating how to use BeliefPPG for heart rate inference, see the tutorial notebook.

Citation

If your find our paper or codes useful, please cite our work:

@InProceedings{uai2023-beliefppg,
    author={Bieri, Valentin and Streli, Paul and Demirel, Berken Utku and Holz, Christian},
    title = {BeliefPPG: Uncertainty-aware Heart Rate Estimation from PPG signals via Belief Propagation},
    year = {2023},
    organization={PMLR},
    booktitle = {Conference on Uncertainty in Artificial Intelligence (UAI)}
}

License and Acknowledgement

This project is released under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beliefppg-0.1.2.tar.gz (816.7 kB view details)

Uploaded Source

Built Distribution

beliefppg-0.1.2-py3-none-any.whl (818.4 kB view details)

Uploaded Python 3

File details

Details for the file beliefppg-0.1.2.tar.gz.

File metadata

  • Download URL: beliefppg-0.1.2.tar.gz
  • Upload date:
  • Size: 816.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for beliefppg-0.1.2.tar.gz
Algorithm Hash digest
SHA256 777e293fb8362caa58108a3b4fc1d9d09a8a9934f29ce413e644d6f3e4337d3f
MD5 9cf3bf520b9c8b60938cfbc2d0070c59
BLAKE2b-256 4b5d0d05a10a8b5e00b2a5b76b192b759b67007f50cdd50a5ba5d0d765a480ff

See more details on using hashes here.

File details

Details for the file beliefppg-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: beliefppg-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 818.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for beliefppg-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a20e43c3e41ed127674df306fc1f5d46da91e03698104e51eb30361901e5bf62
MD5 a9587e6ffcd28cb9140b0d1539f274ee
BLAKE2b-256 8039bc529211217058e7d97c52538c388e3296506232394d02f2c369c2f1f0ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page