Heartbeat classification by using a convolutional neural network trained with Walsh functions

  • Zümray DokurEmail author
  • Tamer Ölmez
Original Article


From recent studies, it is observed that convolutional neural networks are proved to be extremely successful in classification problems. Accurate and fast classification of electrocardiogram (ECG) beats is a crucial step in the implementation of real-time arrhythmia diagnosis systems. In this study, convolutional neural networks are employed to classify eleven different ECG beat types in the MIT-BIH arrhythmia database. We aimed to implement a computer-aided mobile diagnosis system equipped with artificial intelligence that detects the classes of heartbeats by visual inspection of the ECG records in the manner as the cardiologists do. Since doctors make their decisions basing heavily on the 2D visual appearances of the ECG signals without doing numerical calculations on 1D time samples, 2D images of 1D ECG records were given to the classifier as the input data. It would not be surprising that the structure of the network classifying 2D ECG data has to be larger than the one used to classify 1D ECG signals. The small size of a neural network is an important property for real-time use of the system. In this study, smaller network structures that provide high performances using the Walsh functions (WF), and drawbacks of converting 1D signals to 2D images have been investigated. The network structures using the WF during the training stage have been applied to different databases and successful results have been obtained. Classification results and sizes of the network structures are compared for the ECG beats in one dimension and in the form of 2D visuals. The training of ECG signals in the form of 2D visuals takes much longer time than that of the 1D signals. However, it is observed that training and testing times of both networks were quite fast. Moreover, average success rates of 99% were achieved for all beat types by using small-size networks.


Heartbeat classification Convolutional neural networks Deep learning Walsh function 



This work is supported by the Istanbul Technical University Scientific Research Project Unit (ITU-BAP Project No. MYL-2018-41621). The authors would like to thank student intern Bora Elci for his support in the necessary installations for preparing and reading ECG records of the MIT-BIH arrhythmia database using Python programs running on a workstation in the Medical Electronics Laboratory at Istanbul Technical University.

Compliance with ethical standards

Conflict of interest

