DOI: 10.1093/europace/euag105.1221 ISSN: 1099-5129

A transformer-based approach for optimizing arrhythmia detection in clinical electrocardiograms

R Sriram, E Shahrabani, M Blunt, B Farrell, Z Loring, I Nenadic

Abstract

Background

Recent advances in deep learning have significantly advanced arrhythmia detection in 12-Lead Electrocardiograms (ECGs). Most existing models rely on convolutional neural networks (CNNs), which are effective for local feature extraction, but may struggle to capture long-range temporal relationships and inter-lead dependencies contained in ECG waveforms. Transformers leverage self-attention mechanisms and are well-suited for understanding global input relationships, offering an advantage over conventional CNN based approaches in ECG analysis, and may offer superior performance in multi-lead ECG interpretation.

Purpose

We evaluate the efficacy of transformers in arrhythmia detection from 12-Lead ECGs and towards the classification of Atrial Fibrillation (AF), Atrial Flutter (AFL), Supraventricular Tachycardia (SVT), Premature Atrial Complexes (PAC), and Premature Ventricular Complexes (PVC). We hypothesize the transformer model can maintain high performance in detection of these arrhythmias for the 12-Lead ECGs and match or exceed current CNN standards.

Methods

We created balanced positive and control cohorts for training, validation, and internal testing from the MIMIC-IV database for each respective arrhythmia mentioned above. Transformers were implemented in PyTorch and trained for binary classification of each arrhythmia. Five-fold cross-validation was performed to assess performance with ensemble testing on the held-out test set. Performance was evaluated using area under the ROC curve (AUC) and F1 score.

Results

The models had comparable performance across all classes. Internal testing resulted in AUCs of 0.96 ± 0.03 and F1 scores of 0.91 ± 0.05 across all classes. AF had the highest AUC of 0.98, while the model had the most difficulty with the discrimination of PACs, achieving an AUC of 0.92. The results meet the current discrimination benchmarks set by CNNs and have potential to exceed them.

Conclusions

Transformers are a viable alternative to CNNs and may have increased utility in the ECG machine learning space. Limited research has occurred with transformer models for ECG interpretation. Large academic studies and increased application of these models in the ECG machine learning space would allow for a better understanding of the benefits of this architecture.Cross-Validation AUC by Arrhythmia ClassTest Set Performance by Arrhythmia Class

More from our Archive