Automatic segmentation of atrial fibrillation and flutter in single-lead electrocardiograms by self-supervised learning and Transformer architecture

J Am Med Inform Assoc. 2023 Dec 22;31(1):79-88. doi: 10.1093/jamia/ocad219.

Abstract

Objectives: Automatic detection of atrial fibrillation and flutter (AF/AFL) is a significant concern in preventing stroke and mitigating hemodynamic instability. Herein, we developed a Transformer-based deep learning model for AF/AFL segmentation in single-lead electrocardiograms (ECGs) by self-supervised learning with masked signal modeling (MSM).

Materials and methods: We retrieved data from 11 open-source databases on PhysioNet; 7 of these databases included labeled ECGs, while the other 4 were without labels. Each database contained ECG recordings with durations of ≥30 s. A total of 24 intradialytic ECGs with paroxysmal AF/AFL during 4 h of hemodialysis sessions at Seoul National University Hospital were used for external validation. The model was pretrained by predicting masked areas of ECG signals and fine-tuned by predicting AF/AFL areas. Cross-database validation was used for evaluation, and the intersection over union (IOU) was used as a main performance metric in external database validation.

Results: In the 7 labeled databases, the areas marked as AF/AFL constituted 41.1% of the total ECG signals, ranging from 0.19% to 51.31%. In the evaluation per ECG segment, the model achieved IOU values of 0.9254 and 0.9477 for AF/AFL segmentation and other segmentation tasks, respectively. When applied to intradialytic ECGs with paroxysmal AF/AFL, the IOUs for the segmentation of AF/AFL and non-AF/AFL were 0.9896 and 0.9650, respectively. Model performance by different training procedure indicated that pretraining with MSM and the application of an appropriate masking ratio both contributed to the model performance. It also showed higher IOUs of AF/AFL labels than in previous studies when training and test databases were matched.

Conclusion: The present model with self-supervised learning by MSM performs robustly in segmenting AF/AFL.

Keywords: atrial fibrillation; atrial flutter; electrocardiogram; segmentation; self-supervised learning; transformer.

MeSH terms

  • Atrial Fibrillation* / diagnosis
  • Atrial Flutter* / diagnosis
  • Electrocardiography
  • Humans
  • Stroke*
  • Supervised Machine Learning