The authors declare that there is no conflict of interests regarding the publication of this paper.


  1. 1.
    Alajlan N, Bazi Y, Melgani F, Malek S, Bencherif MA (2014) Detection of premature ventricular contraction arrhythmias in electrocardiogram signals with kernel methods. Signal Image Video Process 8:931–942CrossRefGoogle Scholar
  2. 2.
    Alonso-Atienza F, Morgado E, Fernandez-Martinez L, Garcia-Alberola A, Rojo-Alvarez JL (2014) Detection of life-threatening arrhythmias using feature selection and support vector machines. IEEE Trans Biomed Eng 61:832–840CrossRefGoogle Scholar
  3. 3.
    Javadi M, Arani SAAA, Sajedin A, Ebrahimpour R (2013) Classification of ECG arrhythmia by a modular neural network based on mixture of experts and negatively correlated learning. Biomed Signal Process Control 8:289–296CrossRefGoogle Scholar
  4. 4.
    Wang J, Ye Y, Pan X, Gao X (2015) Parallel-type fractional zero-phase filtering for ECG signal denoising. Biomed Signal Process Control 18:36–41CrossRefGoogle Scholar
  5. 5.
    Yadav SK, Sinha R, Bora PK (2015) Electrocardiogram signal denoising using non-local wavelet transform domain filtering. IET Signal Process 9:88–96CrossRefGoogle Scholar
  6. 6.
    Bono V, Mazomenos EB, Chen T, Rosengarten JA, Acharyya A, Maharatna K et al (2014) Development of an automated updated Selvester QRS scoring system using SWT-based QRS fractionation detection and classification. IEEE J Biomed Health Inform 18:193–204CrossRefGoogle Scholar
  7. 7.
    Phukpattaranont P (2015) QRS detection algorithm based on the quadratic filter. Expert Syst Appl 42:4867–4877CrossRefGoogle Scholar
  8. 8.
    De Chazal P, O’Dwyer M, Reilly M (2004) Automatic classification of heartbeats using ECG morphology and heartbeat interval features. IEEE Trans Biomed Eng 51:1196–1206CrossRefGoogle Scholar
  9. 9.
    Dima S-M, Panagiotou C, Mazomenos EB, Rosengarten JA, Maharatna K, Gialelis JV et al (2013) On the detection of myocadial scar based on ECG/VCG analysis. IEEE Trans Biomed Eng 60:3399–3409CrossRefGoogle Scholar
  10. 10.
    De Chazal P, Reilly RB (2006) A patient-adapting heartbeat classifier using ECG morphology and heartbeat interval features. IEEE Trans Biomed Eng 53:2535–2543CrossRefGoogle Scholar
  11. 11.
    Kutlu Y, Kuntalp D (2012) Feature extraction for ECG heartbeats using higher order statistics of WPD coefficients. Comput Methods Progr Biomed 105:257–267CrossRefGoogle Scholar
  12. 12.
    Yang H, Kan C, Liu G, Chen Y (2013) Spatiotemporal differentiation of myocardial infarctions. IEEE Trans Autom Sci Eng 10:938–947CrossRefGoogle Scholar
  13. 13.
    de Lannoy G, Francois D, Delbeke J, Verleysen M (2012) Weighted conditional random fields for supervised interpatient heartbeat classification. IEEE Trans Biomed Eng 59:241–247CrossRefGoogle Scholar
  14. 14.
    Chang P-C, Lin J-J, Hsieh J-C, Weng J (2012) Myocardial infarction classification with multi-lead ECG using hidden Markov models and Gaussian mixture models. Appl Soft Comput 12:3165–3175CrossRefGoogle Scholar
  15. 15.
    Martis RJ, Acharya UR, Min LC (2013) ECG beat classification using PCA, LDA, ICA and discrete wavelet transform. Biomed Signal Process Control 8:437–448CrossRefGoogle Scholar
  16. 16.
    Jiang W, Kong SG (2007) Block-based neural networks for personalized ECG signal classification. IEEE Trans Neural Netw 18:1750–1761CrossRefGoogle Scholar
  17. 17.
    Wang JS, Chiang WC, Hsu YL, Yang YTC (2013) ECG arrhythmia classification using a probabilistic neural network with a feature reduction method. Neurocomputing 116:38–45CrossRefGoogle Scholar
  18. 18.
    Dutta S, Chatterjee A, Munshi S (2010) Correlation technique and least square support vector machine combine for frequency domain based ECG beat classification. Med Eng Phys 32:1161–1169CrossRefGoogle Scholar
  19. 19.
    Luz EJS, Nunes TM, de Albuquerque VHV, Papa JP, Menotti D (2013) ECG arrhythmia classification based on optimum-path forest. Expert Syst Appl 40:3561–3573CrossRefGoogle Scholar
  20. 20.
    Melgani F, Bazi Y (2008) Detecting premature ventricular contractions in ECG signals with Gaussian processes. In: Computer in cardiology, pp 237–240Google Scholar
  21. 21.
    Sannino G, Pietro G (2018) A deep learning approach for ECG-based heartbeat classification for arrhythmia detection. Future Gen Comput Syst 86:446–455CrossRefGoogle Scholar
  22. 22.
    Rahhal MM, Bazi Y, AlHichri H, Alajlan N, Melgani F, Yager RR (2016) Deep learning approach for active classification of electrocardiogram signals. Inf Sci 345:340–354CrossRefGoogle Scholar
  23. 23.
    Jun TJ, Park HJ, Kim YH (2016) Premature ventricular contraction beat detection with deep neural networks. In: 15th IEEE international conference on machine learning and applications, pp 859–864Google Scholar
  24. 24.
    Zhou L, Van V, Qin X, Yuan C, Que D, Wang L (2016) Deep learning-based classification of massive electrocardiography data. In: IEEE advanced information management, communicates, electronic and automation control conference, pp 780–785Google Scholar
  25. 25.
    Pourbabaee B, Roshtkhariand MJ, Khorasani K (2017) Deep convolutional neural networks and learning ECG features for screening paroxysmal atrial fibrillation patients. IEEE Trans Syst Man Cybern Syst 2017:1–10Google Scholar
  26. 26.
    Wu Z, Ding X, Zhang G, Xu X, Wang X, Tao Y, Ju C (2016) A novel features learning method for ECG arrhythmias using deep belief networks. In: 6th international conference on digital home, pp 192–196Google Scholar
  27. 27.
    Assodiky H, Syarif I, Badriyah T (2017) Deep learning algorithm for arrhythmia detection. In: International electronics symposium on knowledge creation and intelligent computing, pp 26–32Google Scholar
  28. 28.
    Xia Y, Zhang H, Xu L, Gao Z, Zhang H, Liu H, Li S (2018) An automatic cardiac arrhythmia classification system with wearable electrocardiogram. IEEE J Mag 6:16529–16538Google Scholar
  29. 29.
    Ji J, Chen X, Luo C, Li P (2018) A deep multi-task learning Approach for ECG data analysis. In: IEEE EMBS international conference on biomedical & health informatics (BHI), pp 124–127Google Scholar
  30. 30.
    Paul T, Chakraborty A, Kundu S (2018) Hybrid shallow and deep learned feature mixture model for arrhythmia classification. In: Electric electronics, computer science, biomedical engineerings’ meeting (EBBT)Google Scholar
  31. 31.
    Acharya UR, Oh SL, Hagiwara Y, Tan JH, Adam M, Gertych A, Tan RS (2017) A deep convolutional neural network model to classify heartbeats. Comput Biol Med 89:389–396CrossRefGoogle Scholar
  32. 32.
    Kachuee M, Fazeli S, Sarrafzadeh M (2018) ECG heartbeat classification: a deep transferable representation. In: IEEE international conference on healthcare informatics, pp 443–444Google Scholar
  33. 33.
    Pyakillya B, Kazachenkoand N, Mikhailovsky N (2017) Deep learning for ECG classification. IOP Conf Ser J Phys 913:012004CrossRefGoogle Scholar
  34. 34.
    Wu Y, Yang F, Liu Y, Zha X, Yuan S (2018) A comparison of 1-D and 2-D deep convolutional neural networks in ECG classification. In: Conference proceedings: IEEE engineering in medicine and biology society, pp 324–327Google Scholar
  35. 35.
    Jun TJ, Nguyen HM, Kang D, Kim D, Kim DY, Kim YH (2018) ECG arrhythmia classification using a 2-D convolutional neural network. Comput Vis Pattern Recognit. arXiv:1804.06812
  36. 36.
    Rubin J, Abreu R, Ganguli A, Nelaturi S, Matei I, Sricharan K (2016) Classifying heart sound recordings using deep convolutional neural networks and mel-frequency cepstral coefficients. In: Computing in cardiology conference (CinC), pp 813–816Google Scholar
  37. 37.
    Park C, ChoiG, Kim JY, Kim S, Kim TJ, Min K, Jung KY, Chong J (2018) Epileptic seizure detection for multi-channel EEG with deep convolutional neural network. In: International conference on electronics, information, and communicationGoogle Scholar
  38. 38.
    Abbas W, Khan NA (2018) DeepMI: Deep learning for multiclass motor imagery classification. In: 40th annual international conference of the IEEE engineering in medicine and biology society, pp 219–222Google Scholar
  39. 39.
    Liu Y, Lin Y, Gao S, Zhang H, Wang Z, Gao Y, Chen G (2017) Respiratory sounds feature learning with deep convolutional neural networks, pp 170–177.
  40. 40.
    Hur T, Bang J, Huynh-The T, Lee J, Kim J-I, Lee S (2018) Iss2Image: a novel signal-encoding technique for CNN-based human activity recognition. Sensors 18:3910CrossRefGoogle Scholar
  41. 41.
    Han S, Pool J, Tran J, Dally W (2015) Learning both weights and connections for efficient neural network. In: Advances in neural information processing systems, pp 1135–1143Google Scholar
  42. 42.
    Han S, Mao H, Dally WJ (2015) Deep compression: Compressing deep neural networks with pruning, trained quantization and Huffman coding. arXiv:1510.00149
  43. 43.
    Gong Y, Liu L, Yang M, Bourdev L (2014) Compressing deep convolutional networks using vector quantization. arXiv:1412.6115
  44. 44.
    Ba J, Caruana R, (2014) Do deep nets really need to be deep? In: Advances in neural information processing systems, 27Google Scholar
  45. 45.
    Chen W, Wilson J, Tyree S, Weinberger K, Chen Y (2015) Compressing neural networks with the hashing trick. In: International conference on machine learning, pp 2285–2294Google Scholar
  46. 46.
    Moody GB, Mark RG (2001) The impact of the MIT-BIH arrhythmia database. IEEE Eng Med Biol 20(3):45–50CrossRefGoogle Scholar
  47. 47.
    Jiang W, Kong SG (2007) Block-based neural networks for personalized ECG signal classification. IEEE Trans Neural Netw 18(6):1750–1761CrossRefGoogle Scholar
  48. 48.
    Ince T, Kiranyaz S, Gabbouj M (2009) A generic and robust system for automated patient-specific classification of ECG signals. IEEE Trans Biomed Eng 56(5):1415–1426CrossRefGoogle Scholar
  49. 49.
    Kallas M, Francis C, Kanaan L, Merheb D, Honeine P, Hassan Amoud H (2012) Multi-class SVM classification combined with kernel PCA feature extraction of ECG signals. In: 19th international conference on telecommunications (ICT)Google Scholar
  50. 50.
    Balouchestani M, Krishnan S (2014) Fast clustering algorithm for large ECG datasets based on CS theory in combination with PCA and K-NN methods. In: 36th annual international conference of the IEEE engineering in medicine and biology societyGoogle Scholar
  51. 51.
    Chazal P, O’Dwyer M, Reilly BR (2004) Automatic classification of heartbeats using ECG morphology and heart beat interval features. IEEE Trans Biomed Eng 51(7):1196–1206CrossRefGoogle Scholar
  52. 52.
    Zhang Z, Dong J, Luo X, Choi K, Wu X (2014) Heartbeat classification using disease-specific feature selection. Comput Biol Med 46:79–89CrossRefGoogle Scholar
  53. 53.
    Martis RJ, Acharya UR, Adeli H, Prasad H, Tan JH, Chua KC, Too CL, Yeo SWJ, Tong L (2014) Computer aided diagnosis of atria larrhythmia using dimensionality reduction methods on transform domain representation. Biomed Signal Process Control 13:295–305CrossRefGoogle Scholar
  54. 54.
    Li T, Zhou M (2016) ECG classification using wavelet packet entropy and random forests. Entropy 18:285. CrossRefGoogle Scholar
  55. 55.
    Graham B (2015) Fractional max-pooling. Comput Vis Pattern Recognit. arXiv:141a2.6071
  56. 56.
    Krizhevsky A (2009) Learning multiple layers of features from tiny images. Master’s thesis. Comput. Sci. Dept. Univ TorontoGoogle Scholar
  57. 57.
    LeCun Y, Bottou L, Bengio Y, Haffner P (1998) Gradient-based learning applied to document recognition. Proc IEEE 86(11):2278–2324CrossRefGoogle Scholar
  58. 58.
    Wan L, Zeiler M, Zhang S, LeCun Y, Fergus R (2013) Regularization of neural networks using DropConnect. In: Proceedings of the 30th international conference on machine learning, PMLR, vol 28(3), pp 1058–1066Google Scholar
  59. 59.
    Cui Y, Jia M, Lin TY, Song Y, Belongie S (2019) Class-balanced loss based on effective number of samples, arXiv:1901.05555v1

Copyright information

© Springer-Verlag London Ltd., part of Springer Nature 2020

Authors and Affiliations

  1. 1.Department of Electronics and Communication EngineeringIstanbul Technical UniversityIstanbulTurkey

Personalised recommendations