Automatic Detection of Atrial Fibrillation from Single-Lead ECG Using Deep Learning of the Cardiac Cycle

Alina Dubatovka, Joachim M. BuhmannBME 2022 · DOI

TL;DR

This paper introduces a novel deep learning framework for automatically detecting Atrial Fibrillation (AF) from single-lead ECG signals by modeling the cardiac cycle at two levels: individual heartbeats and overall rhythm. Their approach achieves state-of-the-art performance and offers improved interpretability, allowing cardiologists to better understand the basis of the diagnosis.

What Problem Does This Paper Address?

Atrial Fibrillation (AF) is a common and serious heart condition that significantly increases the risk of stroke. Early and accurate diagnosis is crucial for effective treatment. While Electrocardiograms (ECGs) are the primary tool for diagnosis, single-lead ECGs, often recorded by mobile devices, present challenges due to lower signal quality and variable recording lengths. Existing deep learning models, while powerful, often act as "black boxes," lacking interpretability, which is critical for medical professionals to trust and utilize their outputs. This paper aims to address these limitations by developing a robust, interpretable deep learning method for AF detection from single-lead ECGs.

Methods

The proposed method employs a three-step pipeline:

  1. Slicing and Encoding: The raw ECG signal is first segmented into individual heartbeats or short, R-peak aligned subsequences. These segments are then encoded using a modified DeepHeartBeat (DHB) autoencoder. The DHB framework is designed to learn interpretable features by disentangling the "pace" (heart rate variability) and "shape" (morphology) of heartbeats. The authors introduce two simplified versions:
  2. Pace-DeepHeartBeat (P-DHB): Aligns slices to R-peaks, removing the need for a separate "pace" parameter and focusing on heartbeat duration.
  3. Shape-DeepHeartBeat (S-DHB): Further simplifies by removing the "pace" parameter altogether, focusing solely on heartbeat shape.
  4. Aggregation: The encoded representations of individual heartbeats/subsequences are then aggregated to form a single, fixed-size representation for the entire ECG recording. Two aggregation strategies are explored:
  5. Averaging: A simple baseline approach.
  6. Recurrent Neural Network (RNN), specifically LSTM: This method captures the temporal dynamics and order of the heartbeat embeddings, providing a richer representation of heart rhythm.
  7. Classification: The aggregated signal representations are fed into a final deep neural network (DNN) classifier to predict the presence of AF. The classifier is trained to distinguish between four classes: normal sinus rhythm (NSR), AF, alternative rhythm, and noisy recordings.

Datasets

The study utilizes three publicly available ECG datasets for evaluation:

  • PhysioNet/Computing in Cardiology Challenge 2017 (Physionet Challenge): A large dataset of single-lead ECG recordings with varying lengths and four class labels (NSR, AF, alternative rhythm, noise). This dataset is particularly noted for its inclusion of noisy recordings, which the authors use to test the robustness of their model.
  • MIT-BIH Atrial Fibrillation Database (AFDB): Contains 2-channel ECG recordings with a focus on AF and NSR.
  • MIT-BIH Arrhythmia Database (MITDB): A more challenging dataset with 2-channel ECG recordings featuring a variety of rhythms, including ventricular bigeminy and trigeminy.

The autoencoder models were initially trained on the Physionet Challenge data and then reused for encoding heartbeats from the AFDB and MITDB datasets, demonstrating the transferability of learned representations.

Key Insights and Ideas

  • Two-Level Modeling is Key: The paper highlights the importance of modeling both individual heartbeat characteristics (shape, duration) and the overall heart rhythm for accurate AF detection.
  • Interpretable Features: The DHB framework's ability to disentangle "pace" and "shape" offers a degree of interpretability, allowing researchers to analyze what aspects of the heartbeat contribute to the diagnosis.
  • R-Peak Alignment Simplifies: Aligning subsequences to R-peaks (as in P-DHB) significantly improves reconstruction quality and simplifies the encoding process by removing the need for explicit pace estimation.
  • Shape Matters: The S-DHB variant, focusing solely on heartbeat shape, shows remarkable robustness, especially for noise detection, and excellent transferability across datasets, suggesting that heartbeat morphology carries crucial diagnostic information independent of precise timing.
  • RNN Aggregation Captures Rhythm: While averaging is a simple baseline, using an RNN (LSTM) for aggregation effectively captures the temporal dynamics of heart rhythm, leading to better classification performance.

