Transferability and Adversarial Training in Automatic Classification of the Electrocardiogram with Deep Learning

Anders Eriksson, Thomas B. Schön, Antônio H. RibeiroComputing 2024

Abstract

Automatic electrocardiogram (ECG) analysis using deep neural networks has seen promising results in recent years. However, these models are susceptible to domain shifts when they are applied to new data distributions not previously trained on. We investigate how training on worst-case artificial samples through adversarial training can help promote models that can easily be molded through fine-tuning to new datasets. We compare the area under the precision-recall curve (AUPRC) for the classification of atrial fibrillation using two cohorts: we use PTB-XL for training and CODE-15% for fine-tuning and evaluating the models. Our results show that adversarially trained models on ECG data yield higher transferability when fine-tuned on new datasets compared to normally trained models (0.732 vs. 0.685 AUPRC). We also note that they even have the ability to supersede models solely trained on the new dataset using more total time and data (0.732 vs. 0.685 AUPRC). Our work thus paves the way for the training of general models that can be applied to different types of new settings with high performance.

Introduction

Deep learning has demonstrated significant potential in the automated analysis of electrocardiograms (ECGs), particularly for detecting conditions such as atrial fibrillation (AFib). Despite these advances, a critical challenge remains: domain shift. Models trained on data from a specific clinical environment often suffer performance degradation when deployed in new settings with different hardware or patient demographics.

While fine-tuning is a standard approach to adapt models to new domains, medical data labeling is resource-intensive. This study explores whether adversarial training—typically a defense mechanism against malicious attacks—can serve as a robust regularizer. The hypothesis is that forcing models to learn from "worst-case" perturbations encourages the development of generalized features that facilitate more efficient transfer learning.

Methodology

The researchers utilized a ResNet architecture optimized for 1-dimensional ECG signals. The training pipeline incorporates a min-max optimization strategy to enhance robustness and transferability.

Adversarial Training Loop

The core of the methodology involves generating adversarial noise during the training phase. Using Auto-Projected Gradient Descent (APGD), the system identifies the minimal perturbation ($\delta$) that induces a misclassification. The model is then trained to minimize loss on these adversarial examples, effectively playing a "game" against an adversary that maximizes error.

Diagram of the adversarial training process, where adversarial noise is generated and fed back into the model training loop.

Experimental Setup and Datasets

Two primary ECG cohorts were used:

  • PTB-XL: A public dataset containing 21,799 12-lead ECG records, used as the source domain for initial pre-training.
  • CODE-15%: A subset of the Clinical Outcomes in Digital Electrocardiography dataset from Brazil, comprising over 345,000 records, used for fine-tuning and evaluation.

The transfer learning pipeline compared models trained under standard regimes against those trained with varying levels of adversarial perturbation ($\epsilon$).

Results and Discussion

The performance was evaluated using the Area Under the Precision-Recall Curve (AUPRC) for AFib classification.

Enhanced Transferability

The results indicate that adversarial pre-training significantly improves performance on the target domain. As shown in the table below, the adversarially trained model with $\epsilon = 0.01$ achieved an AUPRC of 0.732, outperforming the standard baseline of 0.685.

Summary of training and fine-tuning results across different datasets and adversarial regimes.

Data Efficiency and Robustness

A key finding is the increased data efficiency of robust models. An adversarially pre-trained model fine-tuned on only 5% of the target data can match the performance of a standard model using 10%. Furthermore, the study observed a "sweet spot" for adversarial noise; while $\epsilon = 0.01$ improved transferability, a higher $\epsilon = 0.05$ led to a slight decline in clean performance (0.684 AUPRC), highlighting a trade-off between extreme robustness and general accuracy.

Conclusion and Future Directions

Adversarial training proves to be a powerful tool for improving the generalizability of ECG classification models. By learning more robust representations, these models adapt more effectively to new clinical environments.

However, the computational cost of generating adversarial samples remains a hurdle. Future research should focus on optimizing training speed using techniques like FastAT. Additionally, expanding this approach to multi-label classification and other cardiac abnormalities will be essential for broader clinical adoption.

Summary updated

BibTeX
@inproceedings{eriksson2024transferability,
  author = {Anders Eriksson and Thomas B. Schön and Antônio H. Ribeiro},
  title = {{Transferability and Adversarial Training in Automatic Classification of the Electrocardiogram with Deep Learning}},
  booktitle = {Computing},
  year = {2024},
  doi = {10.22489/cinc.2024.096},
}
Figure