Detection of Paroxysmal Atrial Fibrillation from Dynamic ECG Recordings Based on a Deep Learning Model

Yating Hu, Tengfei Feng, Miao Wang, Chengyu Liu, Hong Tang

TL;DR

This paper introduces a novel deep learning model that accurately detects Paroxysmal Atrial Fibrillation (AF) from short ECG recordings, not only identifying the presence of AF but also pinpointing its exact start and end times. This advancement is crucial for better AF management and diagnosis, especially for asymptomatic patients.

What Problem Does This Paper Address?

Atrial Fibrillation (AF) is a common heart arrhythmia that significantly increases the risk of stroke and other cardiovascular issues. Diagnosing AF, particularly the paroxysmal (intermittent) form, is challenging because it can occur unpredictably and for short durations. Traditional methods, like resting ECGs or even Holter monitors, can be time-consuming and may miss brief AF episodes. This necessitates more efficient and accurate detection methods, especially for dynamic, wearable ECG devices, to improve patient outcomes and reduce the burden on healthcare systems.

Methods

The researchers developed a deep learning model that combines residual blocks and a Transformer encoder.

  • Residual Blocks: These are used for hierarchical feature extraction from the ECG signals. They help in learning complex patterns within the data while mitigating the vanishing gradient problem common in deep networks.
  • Transformer Encoder: This component is key for capturing long-range dependencies and positional information within the ECG signal. Unlike recurrent networks, Transformers can process sequences in parallel, making them efficient. The model uses a multi-head self-attention mechanism within the Transformer to weigh the importance of different parts of the ECG signal.
  • Preprocessing: The ECG data undergoes several preprocessing steps, including baseline wander removal, high-frequency noise filtering, and R-peak detection. Crucially, the ECG samples are time-scaled to a fixed length (600 data points) to emphasize waveform characteristics, and AF onset/offset are defined by the R-peaks of the heartbeats immediately before and after an AF episode.

Datasets

The study utilized several publicly available datasets for training and testing:

  • CPSC2021 Challenge dataset: Used for training and validation. This dataset consists of dynamic ECG recordings with labeled AF events.
  • MIT-BIH Arrhythmia Database (MITDB): A widely used benchmark for arrhythmia detection.
  • Long-Term AF Database (LTAF): Contains long-term ECG recordings of subjects with paroxysmal or sustained AF.
  • MIT-BIH Atrial Fibrillation Database (AFDB): Specifically curated for AF detection.
  • CinC2017 dataset: A single-lead ECG dataset from the PhysioNet/CinC Challenge.

Key Insights and Ideas

  • Beyond Rhythm Classification: The paper moves beyond simply classifying an ECG segment as AF or non-AF. It emphasizes the critical importance of detecting the precise onset and offset of AF episodes, which is vital for quantifying AF burden.
  • Transformer for ECG: Applying Transformer architectures, known for their success in natural language processing and computer vision, to ECG analysis shows promise in capturing complex temporal dependencies in cardiac signals.
  • Interpretability through Heatmaps: The use of heatmaps to visualize which parts of the ECG signal the model focuses on provides valuable insights into its decision-making process, enhancing trust and understanding of the model's predictions. This revealed that the model pays attention to specific waveform features, like T-waves, which might be overlooked by traditional methods.
  • Robustness to Noise: The study includes noise stress tests, demonstrating that the model maintains reasonable performance even in the presence of common noise types like white noise, EMG, and motion artifacts, which is crucial for real-world wearable device applications.

Key Results

  • AF Rhythm Detection: The model achieved excellent performance on the CPSC2021 test set, with an accuracy of 98.15%, sensitivity of 98.06%, and specificity of 98.31%. Across public datasets, the best performance for AF rhythm testing reached an accuracy of 98.67%, sensitivity of 87.69%, and specificity of 98.56%.
  • Onset and Offset Detection: The model demonstrated strong capabilities in detecting AF boundaries, achieving a sensitivity of 95.90% for onset detection and 87.70% for offset detection.
  • Low False Positive Rate: The algorithm reported a low False Positive Rate (FPR) of 0.46%, indicating its ability to significantly reduce false alarms, a common issue in AF detection.
  • Noise Performance: The model showed adaptability to noisy environments, with performance degradation only at very low Signal-to-Noise Ratios (SNR).

Limitations and Future Work

  • Data Limitations: The training data primarily consisted of Normal Sinus Rhythm (NSR) and AF, with limited exposure to other complex arrhythmias. This could potentially limit the model's performance on ECGs with more diverse and unusual rhythms.
  • Lead Dependency: The model's performance might be affected when trained on specific leads (e.g., lead I and II) and then tested on data from other leads, as observed with MITDB and LTAF.
  • Future Work: The authors suggest incorporating all 12 leads of ECG data into the training set to improve generalizability. Further research could also explore the model's performance with more complex arrhythmias and in more challenging noisy environments. The interpretability provided by heatmaps also opens avenues for further understanding the physiological basis of AF detection.

Summary updated

Abstract

The data used for training were obtained from the CPSC2021 Challenge, and were collected using dynamic ECG devices. Tests on four public datasets validated the availability of the proposed method. The best performance for AF rhythm testing attained an accuracy of 98.67%, a sensitivity of 87.69%, and a specificity of 98.56%. In onset and offset detection, it obtained a sensitivity of 95.90% and 87.70%, respectively. The algorithm with a low FPR of 0.46% was able to reduce troubling false alarms. The model had a great capability to discriminate AF from normal rhythm and to detect its onset and offset. Noise stress tests were conducted after mixing three types of noise. We visualized the model's features using a heatmap and illustrated its interpretability. The model focused directly on the crucial ECG waveform where showed obvious characteristics of AF.
BibTeX
@article{hu2023detection,
  author = {Yating Hu and Tengfei Feng and Miao Wang and Chengyu Liu and Hong Tang},
  title = {{Detection of Paroxysmal Atrial Fibrillation from Dynamic ECG Recordings Based on a Deep Learning Model}},
  journal = {Journal of Personalized Medicine},
  year = {2023},
  doi = {10.3390/jpm13050820},
}
Figure