Key Results

  • Superior AF Detection: The proposed methods, particularly S-DHB with RNN aggregation, achieve state-of-the-art performance on the Physionet Challenge dataset, reaching 97% accuracy. Similar high performance (over 90% accuracy) was observed on the AFDB and MITDB datasets.
  • Improved Reconstruction: Pace-DeepHeartBeat and Shape-DeepHeartBeat significantly outperform the original DeepHeartBeat in reconstructing individual heartbeats, especially with fewer latent dimensions.
  • Accurate Heart Rate Estimation: Pace-DeepHeartBeat provides a more accurate estimation of heart rate dynamics compared to the original DHB, particularly in cases of irregular heartbeats.
  • Robust Noise Detection: The S-DHB encoder, despite lower reconstruction quality, achieves a high AUC score (up to 0.91) for detecting noisy ECG signals, demonstrating its robustness.
  • Transferable Representations: Autoencoders trained on one dataset (Physionet Challenge) generalize well to new datasets (AFDB, MITDB) without further fine-tuning of the encoder, showcasing the learned features' utility.

Limitations and Future Work

  • Interpretability of Aggregation: While the heartbeat encoding is interpretable, the subsequent aggregation step (RNN) and the final classification remain largely black boxes. The authors suggest employing attention mechanisms in the RNN to gain insights into which parts of the signal are most influential for classification.
  • Causal Analysis: The current work focuses on correlation rather than causation. Future work could explore causal relationships between heartbeat features and AF.
  • Generalization to Other Rhythms: While the models are tested on different datasets, further exploration of their performance on a wider range of cardiac arrhythmias beyond AF would be beneficial.
  • Clinical Validation: While the results are promising, further validation in real-world clinical settings is necessary.

Summary updated

Abstract

<i>Objective and Impact Statement</i>. Atrial fibrillation (AF) is a serious medical condition that requires effective and timely treatment to prevent stroke. We explore deep neural networks (DNNs) for learning cardiac cycles and reliably detecting AF from single-lead electrocardiogram (ECG) signals. <i>Introduction</i>. Electrocardiograms are widely used for diagnosis of various cardiac dysfunctions including AF. The huge amount of collected ECGs and recent algorithmic advances to process time-series data with DNNs substantially improve the accuracy of the AF diagnosis. DNNs, however, are often designed as general purpose black-box models and lack interpretability of their decisions. <i>Methods</i>. We design a three-step pipeline for AF detection from ECGs. First, a recording is split into a sequence of individual heartbeats based on R-peak detection. Individual heartbeats are then encoded using a DNN that extracts interpretable features of a heartbeat by disentangling the duration of a heartbeat from its shape. Second, the sequence of heartbeat codes is passed to a DNN to combine a signal-level representation capturing heart rhythm. Third, the signal representations are passed to a DNN for detecting AF. <i>Results</i>. Our approach demonstrates a superior performance to existing ECG analysis methods on AF detection. Additionally, the method provides interpretations of the features extracted from heartbeats by DNNs and enables cardiologists to study ECGs in terms of the shapes of individual heartbeats and rhythm of the whole signals. <i>Conclusion</i>. By considering ECGs on two levels and employing DNNs for modelling of cardiac cycles, this work presents a method for reliable detection of AF from single-lead ECGs.
BibTeX
@inproceedings{dubatovka2022automatic,
  author = {Alina Dubatovka and Joachim M. Buhmann},
  title = {{Automatic Detection of Atrial Fibrillation from Single-Lead ECG Using Deep Learning of the Cardiac Cycle}},
  booktitle = {BME},
  year = {2022},
  doi = {10.34133/2022/9813062},
}
Figure