Improving Diffusion Models for ECG Imputation with an Augmented Template Prior

Alexander Jenkins, Zehua Chen, Fu Siong Ng, Danilo P. MandicarXiv 2023 · DOI

Abstract

Electrocardiogram (ECG) monitoring is vital for modern healthcare, yet data collected from wearable devices often suffer from missing segments due to sensor detachment or packet loss. While denoising diffusion probabilistic models (DDPMs) excel at generating realistic time-series data, they often fail to leverage the inherent quasi-periodic structure of cardiac signals. We introduce PulseDiff, a framework that conditions diffusion models on a personalized, augmented heartbeat template and a rhythm confidence score. By incorporating subject-specific morphology and accounting for rhythm variability, PulseDiff achieves state-of-the-art performance in ECG imputation, particularly for transient signal loss, outperforming existing deterministic and probabilistic baselines in both reconstruction accuracy and downstream diagnostic utility.

Introduction

The rise of mobile health (mHealth) has made continuous ECG monitoring accessible, but the resulting data is frequently corrupted by missing segments. These gaps typically fall into two categories: transient loss (short bursts of missing data) and extended loss (prolonged gaps). Traditional deterministic models often fail to capture the natural variability of cardiac signals, while standard probabilistic diffusion models lack the domain-specific "prior knowledge" of the heart's repeating patterns.

Methodology: The PulseDiff Framework

PulseDiff addresses these limitations by guiding the diffusion process—specifically using models like CSDI or SSSD—with a three-pillar "Template Prior" approach.

1. Subject-Level Template Extraction

Instead of a generic average, PulseDiff extracts a personalized pulse template from the available segments of a patient's own ECG. This ensures the model respects the unique morphology of the individual's cardiac activity.

Extraction of a personalized pulse template from the observed ECG signal.

2. Condition Augmentation and Rhythm Confidence

To avoid over-fitting to a rigid pattern, the template is stochastically augmented in position and amplitude. Furthermore, a Rhythm Confidence Score is calculated based on beat-to-beat variability. For patients with irregular rhythms (e.g., arrhythmias), this score instructs the model to rely less on the template, preventing the imposition of a false regular rhythm.

Experimental Setup

The framework was evaluated using the PTB-XL dataset, comprising over 21,000 clinical ECG recordings. The researchers tested the model on various missingness patterns and validated the results through both reconstruction error (MSE) and downstream clinical tasks, such as automated diagnosis and beat detection.

Key Results

PulseDiff significantly outperforms existing state-of-the-art (SOTA) models. For transient missingness, PulseDiff-SSSD achieved an MSE of 0.0021, nearly halving the error of the leading deterministic transformer, BDC Trans (0.0043).

Visual comparison of ECG imputation across different models for transient and extended loss patterns.

Beyond simple reconstruction, the "informed prior" provided by PulseDiff led to higher F1 scores in beat detection and improved AUC in diagnostic classification. The qualitative results demonstrate that PulseDiff captures the realistic "texture" and variability of the ECG signal more effectively than vanilla diffusion or deterministic baselines.

Discussion and Future Work

While PulseDiff excels at transient gaps, its performance on extended missingness is currently comparable to deterministic models, suggesting that capturing very long-range dependencies remains a challenge for diffusion-based methods. Future research will focus on reducing the computational cost of iterative sampling and extending the template-prior approach to other physiological signals like Photoplethysmography (PPG).

Summary updated

BibTeX
@misc{jenkins2023improving,
  author = {Alexander Jenkins and Zehua Chen and Fu Siong Ng and Danilo P. Mandic},
  title = {{Improving Diffusion Models for ECG Imputation with an Augmented Template Prior}},
  year = {2023},
  eprint = {2310.15742},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.15742},
}
Figure