Self-supervised representation learning from 12-lead ECG data

Temesgen Mehari, Nils Strodthoff

TL;DR

This paper provides the first comprehensive assessment of self-supervised representation learning for 12-lead ECG data, demonstrating that models can learn to "understand" cardiac signals without human labels. By adapting techniques like Contrastive Predictive Coding (CPC), the researchers achieved performance nearly identical to fully supervised models while using significantly less labeled data and improving robustness against physiological noise.

What Problem Does This Paper Address?

Electrocardiograms (ECGs) are the backbone of cardiac diagnostics, yet training deep learning models to interpret them is hamstrung by label scarcity. While unlabeled ECG data is plentiful, high-quality clinical labels are expensive, time-consuming to produce, and often inconsistent even among experts.

The authors address whether self-supervised learning (SSL)—which has revolutionized computer vision and natural language processing—can be effectively ported to the 1D, multi-channel world of clinical ECGs. The goal is to create "foundation" representations that make models more accurate, more data-efficient (label-efficient), and more resilient to the "noise" (like muscle tremors or breathing) common in clinical settings.

Methods

The researchers evaluated two primary flavors of self-supervised learning:

  1. Instance Discrimination (SimCLR, BYOL, SwAV): These methods take an ECG signal, create two slightly different "views" of it using data augmentations, and train the model to recognize that they originated from the same record. The authors found that a combination of "Time Out" (zeroing out random segments) and "Random Resized Crop" was the most effective augmentation strategy for ECGs.
  2. Latent Forecasting (CPC): Contrastive Predictive Coding treats the ECG as a sequence. The model looks at the past segment of a signal and tries to predict the "latent" (hidden) representation of the future segment.

Key Innovation: The authors proposed an enhanced CPC architecture, adding a multi-layer perceptron (MLP) head and a two-step finetuning process (first training only the classification head, then the whole model with discriminative learning rates). They used the xresnet1d architecture, a 1D adaptation of the popular ResNet, as their backbone.

Datasets

The study utilized several major publicly available datasets:

  • PTB-XL: The primary benchmark, containing 21,837 clinical 12-lead ECGs with 71 different labels (diagnostic, form, and rhythm).
  • "All" Dataset: A massive collection of ~54,566 records used for pretraining, combining CinC2020, Chapman, and Ribeiro datasets.
  • CinC2020 w/o PTB-XL: Used specifically to test how well models generalize when the pretraining data has no overlap with the evaluation data.

Key Insights and Ideas

  • CPC is the King of ECG SSL: Unlike computer vision, where SimCLR-style methods often dominate, CPC (latent forecasting) proved superior for ECGs. This suggests that the sequential, temporal nature of cardiac signals is a more powerful "signal" for unsupervised learning than simple instance identity.
  • Closing the Gap: In "linear evaluation" (where the pretrained model is frozen and only a simple classifier is added), CPC reached a macro AUC of 0.927, just 0.5% shy of a fully supervised model.
  • Helping the "Hard" Classes: SSL provided the biggest performance boosts for rare diseases and categories where supervised models typically struggle. This is a huge win for clinical utility, where identifying rare but critical conditions is vital.
  • Stability and Robustness: SSL doesn't just improve accuracy; it makes training more stable (smaller error bars across runs) and makes models significantly more resistant to physiological noise when domain-specific noise is included during pretraining.

Key Results

  • Downstream Performance: Finetuning a CPC-pretrained model led to a 1% absolute improvement in macro AUC (0.9418) over the best purely supervised baseline (0.9318).
  • Label Efficiency: A pretrained model achieved the same performance as a standard supervised model while using only 60% of the labeled data.
  • Robustness: Models pretrained with physiological noise transformations showed a marked ability to maintain accuracy even when the test data was heavily corrupted by simulated baseline wander or muscle noise.

Limitations and Future Work

The authors acknowledge a few hurdles:

  • Computational Cost: CPC is computationally expensive. Pretraining a CPC model for 200 epochs took roughly 6 days on a Tesla V100 GPU, compared to less than a day for SimCLR/BYOL. This is due to the sequential nature of the LSTM used in CPC.
  • Dataset Overlap: While they attempted to disentangle the effects of dataset overlap, the complex mapping of labels (SNOMED codes) across different datasets makes it difficult to perfectly isolate the impact of seeing similar patients during pretraining.
  • Future Directions: The authors suggest exploring even larger models and investigating whether these SSL benefits hold true for even more "fine-grained" or rare clinical hierarchies.

Summary updated

Abstract

Highlights•Self-supervised representation learning is highly effective for 12-lead ECG data.•Most effective: adaptation of contrastive predictive coding from speech processing.•Benefits for finetuned models: improved quantitative performance and label efficiency.•Additional benefit: improved robustness against physiological noise.
BibTeX
@article{mehari2022self,
  author = {Temesgen Mehari and Nils Strodthoff},
  title = {{Self-supervised representation learning from 12-lead ECG data}},
  journal = {Computers in Biology and Medicine},
  year = {2022},
  doi = {10.1016/j.compbiomed.2021.105114},
}

Loading related content...

Figure