Self-supervised inter-intra period-aware ECG representation learning for detecting atrial fibrillation

Xiangqian Zhu, Mengnan Shi, Xuexin Yu, Chang Liu, Xiaocong Lian, Jintao Fei, Jiangying Luo, Xin Jin, Ping Zhang, Xiangyang Ji

TL;DR

Researchers have developed a novel self-supervised learning (SSL) framework for ECG signals that incorporates medical domain knowledge to detect Atrial Fibrillation (AF). By designing "inter-period" and "intra-period" pretext tasks, the model learns to recognize irregular heart rhythms and missing P-waves without requiring massive labeled datasets, significantly outperforming standard deep learning approaches in detecting difficult-to-spot paroxysmal AF.

What Problem Does This Paper Address?

Atrial Fibrillation (AF) is a leading cause of stroke and heart failure, characterized by irregular heartbeats. While persistent AF is relatively easy to diagnose, paroxysmal AF (AFp)—which comes and goes intermittently—is notoriously difficult to catch.

Current AI solutions for ECG analysis face two major hurdles:

  1. The Labeling Bottleneck: Training deep learning models requires vast amounts of data annotated by expert cardiologists, which is expensive and time-consuming.
  2. Lack of Domain Knowledge: Generic self-supervised models (like those used in computer vision) often fail to capture the specific physiological markers of AF, such as the subtle absence of a P-wave or the specific statistical "jitter" in the timing between heartbeats (RR intervals).

Methods

The authors propose an inter-intra period-aware ECG representation learning approach. Instead of just looking at the raw signal, the model is forced to learn two specific concepts during a "pre-training" phase using unlabeled data:

  • Inter-period Awareness (The Rhythm): The model must predict the mean and standard deviation of RR intervals (the time between R-peaks). This forces the encoder to "pay attention" to the regularity (or irregularity) of the heart's rhythm.
  • Intra-period Awareness (The Morphology): The researchers use a contrastive learning strategy. They decompose a multi-period ECG into single-period segments and create a "stable morphology" by taking the median of these segments (which filters out noise). The model is then trained to align the representation of the full, noisy signal with this clean, single-beat version. This teaches the model to recognize the presence or absence of specific waves (like the P-wave) within a single cycle.

The architecture uses a 34-layer ResNet as the primary multi-period encoder and a 3-layer dilated CNN for single-period analysis.

Datasets

The study utilized three distinct datasets to validate the model:

  • BTCH (Private): Collected from Beijing Tsinghua Changgung Hospital, containing 15,695 records from 7,676 patients, including Normal, Persistent AF (AFf), and Paroxysmal AF (AFp) labels.
  • CinC2017 (Public): A standard benchmark from the PhysioNet/Computing in Cardiology Challenge.
  • CPSC2021 (Public): From the 4th China Physiological Signal Challenge, specifically useful for distinguishing between paroxysmal and persistent AF.

Key Insights and Ideas

  • Domain-Specific Pretext Tasks Matter: Standard SSL methods (like SimCLR) use random augmentations like flipping or adding noise. This paper shows that tasks designed around medical priors (RR intervals and P-wave morphology) result in much more robust features for clinical diagnosis.
  • The "Stable Morphology" Trick: By using the median of aligned heartbeats to create a "clean" reference, the model learns to ignore transient noise while focusing on the underlying structural health of the heartbeat.
  • Superiority in the "Low-Data" Regime: The model performs significantly better than supervised models when labeled training data is scarce. This is crucial for rare conditions or new clinical settings where labels are hard to come by.

Key Results

  • State-of-the-Art Performance: On the BTCH dataset, the model achieved an AUC of 0.953 for paroxysmal AF detection, outperforming other SSL methods like SimCLR (0.927) and MCL (0.946).
  • Generalization: The model maintained high performance on public datasets, hitting an AUC of 0.991 on CinC2017 and 0.946 on CPSC2021 (AFp).
  • Lead Scalability: The model proved effective even with reduced data, such as single-lead or two-lead ECGs, which is promising for wearable devices (like smartwatches) that don't have the full 12-lead capability of a hospital machine.

Limitations and Future Work

  • Focus on AF: The current pretext tasks are specifically tuned for Atrial Fibrillation. While effective, they might not be as optimal for other arrhythmias (like PVCs or heart blocks) that have different morphological signatures.
  • Computational Complexity: The process of isolating R-waves and decomposing signals into single periods adds a preprocessing step that generic models don't require.
  • Future Directions: The authors plan to extend this "period-aware" logic to other cardiovascular diseases and further optimize the model for real-time monitoring on wearable hardware.

Summary updated

BibTeX
@article{zhu2025self,
  author = {Xiangqian Zhu and Mengnan Shi and Xuexin Yu and Chang Liu and Xiaocong Lian and Jintao Fei and Jiangying Luo and Xin Jin and Ping Zhang and Xiangyang Ji},
  title = {{Self-supervised inter-intra period-aware ECG representation learning for detecting atrial fibrillation}},
  journal = {Biomedical Signal Processing and Control},
  year = {2025},
  doi = {10.1016/j.bspc.2024.106939},
}
Figure