Abstract
Rapid and reproducible interpretation of electrocardiograms (ECGs) is essential for distinguishing acute myocardial infarction from chronic infarction patterns, rhythm abnormalities, and normal recordings. This study presents a controlled comparison of three transfer-learned Vision Transformer architectures—DeiT-Small, Swin-Tiny, and ViT-Tiny—for four-class classification of 12-lead ECG report images. A total of 3,951 images were stratified into training (n = 3, 159), validation (n = 393), and independent test (n = 399) subsets representing abnormal heartbeat, history of myocardial infarction, myocardial infarction, and normal ECG. All models were initialized with ImageNet-pretrained weights and fine-tuned under the same input resolution, augmentation policy, optimizer, and stopping criterion. Performance was assessed using accuracy, macro-precision, macro-recall, macro-F1 score, parameter count, floating-point operations, and inference latency. DeiT-Small achieved the highest macro-F1 score (0.9971) with an accuracy of 0.9975, while ViT-Tiny reached the same accuracy and a macro-F1 score of 0.9969 using only 5.53 million parameters, 2.1493 GFLOPs, and 0.1275 ms per image. Swin-Tiny remained accurate (0.9825) but required the greatest computational cost. The DeiT-Small confusion matrix contained a single error, in which one normal ECG was assigned to the history-of-myocardial-infarction class. These findings indicate that compact global-attention models can retain near-perfect internal discrimination while substantially reducing computational demand. Nevertheless, patient-independent and multi-center external validation is required before clinical use.

This publication has 30 references indexed in Scilit: