Multiclass Arrhythmia Classification from Imbalanced ECG Data Using Encoded Transformer based CNN-LSTM Hybrid Model

PDF (1243KB), PP.68-83

Views: 0 Downloads: 0

Author(s)

Md Sohel Hasan 1,* A. B. M. Aowlad Hossain 1

1. Department of Electronics and Communication Engineering, Khulna University of Engineering & Technology, Khulna-9203, Bangladesh

* Corresponding author.

DOI: https://doi.org/10.5815/ijisa.2025.05.05

Received: 18 May 2025 / Revised: 11 Jul. 2025 / Accepted: 21 Aug. 2025 / Published: 8 Oct. 2025

Index Terms

ECG Arrhythmia, Encoded Transformer, Convolutional Neural Network, Long Short-term Memory Model, SMOTE

Abstract

Arrhythmias are irregularities in heartbeats and hence accurate classification of arrhythmia has great importance for administering patients to the right cardiac care. This paper presents a five-class arrhythmia classification framework using Encoded Transformer (ET) based Convolutional Neural Network and Long Short-Term Memory (CNN-ET-LSTM) hybrid model to ECG signal. The dataset used in this research is the widely used MIT-BIH arrhythmia database that has five distinct types of arrhythmia: non-ectopic beats (N), ventricular ectopic beats (V), supraventricular ectopic beats (S), fusion beats (F), and unknown beats (Q). The class imbalance problem is dealt by utilizing Synthetic Minority Oversampling Technique (SMOTE) that has an impact for bettering the performance especially on minority classes. In the proposed CNN-ET-LSTM model, the CNN is used as a feature extractor and the long range dependencies in the ECG waveform are captured by the encoded transformer module. The LSTM layers are used to processes features sequentially to feed them to the fully connected layers for classification.  Experimental results showed that the proposed system achieved an accuracy of 97.52%, precision of 97.80%, recall of 97.52% and F1-score of 97.62% with raw blind test data. The performance of our model is also compared to other existing methods that use the same dataset and found useful for clinical applications.

Cite This Paper

Md Sohel Hasan, A. B. M. Aowlad Hossain, "Multiclass Arrhythmia Classification from Imbalanced ECG Data Using Encoded Transformer based CNN-LSTM Hybrid Model", International Journal of Intelligent Systems and Applications(IJISA), Vol.17, No.5, pp.68-83, 2025. DOI:10.5815/ijisa.2025.05.05

Reference

