Electrocardiogram Classification and Visual Diagnosis of Atrial Fibrillation with DenseECG

Dacheng Chen, Dan Li, Xiuqin Xu, Ruizhi Yang, See-Kiong NgarXiv 2021

Abstract

Atrial Fibrillation (AF) is a common cardiac arrhythmia affecting a large number of people around the world. If left undetected, it can lead to chronic disability or early mortality. However, patients often remain asymptomatic in the early stages. A non-invasive, automatic, and effective detection method is essential for early intervention. Electrocardiogram (ECG) is the standard for detecting AF, but subtle patterns often require complex manual feature engineering. We present DenseECG, an end-to-end model based on a 5-layer 1D densely connected convolutional neural network. Trained on the 2017 PhysioNet Computing in Cardiology (CinC) Challenge dataset, DenseECG outperforms state-of-the-art models without the need for expert-supervised feature engineering.

Introduction

Atrial Fibrillation (AF) is a leading cause of stroke and heart failure. Despite its severity, it is often "silent," making early diagnosis challenging. While ECGs are the gold standard for diagnosis, interpretation remains subjective and difficult. Existing AI models for AF detection often rely on brittle, manually crafted features or act as "black boxes," providing no clinical justification for their decisions. In medical contexts, clinicians require traceable evidence to support treatment decisions.

Methods: The DenseECG Architecture

DenseECG addresses these challenges using a 1D Densely Connected Convolutional Network (DenseNet). Unlike models that convert ECGs into 2D spectrograms, DenseECG operates directly on raw 1D time-series data.

DenseECG architecture featuring 1D dense blocks and global average pooling for explainability.

The architecture utilizes five "dense blocks" where each layer is connected to every subsequent layer, encouraging feature reuse and mitigating vanishing gradients. A critical component is the replacement of traditional fully connected layers with a Global Average Pooling (GAP) layer. This enables the generation of Class Activation Maps (CAM)—heatmaps that highlight the specific segments of the ECG wave the model prioritized for its diagnosis. To handle class imbalance, a class-weighting strategy was implemented in the loss function.

Datasets and Evaluation

The model was evaluated on two major benchmarks:

  1. 2017 PhysioNet/CinC Challenge: 8,528 single-lead ECG recordings (9–61 seconds) categorized as Normal, AF, Other, or Noisy.
  2. MIT-BIH Arrhythmia Database: Used to test generalizability across various cardiac arrhythmias on a beat-by-beat basis.

Results and Key Insights

DenseECG achieved state-of-the-art performance, reaching an F1 score of 0.880 on the PhysioNet 2017 dataset and an average accuracy of 94.70% on the MIT-BIH dataset.

Visual evidence of Atrial Fibrillation: The model identifies 'F waves' (highlighted in red), a key clinical marker.

Beyond accuracy, the model demonstrated clinical alignment. CAM heatmaps for "Normal" rhythms consistently highlighted the P-wave (the area preceding the QRS complex), which indicates normal atrial contraction. As shown in the visual diagnosis above, the model also successfully identifies F waves, a hallmark of AF. This suggests the model autonomously "learned" clinical rules from raw data. Furthermore, the model proved robust to noise, maintaining high performance even on short, noisy leads typical of wearable devices.

Conclusion

DenseECG provides a high-performance, explainable solution for AF detection. While the "Other" category remains a heterogeneous challenge, future work will focus on more granular arrhythmia labels and testing on long-term Holter monitor data to facilitate clinical deployment.

Summary updated

BibTeX
@misc{chen2021electrocardiogram,
  author = {Dacheng Chen and Dan Li and Xiuqin Xu and Ruizhi Yang and See-Kiong Ng},
  title = {{Electrocardiogram Classification and Visual Diagnosis of Atrial Fibrillation with DenseECG}},
  year = {2021},
  eprint = {2101.07535},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.07535},
}
Figure