Table of Contents
Fetching ...

Robust and Generalizable Atrial Fibrillation Detection from ECG Using Time-Frequency Fusion and Supervised Contrastive Learning

Hongtao Li, Jia Wei, Jia Xiao, Yuanjun Lai, Mingyang Liu, Shuzhen Lv, Xueqiang Ouyang

TL;DR

A cross-modal deep learning framework comprising two key components: a Bidirectional Gating Module (BGM) and a Cross-modal Supervised Contrastive Learning (CSCL) strategy, which achieves both high intra-dataset robustness and excellent cross-dataset generalization.

Abstract

Atrial fibrillation (AF) is a common cardiac arrhythmia that significantly increases the risk of stroke and heart failure, necessitating reliable and generalizable detection methods from electrocardiogram (ECG) recordings. Although deep learning has advanced automated AF diagnosis, existing approaches often struggle to exploit complementary time-frequency information effectively, limiting both robustness under intra-dataset and generalization across diverse clinical datasets. To address these challenges, we propose a cross-modal deep learning framework comprising two key components: a Bidirectional Gating Module (BGM) and a Cross-modal Supervised Contrastive Learning (CSCL) strategy. The BGM facilitates dynamic, reciprocal refinement between time and frequency domain features, enhancing model robustness to signal variations within a dataset. Meanwhile, CSCL explicitly structures the joint embedding space by pulling together label-consistent samples and pushing apart different ones, thereby improving inter-class separability and enabling strong cross-dataset generalization. We evaluate our method through five-fold cross-validation on the AFDB and the CPSC2021 dataset, as well as bidirectional cross-dataset experiments (training on one and testing on the other). Results show consistent improvements over state-of-the-art methods across multiple metrics, demonstrating that our approach achieves both high intra-dataset robustness and excellent cross-dataset generalization. We further demonstrate that our method achieves high computational efficiency and anti-interference capability, making it suitable for edge deployment.

Robust and Generalizable Atrial Fibrillation Detection from ECG Using Time-Frequency Fusion and Supervised Contrastive Learning

TL;DR

A cross-modal deep learning framework comprising two key components: a Bidirectional Gating Module (BGM) and a Cross-modal Supervised Contrastive Learning (CSCL) strategy, which achieves both high intra-dataset robustness and excellent cross-dataset generalization.

Abstract

Atrial fibrillation (AF) is a common cardiac arrhythmia that significantly increases the risk of stroke and heart failure, necessitating reliable and generalizable detection methods from electrocardiogram (ECG) recordings. Although deep learning has advanced automated AF diagnosis, existing approaches often struggle to exploit complementary time-frequency information effectively, limiting both robustness under intra-dataset and generalization across diverse clinical datasets. To address these challenges, we propose a cross-modal deep learning framework comprising two key components: a Bidirectional Gating Module (BGM) and a Cross-modal Supervised Contrastive Learning (CSCL) strategy. The BGM facilitates dynamic, reciprocal refinement between time and frequency domain features, enhancing model robustness to signal variations within a dataset. Meanwhile, CSCL explicitly structures the joint embedding space by pulling together label-consistent samples and pushing apart different ones, thereby improving inter-class separability and enabling strong cross-dataset generalization. We evaluate our method through five-fold cross-validation on the AFDB and the CPSC2021 dataset, as well as bidirectional cross-dataset experiments (training on one and testing on the other). Results show consistent improvements over state-of-the-art methods across multiple metrics, demonstrating that our approach achieves both high intra-dataset robustness and excellent cross-dataset generalization. We further demonstrate that our method achieves high computational efficiency and anti-interference capability, making it suitable for edge deployment.
Paper Structure (26 sections, 15 equations, 7 figures, 6 tables)

This paper contains 26 sections, 15 equations, 7 figures, 6 tables.

Figures (7)

  • Figure 1: Spectrogram of the cleaned ECG segment generated via STFT, encoded as a three-channel heatmap for frequency-domain modeling. In the time domain, AFIB is characterized by the absence of P waves and highly irregular R-R intervals. In the frequency domain (STFT spectrogram), it exhibits a diffuse and chaotic spectral pattern.
  • Figure 2: (a) The full multimodal network for AF detection; (b) The BGM enabling dynamic interaction between time- and frequency-domain features; (c) The CSCL that enforces discriminative embedding alignment across modalities.
  • Figure 3: Illustration of the ECG data augmentation strategies applied in our experiments. (a) Original 10-second ECG segment; (b) with added Gaussian noise; (c) with random time masking; (d) with amplitude scaling; (e) with time zoom in; (f) with time zoom out.
  • Figure 4: Five-fold cross-validation results on two datasets across six metrics (Accuracy, AUC, F1-score, Precision, Recall and Specificity).
  • Figure 5: Accuracy and AUC versus $\lambda_{\text{cont}}$ on CPSC2021 (intra) and CPSC2021 $\to$ AFDB (cross).
  • ...and 2 more figures