[1]M. Lindstrom et al., “Global burden of cardiovascular diseases and risks collaboration, 1990-2021,” Journal of the American College of Cardiology, vol. 80, no. 25, pp. 2372–2425, Dec. 2022, doi: 10.1016/j.jacc.2022.11.001.
[2]M. Di Cesare et al., “The heart of the world,” Global Heart, vol. 19, no. 1, Jan. 2024, doi: 10.5334/gh.1288.
[3]G. Krishnan et al., “Artificial intelligence in clinical medicine: catalyzing a sustainable global healthcare paradigm,” Frontiers in Artificial Intelligence, vol. 6, Aug. 2023, doi: 10.3389/frai.2023.1227091.
[4]Z. Ebrahimi, M. Loni, M. Daneshtalab, and A. Gharehbaghi, “A review on deep learning methods for ECG arrhythmia classification,” Expert Systems With Applications X, vol. 7, p. 100033, Sep. 2020, doi: 10.1016/j.eswax.2020.100033.
[5]V. Singh, U. S. Reddy, and G. M. Bhargavia, “A generic and robust system for automated detection of different classes of arrhythmia,” Procedia Computer Science, vol. 167, pp. 1801–1810, Jan. 2020, doi: 10.1016/j.procs.2020.03.199.
[6]S. M. Jadhav, S. L. Nalbalwar, and A. A. Ghatol, “Artificial neural network models based cardiac arrhythmia disease diagnosis from ECG signal data,” International Journal of Computer Applications, vol. 44, no. 15, pp. 8–13, Apr. 2012, doi: 10.5120/6338-8532.
[7]A. M. Alqudah, S. Qazan, L. Al-Ebbini, H. Alquran, and I. A. Qasmieh, “ECG heartbeat arrhythmias classification: a comparison study between different types of spectrum representation and convolutional neural networks architectures,” Journal of Ambient Intelligence and Humanized Computing, vol. 13, no. 10, pp. 4877–4907, Apr. 2021, doi: 10.1007/s12652-021-03247-0.
[8]U. R. Acharya et al., “A deep convolutional neural network model to classify heartbeats,” Computers in Biology and Medicine, vol. 89, pp. 389–396, Oct. 2017, doi: 10.1016/j.compbiomed.2017.08.022.
[9]S. U. Hassan, M. S. M. Zahid and K. Husain, “Performance comparison of CNN and LSTM algorithms for arrhythmia classification,” 2020 International Conference on Computational Intelligence (ICCI), Bandar Seri Iskandar, Malaysia, 2020, pp. 223-228, doi: 10.1109/ICCI51257.2020.9247636.
[10]P. Madan, V. Singh, D. P. Singh, M. Diwakar, B. Pant, and A. Kishor, “A hybrid deep learning approach for ECG-based arrhythmia classification,” Bioengineering, vol. 9, no. 4, p. 152, Apr. 2022, doi: 10.3390/bioengineering9040152.
[11]X. Xu, S. Jeong, and J. Li, “Interpretation of Electrocardiogram (ECG) rhythm by combined CNN and BILSTM,” IEEE Access, vol. 8, pp. 125380–125388, Jan. 2020, doi: 10.1109/access.2020.3006707.
[12]B. Pourbabaee, M. J. Roshtkhari, and K. Khorasani, “Deep convolutional neural networks and learning ECG features for screening paroxysmal atrial fibrillation patients,” IEEE Transactions on Systems Man and Cybernetics Systems, vol. 48, no. 12, pp. 2095–2104, Dec. 2018, doi: 10.1109/tsmc.2017.2705582.
[13]S. Savalia and V. Emamian, “Cardiac arrhythmia classification by Multi-Layer Perceptron and Convolution neural Networks,” Bioengineering, vol. 5, no. 2, p. 35, May 2018, doi: 10.3390/bioengineering5020035.
[14]Y. Xia, N. Wulan, K. Wang, and H. Zhang, “Detecting atrial fibrillation by deep convolutional neural networks,” Computers in Biology and Medicine, vol. 93, pp. 84–92, Feb. 2018, doi: 10.1016/j.compbiomed.2017.12.007.
[15]W. Liu et al., “Real-Time multilead convolutional neural network for myocardial infarction detection,” IEEE Journal of Biomedical and Health Informatics, vol. 22, no. 5, pp. 1434–1444, Sep. 2018, doi: 10.1109/jbhi.2017.2771768.
[16]Y. Dong, M. Zhang, L. Qiu, L. Wang, and Y. Yu, “An Arrhythmia Classification Model Based on Vision Transformer with Deformable Attention,” Micromachines, vol. 14, no. 6, p. 1155, May 2023, doi: 10.3390/mi14061155.
[17]S. Singh, S. K. Pandey, U. Pawar, and R. R. Janghel, “Classification of ECG arrhythmia using recurrent neural networks,” Procedia Computer Science, vol. 132, pp. 1290–1297, Jan. 2018, doi: 10.1016/j.procs.2018.05.045.
[18]M. A. Khan and Y. Kim, “Cardiac arrhythmia disease classification using lstm deep learning approach,” Computers, Materials & Continua/Computers, Materials & Continua, vol. 67, no. 1, pp. 427–443, Jan. 2021, doi: 10.32604/cmc.2021.014682.
[19]A. Rath, D. Mishra, G. Panda, and S. C. Satapathy, “Heart disease detection using deep learning methods from imbalanced ECG samples,” Biomedical Signal Processing and Control, vol. 68, p. 102820, Jul. 2021, doi: 10.1016/j.bspc.2021.102820.
[20]M. F. Wahid and A. B. M. Aowlad Hossain, “Classification of diabetic retinopathy from OCT images using deep convolutional neural network with BiLSTM and SVM,” 2021 12th International Conference on Computing Communication and Networking Technologies (ICCCNT), Kharagpur, India, 2021, pp. 1-5, doi: 10.1109/ICCCNT51525.2021.9579901.
[21]A. R. Sajun, I. Zualkernan, and D. Sankalpa, “A historical survey of advances in transformer architectures,” Applied Sciences, vol. 14, no. 10, p. 4316, May 2024, doi: 10.3390/app14104316
[22]G. B. Moody and R. G. Mark, “The impact of the MIT-BIH Arrhythmia Database,” IEEE Engineering in Medicine and Biology Magazine, vol. 20, no. 3, pp. 45–50, Jan. 2001, doi: 10.1109/51.932724.
[23]A. L. Goldberger et al., “PhysioBank, PhysioToolkit, and PhysioNet,” Circulation, vol. 101, no. 23, Jun. 2000, doi: 10.1161/01.cir.101.23.e215.
[24]S. M. A. Ullah and A. B. M. A. Hossain, “Hypertension prediction using stacked ensemble model from imbalanced clinical data,” 2024 International Conference on Advances in Computing, Communication, Electrical, and Smart Systems (iCACCESS), Dhaka, Bangladesh, 2024, pp. 1-5, doi: 10.1109/iCACCESS61735.2024.10499627.
[25]N. V. Chawla, K. W. Bowyer, L. O. Hall, and W. P. Kegelmeyer, “SMOTE: Synthetic minority over-sampling technique,” Journal of Artificial Intelligence Research, vol. 16, pp. 321–357, Jun. 2002, doi: 10.1613/jair.953.
[26]S. Kiranyaz, O. Avci, O. Abdeljaber, T. Ince, M. Gabbouj, and D. J. Inman, “1D convolutional neural networks and applications: A survey,” Mechanical Systems and Signal Processing, vol. 151, p. 107398, Apr. 2021, doi: 10.1016/j.ymssp.2020.107398.
[27]D. Soydaner, “Attention mechanism in neural networks: where it comes and where it goes,” Neural Computing and Applications, vol. 34, no. 16, pp. 13371–13385, May 2022, doi: 10.1007/s00521-022-07366-3.
[28]Y. -L. Hsieh, et al. “On the robustness of self-attentive models” Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 2019.
[29]A. B. M. A. Hossain and M. A. Haque, “Analysis of noise sensitivity of different ECG detection algorithms,” International Journal of Electrical and Computer Engineering (IJECE), vol. 3, no. 3, Jun. 2013, doi: 10.11591/ijece.v3i3.2516.
[30]M. M. H. Mishu, A. B. M. A. Hossain and M. E. A. Emon, "Denoising of ECG signals using dual tree complex wavelet transform," 2014 17th International Conference on Computer and Information Technology (ICCIT), Dhaka, Bangladesh, 2014, pp. 379-382, doi: 10.1109/ICCITechn.2014.7073141.
[31]S. Hochreiter and J. Schmidhuber, "Long Short-Term Memory," in Neural Computation, vol. 9, no. 8, pp. 1735-1780, 15 Nov. 1997, doi: 10.1162/neco.1997.9.8.1735.
[32]M. Jahiruzzaman and A. B. M. A. Hossain, “ECG based biometric human identification using chaotic encryption,” 2015 International Conference on Electrical Engineering and Information Communication Technology (ICEEICT), Savar, Bangladesh, 2015, pp. 1-5, doi: 10.1109/ICEEICT.2015.7307417.
[33]S. Ioffe and C. Szegedy, “Batch normalization: Accelerating deep network training by reducing internal covariate shift,” arXiv, Jan. 2015, doi: 10.48550/arxiv.1502.03167.
[34]M. Kachuee, S. Fazeli and M. Sarrafzadeh, “ECG heartbeat classification: a deep transferable representation,” 2018 IEEE International Conference on Healthcare Informatics (ICHI), New York, NY, USA, 2018, pp. 443-444, doi: 10.1109/ICHI.2018.00092.
[35]B. Pyakillya, N. Kazachenko, and N. Mikhailovsky, “Deep learning for ECG classification,” Journal of Physics Conference Series, vol. 913, p. 012004, Oct. 2017, doi: 10.1088/1742-6596/913/1/012004.
[36]M. Salem, S. Taheri and J. Yuan, “ECG arrhythmia classification using transfer learning from 2- dimensional deep CNN features,” 2018 IEEE Biomedical Circuits and Systems Conference (BioCAS), Cleveland, OH, USA, 2018, pp. 1-4, doi: 10.1109/BIOCAS.2018.8584808.
[37]J. Zhu, J. Lv, and D. Kong, “CNN-FWS: a model for the diagnosis of normal and abnormal ECG with feature adaptive,” Entropy, vol. 24, no. 4, p. 471, Mar. 2022, doi: 10.3390/e24040471.