Comparative Evaluation of BiLSTM, ResNet-1D, and Transformer Architectures for Automated ECG Arrhythmia Classification
Authors: Patil Manish Madhukar, Dr. Rocky Kumar
Certificate: View Certificate
Abstract
Cardiovascular disease remains a leading cause of global mortality, and continuous electrocardiogram (ECG) monitoring through wearable devices offers a practical pathway for the early detection of life-threatening arrhythmias. This study presents a controlled, comparative evaluation of three deep learning architectures—Bidirectional Long Short-Term Memory (BiLSTM), one-dimensional Residual Network (ResNet-1D), and the Transformer Encoder—for the automated classification of cardiac arrhythmias from single-lead ECG beat segments drawn from the MIT-BIH Arrhythmia Database. A total of 17,966 heartbeat segments were extracted and conditioned through a three-stage preprocessing pipeline comprising Butterworth band-pass filtering, Symlet-4 wavelet denoising, and Z-score normalization. The severe class imbalance inherent to arrhythmia data was corrected using the Synthetic Minority Over-sampling Technique (SMOTE), producing a balanced corpus of 50,000 samples distributed evenly across the five heartbeat classes defined by the Association for the Advancement of Medical Instrumentation (AAMI). All three architectures were trained under an identical regime and evaluated on a held-out test set using accuracy, precision, recall, weighted F1-score, the Matthews Correlation Coefficient, Cohen’s kappa, and macro-averaged ROC-AUC. ResNet-1D achieved the strongest overall performance, with a test accuracy of 98.74%, a Matthews Correlation Coefficient of 0.9843, and a macro-averaged ROC-AUC of 0.9995, outperforming BiLSTM (97.80% accuracy) and the Transformer Encoder (97.50% accuracy) across every metric in the evaluation suite. The results indicate that residual convolutional architectures provide the most favourable balance of aggregate accuracy and minority-class sensitivity for single-beat ECG classification, offering practical guidance for the design of accurate, wearable-deployable cardiac monitoring systems.
Introduction
Cardiovascular disease continues to represent one of the foremost causes of death worldwide, with cardiac arrhythmias contributing disproportionately to sudden and often preventable mortality (Siontis, Noseworthy, Attia, & Friedman, 2021). The electrocardiogram (ECG) remains the primary non-invasive diagnostic instrument for detecting abnormal cardiac rhythms, capturing the electrical activity of the heart as a time-varying waveform whose morphology encodes clinically meaningful information about the origin and propagation of each heartbeat. Traditional ECG interpretation relies on the visual expertise of cardiologists and trained technicians who examine the P-wave, QRS complex, and T-wave of each beat to identify departures from normal sinus rhythm. While manual interpretation remains the clinical gold standard, it does not scale to the volume of data generated by continuous, long-duration monitoring, particularly in ambulatory or home settings where patients may wear recording devices for days or weeks at a time. This mismatch between the volume of recorded data and the availability of expert reviewers has motivated decades of research into automated ECG analysis, an effort that has accelerated markedly with the maturation of deep learning methods capable of learning discriminative representations directly from raw or lightly processed physiological signals (Hannun et al., 2019; Ribeiro et al., 2020). The present study is situated within this broader effort, focusing specifically on the comparative evaluation of modern neural network architectures for the automated classification of heartbeats into clinically standardized arrhythmia categories.
Conclusion
This study presented a controlled, quantitative comparison of three deep learning architectures—BiLSTM, ResNet-1D, and the Transformer Encoder—for the automated classification of cardiac arrhythmias from single-lead ECG beat segments. Using a rigorously preprocessed and SMOTE-balanced corpus derived from the MIT-BIH Arrhythmia Database, all three architectures achieved strong aggregate performance, each exceeding 97% test accuracy and 0.998 macro-averaged ROC-AUC, confirming that the three-stage preprocessing pipeline and class-balancing strategy successfully produced a clean, discriminative training corpus from which any of the three architectural paradigms could learn effective decision boundaries. Among the three, ResNet-1D consistently achieved the best performance across every metric examined, including accuracy (98.74%), the Matthews Correlation Coefficient (0.9843), Cohen’s kappa (0.9842), and macro-averaged ROC-AUC (0.9995), and it delivered its largest relative advantage specifically on the clinically important Supraventricular, Ventricular, and Fusion classes. These findings suggest that the hierarchical, multi-scale feature extraction enabled by residual skip connections is particularly well matched to the morphological structure of single-beat ECG classification, converging faster and generalising better than either the sequential recurrent processing of the BiLSTM or the data-hungry self-attention mechanism of the Transformer Encoder under a constrained training budget. These results carry direct implications for the design of wearable and edge-deployable cardiac monitoring systems. By establishing the accuracy ceiling attainable by three representative, uncompressed architectures under tightly controlled conditions, this study provides a reference point against which the accuracy cost of subsequent model compression—through pruning, quantization, or knowledge distillation—can be meaningfully assessed for deployment on resource-constrained wearable hardware. The consistently strong performance of ResNet-1D, combined with its comparatively favourable convergence behaviour and moderate parameter count relative to the Transformer, positions it as a particularly promising candidate architecture for subsequent compression and edge deployment within Internet of Medical Things cardiac monitoring applications. Several limitations should be acknowledged. The Supraventricular class was represented by only two genuine beats in the raw data, so its synthetic training distribution was derived from a single pair of seed points; the correspondingly high recall reported for this class should therefore be interpreted with appropriate caution pending validation on a larger sample of genuine supraventricular beats. In addition, the study relies on single-beat classification without access to inter-beat timing information, which limits the discriminability of prematurely timed supraventricular beats from morphologically similar normal beats. Future work should extend the present comparison to multi-beat or rhythm-level classification incorporating RR-interval context, evaluate the compressed, quantized variants of the three architectures on genuine microcontroller-class hardware, and validate the findings on independent, multi-centre ECG datasets to establish the generalisability of the reported performance beyond the MIT-BIH corpus.
References
1. Acharya, U. R., Oh, S. L., Hagiwara, Y., Tan, J. H., Adam, M., Gertych, A., & Tan, R. S. (2017). A deep convolutional neural network model to classify heartbeats. Computers in Biology and Medicine, 89, 389–396. 2. Che, C., Zhang, P., Zhu, M., Qu, Y., & Jin, B. (2021). Constrained transformer network for ECG signal processing and arrhythmia classification. BMC Medical Informatics and Decision Making, 21(1), 184. 3. Chen, C., Hua, Z., Zhang, R., Liu, G., & Wen, W. (2020). Automated arrhythmia classification based on a combination network of CNN and LSTM. Biomedical Signal Processing and Control, 57, 101819. 4. Elreedy, D., & Atiya, A. F. (2019). A comprehensive analysis of synthetic minority oversampling technique (SMOTE) for handling class imbalance. Information Sciences, 505, 32–64. 5. Faust, O., Shenfield, A., Kareem, M., San, T. R., Fujita, H., & Acharya, U. R. (2018). Automated detection of atrial fibrillation using long short-term memory network with RR interval signals. Computers in Biology and Medicine, 102, 327–335. 6. Hannun, A. Y., Rajpurkar, P., Haghpanahi, M., Tison, G. H., Bourn, C., Turakhia, M. P., & Ng, A. Y. (2019). Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nature Medicine, 25(1), 65–69. 7. He, K., Zhang, X., Ren, S., & Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (pp. 770–778). IEEE. 8. Hu, R., Chen, J., & Zhou, L. (2022). A transformer-based deep neural network for arrhythmia detection using continuous ECG signals. Computers in Biology and Medicine, 144, 105325. 9. Islam, M. S., Hasan, K. F., Sultana, S., Uddin, S., Quinn, J. M. W., & Moni, M. A. (2023). HARDC: A novel ECG-based heartbeat classification method to detect arrhythmia using hierarchical attention based dual structured RNN with dilated CNN. Neural Networks, 162, 271–287. 10. Kachuee, M., Fazeli, S., & Sarrafzadeh, M. (2018). ECG heartbeat classification: A deep transferable representation. In Proceedings of the 2018 IEEE International Conference on Healthcare Informatics (pp. 443–444). IEEE. 11. Le, M. D., Rathour, V. S., Truong, Q. S., Mai, Q., Brijesh, P., & Le, N. (2021). Multi-module recurrent convolutional neural network with transformer encoder for ECG arrhythmia classification. In 2021 IEEE EMBS International Conference on Biomedical and Health Informatics (pp. 1–5). IEEE. 12. Meng, L., Tan, W., Ma, J., Wang, R., Yin, X., & Zhang, Y. (2022). Enhancing dynamic ECG heartbeat classification with lightweight transformer model. Artificial Intelligence in Medicine, 124, 102236. 13. Mousavi, S., & Afghah, F. (2019). Inter- and intra-patient ECG heartbeat classification for arrhythmia detection: A sequence to sequence deep learning approach. In Proceedings of ICASSP 2019 (pp. 1308–1312). IEEE. 14. Ray, P. P. (2022). A review on TinyML: State-of-the-art and prospects. Journal of King Saud University – Computer and Information Sciences, 34(4), 1595–1623. 15. Ribeiro, A. H., Ribeiro, M. H., Paixão, G. M. M., Oliveira, D. M., Gomes, P. R., Canazart, J. A., ... Ribeiro, A. L. P. (2020). Automatic diagnosis of the 12-lead ECG using a deep neural network. Nature Communications, 11, 1760. 16. Sellami, A., & Hwang, H. (2019). A robust deep convolutional neural network with batch-weighted loss for heartbeat classification. Expert Systems with Applications, 122, 75–84. 17. Siontis, K. C., Noseworthy, P. A., Attia, Z. I., & Friedman, P. A. (2021). Artificial intelligence-enhanced electrocardiography in cardiovascular disease management. Nature Reviews Cardiology, 18(7), 465–478. 18. Varghese, A., Kamal, S., & Kurian, J. (2023). Transformer-based temporal sequence learners for arrhythmia classification. Medical & Biological Engineering & Computing, 61(8), 1993–2000. 19. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, ?., & Polosukhin, I. (2017). Attention is all you need. Advances in Neural Information Processing Systems, 30, 5998–6008. 20. Wang, B., Liu, C., Hu, C., Liu, X., & Cao, J. (2021). Arrhythmia classification with heartbeat-aware transformer. In Proceedings of ICASSP 2021 (pp. 1025–1029). IEEE. 21. Warden, P., & Situnayake, D. (2019). TinyML: Machine learning with TensorFlow Lite on Arduino and ultra-low-power microcontrollers. O’Reilly Media.
Copyright
Copyright © 2024 Patil Manish Madhukar. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.