A Hybrid Lightweight 1D CNN-LSTM Architecture for Automated ECG Beat-Wise Classification

A Hybrid Lightweight 1D CNN-LSTM Architecture for Automated ECG Beat-Wise Classification

Yusra ObeidatAli Mohammad Alqudah

Department of Electronics Engineering, Yarmouk University, Irbid 21163, Jordan

Department of Biomedical Systems and Informatics Engineering, Yarmouk University, Irbid 21163, Jordan

Corresponding Author Email: 
yusra.obeidat@yu.edu.jo
Page: 
1281-1291
|
DOI: 
https://doi.org/10.18280/ts.380503
Received: 
3 August 2021
|
Revised: 
16 September 2021
|
Accepted: 
26 September 2021
|
Available online: 
31 October 2021
| Citation

© 2021 IIETA. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

In this paper we have utilized a hybrid lightweight 1D deep learning model that combines convolutional neural network (CNN) and long short-term memory (LSTM) methods for accurate, fast, and automated beat-wise ECG classification. The CNN and LSTM models were designed separately to compare with the hybrid CNN-LSTM model in terms of accuracy, number of parameters, and the time required for classification. The hybrid CNN-LSTM system provides an automated deep feature extraction and classification for six ECG beats classes including Normal Sinus Rhythm (NSR), atrial fibrillation (AFIB), atrial flutter (AFL), atrial premature beat (APB), left bundle branch block (LBBB), and right bundle branch block (RBBB). The hybrid model uses the CNN blocks for deep feature extraction and selection from the ECG beat. While the LSTM layer will learn how to extract contextual time information. The results show that the proposed hybrid CNN-LSTM model achieves high accuracy and sensitivity of 98.22% and 98.23% respectively. This model is light and fast in classifying ECG beats and superior to other previously used models which makes it very suitable for embedded systems designs that can be used in clinical applications for monitoring heart diseases in faster and more efficient manner.

Keywords: 

convolutional neural network (CNN), electrocardiogram (ECG), long short-term memory (LSTM), deep learning (DL), classification, arrhythmia, cardiovascular disease (CVD)

1. Introduction

The diagnosis of heart diseases highly depends on the electrocardiogram (ECG) [1, 2]. However, using computer programs to automatically extract relevant and reliable information from ECG is challenging. There exist distinct electrical depolarization-repolarization patterns in each heartbeat of the cardiac cycle which lead to different heart’s electrical activities [1-4].

In general, the morphological characteristics of heartbeat vary from person to person. The shapes of QRS complex and R-R interval might change for the same subject under different circumstances [3, 4]. Experienced doctors can easily use heart pulse or variations in the morphological pattern of the heartbeat to detect any anomaly condition. But this task is not easy when using automatic computerized system due to the external noise and imbalanced classes in the dataset.

It was reported by the World Health Organization (WHO) that 31% of the worldwide human deaths in 2016 was caused by cardiovascular disease (CVD) [2] while heart attack caused 85% of these deaths. Traditionally, the medical history and clinical examinations of a patient are used for diagnosing CVD paradigm [1, 5-7]. A set of the quantitative medical parameters are used to classify the patient’s conditions based on the taxonomy of medical diseases. The diagnosis paradigm that is commonly used is inefficient since it deals with large amount of heterogeneous data, and it requires complex analysis and medical expertise for accurate diagnosis [6]. This problem is more critical in developing countries where there is not enough number of medical experts and clinical equipment. Therefore, A reliable, automatic, and low-cost system is necessary for diagnosis by linking appropriate medical assessments to utilizing Computer-Aided Diagnosis Systems (CADS). An automatic monitoring procedures of health conditions is provided by CADS; it basically works based on analyzing physiological signals for monitoring and evaluating the functionality of the corresponding organ [6, 7].

Electrocardiogram (ECG) is a non-stationary physiological signal that represents the heart’s electrical activity. ECG is normally represented as a waveform in PQRST pattern that has peaks and valleys [3, 8, 9]. In a normal heart rhythm, the events of the atria and the ventricles of the heart are represented in the deflections of the sinus rhythm. The condition of the heart is measured by the amplitudes of the P wave, QRS complex, S wave, T wave, and the intervals namely RR, PR, QT, and QRS complex. Predicting the changes of these measures from the normal values is an indicator of an irregular cardiac cycle patterns called Arrhythmia [7-12]. The irregular pattern in the rhythm of ECG is usually observed by physicians to identify the type of cardiac arrhythmia. After identifying the type of cardiac arrhythmia, the necessary treatment should begin. However, the decision-making time is very critical for physicians if the patient was in the intensive care unit (ICU). Therefore, the development of the assistance based on the technological advancements becomes very important to save the life of the patient.

In recent years, Machine learning (ML) algorithms have been widely used to help in the detection of ECG signal and arrhythmia classification [13-18]. Preprocessing, feature extraction, and classification are the main steps commonly used to complete the task of the ML algorithms [15-19].

Empirical mode decomposition [20] and wavelet transform [2, 21-23] on ECG data are superior tools used in the preprocessing to de-noise the ECG signals with high accuracy. The ECG waveforms are extracted after denoising by means of segmentation [24, 25], then the features of the ECG signal are generated from the extracted waveforms. Relatively independent features can be reduced by applying dimension reduction algorithms [14]. A better method of feature extraction can be achieved by combining principal component analysis (PCA) with independent component analysis (ICA) in what is called PCA-ICA algorithm [26]. Linear discriminant analysis (LDA) is also used to reduce the ECG features [27].

ML algorithms are used to construct classification models for the ECG features [9, 13, 15, 28]. Different ML algorithms were previously used in heartbeat recognition and ECG signal classification. Support vector machine (SVM) has shown a good accuracy in confirming the reliability of the heartbeat and ECG classification [3, 6, 29-32]. Approaches based on hidden Markov models have shown good performance in analyzing cardiac arrhythmia [33, 34]. Random forest method has shown accurate results in investigating cardiac arrhythmia [6, 35, 36]. The approaches that depend on combining a small, customized classifier with a global one has shown great results in integrating system on ECG data [14, 37]. Nonnegative matrix factorization-based classification method proposed by Lee and Seung [38] has been applied successfully on many classification tasks and used to automatically identify electrocardio signal with high accuracy. However, using the above methods to identify and extract useful features is complex and time consuming, and when standard tests are used to evaluate their performance, they don’t perform very well. New methods such as deep learning classifier based on multi-layer convolutional neural networks (CNNs) have been used to solve these drawbacks. CNNs have been used for ECG signals classifications [4, 39-42]. A complex deep learning model with convolution layers was built by Rajpurkar et al. [43] and trained/tested using their own datasets. They achieved a precision (positive predictive value) and recall rate (sensitivity) that exceeded the average cardiologist performance. In recent years, different works including wide range of medical tasks have used Deep Neural Network (DNN) for classification and prediction purposes [44-46]. DNN has shown a significant effect on the accuracy of classification and provided continuous monitoring of the heart conditions and arrhythmia of a captured ECG signal with low cost and improved prediction quality. Recently, various Machine Learning (ML) and Deep Learning (DL) algorithms have been widely used to analyze Seismocardiogram (SCG) signals to get descriptive and predictive information for diagnosis purposes [46]. A three-layer artificial neural network have been proposed by Yao et al. [47], it combines both ECG and SCG signals on a beat-by-beat basis for personalized quiescence prediction. The application of unsupervised learning on SCG signals was explored by Mora et al. [48] using variational autoencoder to extract user heart conditions from corresponding SCG waveforms. Haescher et al. [49] has used convolutional autoencoder to transform SCG signals into ECG signals and used the Pan Tompkins algorithm [50] for detecting the R-peak of the signal resulted from the transformation. This algorithm has been applied on ECG signal with noise [51]. The results have shown a degrading performance which indicate that there is still a problem in using this algorithm for reliable analysis of ECG signals. There is a rise in the number of devices that are used in everyday life for monitoring non-medical grade signals, however achieving a reliable analysis of these signals is still a challenging task. The gap between a non-clinical signal acquisition and a reliable signal analysis can be bridged by proposing an end-to-end deep learning network that could extracts information from the prevalent SCG signals in robust manner [46].

Zhang et al. [14] proposed a 12-layer 1-d CNN for classifying a 1 lead individual heartbeat signal into five classes of heart diseases. They tested this method on MIT/BIH arrhythmia database and obtained a positive predictive value of 0.977, a sensitivity of 0.976, and F1 score of 0.976. Their results are comparable with the results achieved in the previously used methods.

Suresh et al. [46] proposed SeismoNet, a Deep Fully Convolutional Neural Network to accurately detects R-peaks for robust monitoring of the SCG signal. SeismoNet is trained in an end-to-end manner to detect position of the R-peaks in spite of noise. A novel neural network architecture combines anomalous morphology of Electrocardiogram (ECG) waveform with abnormal Heart Rate Variability (HRV) has been proposed by Banerjee et al. [52]. They have used A Convolutional Neural Network (CNN) structure to extract the morphological ECG features. They measured the extent of HRV by applying a composite structure based on Long Short- Term Memory (LSTM) [53-56] and a set of hand-crafted statistical features. Their model has a degraded accuracy since they have used binary classification only, and it requires more processing time because they have used manual feature extraction.

In this paper, we have used 1D Convolutional Neural Network (CNN) combined with Long Short-Term Memory (LSTM) for fast, accurate, and automated ECG beat-wise classification. The proposed methodology consists of two major steps: the first step is to segment the ECG into beats, the second step is to feed the beats to the designed hybrid CNN-LSTM model. We have designed CNN and LSTM models separately to compare with the hybrid CNN-LSTM model. The combined CNN-LSTM system provides an automated deep feature extraction and classification for six ECG beats classes including Normal Sinus Rhythm (NSR), atrial fibrillation (AFIB), atrial flutter (AFL), atrial premature beat (APB), left bundle branch block (LBBB), and right bundle branch block (RBBB). The hybrid model uses the CNN blocks for deep feature extraction and selection from the ECG beat. While the LSTM layer which is fed with these features as time-dependent feature will learn how to extract contextual time information. The proposed CNN-LSTM is light (it consists of 6 layers only) and fast in classifying ECG beats which makes it very suitable for embedded systems that can be used in clinical applications for heart diseases monitoring.

2. ECG Dataset

This research paper employs the MIT-BIH arrhythmia dataset to implement and validate the proposed methodology. The MIT-BIH dataset consists of 48 ECG recordings from 47 different patients (records 201 and 202 are from the same subject). The distribution of subjects in the database is as follows: 25 men aged 32 to 89 years and 22 women aged 23 to 89 years. While around 60% of the subjects were inpatients while the remaining 40% are outpatients. The dataset contains different types of arrythmia, and it was the first dataset available for evaluation of arrhythmia detectors. Each recording consists of 30 minutes long signal selected from 24-hour recordings [57, 58]. The dataset is available online for free at PhysioNet (MIT repository) at (https://physionet.org/content/mitdb/1.0.0/). All beats in this dataset are annotated based on the Association for the Advancement of Medical Instrumentation (AAMI) standards. In this work, the methodology is designed to classify the beats into six classes: Normal Sinus Rhythm (NSR), atrial fibrillation (AFIB), atrial flutter (AFL), atrial premature beat (APB), left bundle branch block (LBBB), and right bundle branch block (RBBB) [57].

3. ECG Pre-Processing and Beat Segmentation

Preprocessing techniques are used to denoise the ECG signal and make it suitable for further processing. In this research, the pre-processing techniques started with applying a Butterworth bandpass filter with a frequency range of 0.1 to 100 Hz to eliminate the baseline wandering and the high-frequency noise. Then, a notch filter designed at 60 Hz was used to remove the powerline interference. Finally, a moving average filter was applied to smooth the ECG signal [59, 60]. Figure 1 shows the ECG signal before and after preprocessing techniques.

Figure 1. ECG signal before and after preprocessing

Figure 2. Samples of a segmented ECG beats

After successfully preprocessing the ECG signals and making them suitable for further processing, the R-peak of QRS complex of each ECG beat is detected using robust Pan-Tompkins method [61]. The average index is calculated for each two R-peaks and used as a separation index between ECG beats. This ECG beat segmentation is fast, robust, and can be easily implemented in real-time manner; this can be done by detecting R peaks from each two consecutive QRS complex and use the index as separating index for the first ECG beat. Finally, all segmented ECG beats are resized into 187 samples in length using interpolation method. Figure 2 shows some samples of the segmented ECG beats using the previously described method.

Using the segmentation method, we successfully extracted 5,681 beats, all beats are split into training and testing sets. 150 beats are selected from all classes to make a balanced set for testing, while the remaining beats were used as training set. The distribution of ECG beats classes among the training set and testing set is shown in Table 1.

Table 1. Distribution of ECG beats among classes

ECG Beat Class

Number of Cases in Training Set

Number of Cases in Testing Set

Total Number of Cases

NSR

1787

150

1937

AFIB

1070

150

1220

AFL

110

150

260

APB

586

150

736

LBBB

830

150

980

RBBB

398

150

548

To solve the unbalanced training set problem, up-sampling process for all classes were done by duplicating ECG beats from all classes to reinforce the training process. In this research, we up-sample all ECG beats to 2000 beats for all classes to ensure that we have a balanced training dataset.

4. Deep Learning Models

Deep learning is one of the newest types and state of art technologies in artificial intelligence appeared with the increasing number of large datasets [39-42]. Deep learning is mainly characterized and differentiated by developing a different architecture that composed from multiple and sequential layers in which subsequent stages of input processing performed [1, 6, 12-14]. Deep learning mimics and inspired by the deep structure of a human brain [62].

Figure 3. An illustration of common LSTM network architecture [63]

Figure 4. The proposed CNN model architecture

Deep structures of a human brain have a huge number of hidden layers, this allows us to extract and abstract the deep features at different levels and from different aspects. Many deep learning algorithms have been proposed in recent years [1, 6, 12, 14, 16, 17, 64]. Convolutional Neural Network (CNN) [32, 43] and Long Short- Term Memory (LSTM) [25, 33, 56] are the most widely used, powerful, and efficient deep learning methods. The CNNs include large number of hidden layers that apply convolution and subsampling techniques on the input data to extract deep features [65]. CNN consists of different types of layers called input, convolution, RELU, fully connected, classification, and output layers. These layers are arranged together to build a CNN model to perform the required task.

CNN has shown an outstanding performance in different science areas especially in the medical field [66]. CNN layers are mainly used to extract deep, representative, and discriminative features. When using the CNN layers, the preceding layers perform the process of down-sampling and feature selection, and generate the classification of patterns [65, 66]. The LSTM was initially introduced by Hochreiter and Schmidhuber in 1997 [67] and enhanced by a group headed by Gers in 2000 [63]. Nowadays researchers introduce different types of LSTM, while the details of LSTM were given by Zaremba et al. [68]. The most common architecture of LSTM is composed of a memory cell, input gate, output gate and forget gate. Figure 3 shows an illustration of the common LSTM network architecture. Assume that $x_{t}, c_{t}$ and $h_{t}$ denote the input, cell, and hidden states, respectively, at iteration $t$. For current input $x_{t}$, the previous cell state $c_{t-1}$, and its corresponding previous hidden state $h_{t-1}$, the cell state $c_{t}$ and hidden state $h_{t}$ are obtained [68].

Most of the research work done in the literature focused on how to utilize the pre-trained deep learning models rather than developing new models, or used the CNN and LSTM models separately for the classification of ECG beat arrhythmia [68]. Moreover, the deep learning technique that attracts most of the researchers all around the world is CNN. Recently, hybrid models started to take a great part in the biomedical signal processing classification, these hybrid models achieved a better accuracy than separate models of CNN and LSTM, and their lower layers are designed very well [68, 69].

4.1 CNN model

We have used a CNN model to classify the input ECG beat into 6 classes. The model consists of 32 layers as shown in Table 2 and Figure 4. The proposed CNN model decreases the number of layers when it is compared to the other CNN models used in the literature. The reduced number of layers shortens the time required for training the model to find the class of the input ECG beat beside reducing the number of the resources required to run the system, which make it more suitable for embedded system.

4.2 LSTM model

We have used a LSTM model to classify the input ECG beat into 6 classes. The model consists of 5 layers as shown in Figure 5. The proposed LSTM model is very light and simple when it is compared to previously designed CNN model. This model expected to be faster in training and finding the class of newly generated input ECG beats.

Table 2. Layers information for proposed CNN architecture

Number

Layer

Parameters

1

Input

Size = [1, 187]

2

Conv1D

Filters=32, Kernel Size=5, Strides=1

3

Conv1D

Filters=32, Kernel Size=5, Strides=1

5

Conv1D

Filters=32, Kernel Size=5, Strides=1

6

MaxPooling1D

Pool Size=5, strides=2

7

Conv1D

Filters=32, Kernel Size=5, Strides=1

8

Conv1D

Filters=32, Kernel Size=5, Strides=1

9

MaxPooling1D

Pool Size=5, strides=2

10

Conv1D

Filters=32, Kernel Size=5, Strides=1

11

Conv1D

Filters=32, Kernel Size=5, Strides=1

12

MaxPooling1D

Pool Size=5, strides=2

13

Conv1D

Filters=32, Kernel Size=5, Strides=1

14

Conv1D

Filters=32, Kernel Size=5, Strides=1

15

MaxPooling1D

Pool Size=5, strides=2

16

Conv1D

Filters=32, Kernel Size=5, Strides=1

17

Dense

Size = 32

18

Dense

Size = 6

Figure 5. The proposed LSTM model architecture

4.3 The hybrid CNN-LSTM model

In this hybrid model, the CNN blocks which are the 1D convolutional layer and the max pooling layer are responsible about the deep feature extraction and selection from the ECG beat. While the LSTM layer which is fed with these features as time-dependent features will learn how to extract contextual time information. The architecture of the proposed CNN-LSTM based deep learning framework is shown in Figure 6. Our study reveals a deep feature extraction and classification using a hybrid 1D CNN-LSTM which outperforms the CNN or LSTM based ones. Moreover, utilizing the LSTM layer makes it possible to build a much shallower models than pure CNN models, which provides outstanding performance while using fewer parameters.

Figure 6. The proposed hybrid CNN-LSTM model

5. Performance Evaluation

In any Artificial Intelligence (AI) based system there must be an evaluation of the system performance corresponding to any new data. To evaluate the performance of the proposed models, the original annotations of the ECG beats have been compared to the same ECG beats annotations predicted by the models. Then based on these annotations, the accuracy, sensitivity, precision, and specificity have been calculated. These measures indicate how precisely the x-ray chest images are diagnosed [70]. To compute these measures, four different types of statistical values are computed which are True positive (TP), False Positive (FP), False Negative (FN), and True Negative (TN) [56, 70]. Then using these values, the above mentioned performance evaluation parameters have been computed as follows:

Accuracy $=\frac{\text { TP }+\text { TN }}{\text { TP }+\text { FP }+\text { TN }+\text { FN }}$

Sensitivity $=\frac{\text { TP }}{\text { TP }+\text { FN }}$

Specificity $=\frac{\text { TN }}{\text { FP }+\text { TN }}$

Precision $=\frac{\text { TP }}{\text { FP }+\text { TP }}$

6. Experimental Results and Discussion

In this section, the details of the proposed system implementation are introduced first. Then, the performance of the proposed three models is discussed. Finally, we give the comparison between our proposed models to show the best model among all proposed models. In this experiment, all models are implemented on Google colab server, this server is equipped with 12G memory, a 2.3GHz Intel(R) Xeon(R) CPU, and an NVIDIA K80 / T4 graphics card. Each model is trained in Python using Keras based on the backend of Tensorflow. We used Adaptive moment estimation as the optimizer for back propagation with a batch size of 256, a learning rate set at 0.001, a number of epochs of 500, and categorical cross entropy as a loss function.

6.1 The results from the CNN model

In this section we are showing the results from the designed CNN model. The number of parameters used is 727,302 and the number of classes is 6. Figure 7 shows the accuracy results of the training and testing dataset during the model training. Figure 8 shows the confusion matrix of the testing data using the CNN model. The average accuracy of our CNN model is 97.44% which is comparable with the accuracy achieved from CNN models used in literature [14, 63].

Figure 7. The training and testing sets using CNN model

Figure 8. The confusion matrix of testing set using CNN model

6.2 The results from the LSTM model

In this section we are showing the results from the designed LSTM model. The number of parameters used is 51,506 and the number of classes is 6. Figure 9 shows the accuracy of the training and testing data during the model training. Figure 10 shows the confusion matrix of the testing set using LSTM model. The average accuracy of our LSTM model is 97.11% which is comparable with the accuracy achieved from LSTM models used in literature [53, 55, 56].

Figure 9. The training and testing sets using LSTM model

Figure 10. The confusion matrix of testing set using LSTM model

6.3 The results from the hybrid CNN-LSTM model

In this section we are showing the results from the hybrid CNN-LSTM model. The number of parameters used is 64,034 and the number of classes is 6. Figure 11 shows the accuracy of the training and testing data during the model training. Figure 12 shows the confusion matrix of the testing data using the hybrid CNN-LSTM model. The average accuracy of our hybrid model is 98.22% which is comparable with the accuracy achieved from similar models used in literature [52-54, 71, 72].

Figure 11. The training and testing sets using CNN-LSTM model

Figure 12. The confusion matrix of testing set using CNN-LSTM model

To make a comprehensive comparison between the three proposed models, a full performance evaluation of the models is calculated based on the results of the confusion matrix shown previously for each model. Table 3 shows the classification report using performance evaluation metrics among all proposed models.

Table 3. The classification report of the proposed models using testing set

Metric

CNN

LSTM

CNN-LSTM

Accuracy %

97.44

97.11

98.22

Sensitivity %

97.44

97.11

98.23

Specificity %

99.49

99.42

99.64

Precision %

97.56

97.40

98.26

The results in Table 4 show that all models perform very well in classifying the ECG beats with good values of accuracy, sensitivity, specificity, and precision which are comparable to the values achieved in literature [14, 25-56, 64, 71, 72]. The results also show that the hybrid CNN-LSTM model is superior to the separate CNN and LSTM models in terms of accuracy, sensitivity, and precision. One of our main research objectives is to propose a light, accurate, and fast deep learning model that suitable for embedded system application. Therefore, the information in Table 4 can help us to understand the simplicity of each model, and it clearly shows that the hybrid CNN-LSTM model in addition to its light weight is the fastest among the three models which make it superior for clinical applications.

Table 4. The classification report of the proposed models using testing set

Parameter

CNN

LSTM

CNN-LSTM

Number of Model Parameters

727,302

51,506

64,034

Number of Layers

32

5

6

Average Time for Beat Classification (ms)

4.423

3.174

2.987

Based on the results we achieved in this work, we have found that the hybrid CNN-LSTM model outperforms CNN and LSTM models in all performance evaluation metrics as expected. Our results also show that the hybrid model is faster in classification than the separate CNN and LSTM models, and it needs less parameter values than CNN. Moreover, to demonstrate the superiority of our proposed method for ECG beat classification, we compared the performance of our method with recently published works. As shown in Table 5, the accuracy of our hybrid model is higher than the accuracy achieved from CNN model [14, 64], the LSTM model [56], and the CNN and LSTM models used in this work. Also, the accuracy of our hybrid model is higher than that achieved from hybrid CNN-LSTM [52, 54, 72] and is comparable to that achieved by Oh et al. [71].

Table 5. Comparison of the proposed models with models in literature

Reference

Accuracy (%)

Parameters

Number of Classes

[14] (CNN)

97.6

102,548

5

[52] (CNN-LSTM)

88.93 (two datasets)

-

2

[54] (CNN-LSTM)

98.13

-

2

[56] (bi-LSTM)

97.3

100,701

5

[64] (CNN)

95

259,789

18

[71] (CNN-LSTM)

98.48

320,650

2

[72] (CNN-LSTM)

97.87

-

4

This Work (CNN)

97.44

727,302

6

This Work (LSTM)

97.11

51,506

6

This Work (CNN-LSTM)

98.22

64,034

6

Furthermore, the hybrid model presented in this work achieves higher accuracy with 64,034 parameters which is reduced by 3.6 to 53.6 times compared with other models. Most of the models published in literature don’t focus on the number of model parameters although it is an important measurement to check whether the model is suitable for the embedded system or not. Comparing our hybrid model with other similar hybrid models in recent works [52, 54, 71, 72], our model is capable to successfully do classification for six ECG beats classes with comparable accuracy and least number of parameters. Furthermore, our model can do automated feature extraction in faster manner compared with the slow manual feature extraction presented by Banerjee et al. [52].

It is very interesting to make a test for separate CNN and LSTM models to check their successfulness in ECG beat classification tasks since these models show the ability to work with historical data like time series. Moreover, it is important to show that 1D CNN models perform very well in the classification of ECG beat over 2D CNN since it does not require any transformation to be applied on the ECG beat. In another hand, a short time Fourier transform (STFT), continuous wavelet transform (CWT), etc. requires time and more computation power and not suitable for embedded systems.

The main problem that is faced in this type of research is how to exactly decide what kind of models should be used for a given dataset, and how to select the number of neurons, layers, and type of optimization method. These factors are all reflected on the size of the model and the number of its parameters. Such problems are solved by comparing the results of all models on the same dataset(s). The proposed hybrid CNN-LSTM model shows that the new provided model has high classification rates compared to the other methods in the literature, while the size of the model is lighter and requires less time for classification. This is mainly because the used models are perfectly designed to extract very strong and deep features.

7. Conclusions

In this paper, we have successfully developed a hybrid deep learning model composed of one-dimensional CNN and LSTM for automated and fast ECG beat-wise classification. The model achieved an average accuracy of 98.22% verified on six classes from MIT-BIH dataset. The preprocessing techniques and the hybrid model proposed in this work are very light and suitable for embedded system implementation. Simultaneously, the performance of our method is better than state-of-art networks. The results indicate that the proposed network architecture is well-suited to extract deep temporal features in ECG beat signals. The test accuracy may be improved by optimizing the convolution layer kernel size and adding larger dataset. Our network consists of an efficient model with a small number of parameters. Our plan for future work is to use this model in an embedded system that can be used to efficiently monitor the heart diseases in clinical applications.

  References

[1] Zhang, J., Li, B., Xiang, K., Shi, X. (2019). Method of diagnosing heart disease based on deep learning ECG signal. arXiv preprint arXiv:1907.01514.

[2] Ouali, M.A., Ghanai, M., Chafaa, K. (2020). TLBO optimization algorithm based-type2 fuzzy adaptive filter for ECG signals denoising. Traitement du Signal, 37(4): 541-553. https://doi.org/10.18280/ts.370401

[3] Karpagachelvi, S., Arthanari, M., Sivakumar, M. (2010). ECG feature extraction techniques-a survey approach. arXiv preprint arXiv:1005.0957.

[4] Porumb, M., Iadanza, E., Massaro, S., Pecchia, L. (2020). A convolutional neural network approach to detect congestive heart failure. Biomedical Signal Processing and Control, 55: 101597. https://doi.org/10.1016/j.bspc.2019.101597

[5] Haberl, R.G.R.G., Jilge, G., Pulter, R., Steinbeck, G. (1989). Spectral mapping of the electrocardiogram with Fourier transform for identification of patients with sustained ventricular tachycardia and coronary artery disease. European Heart Journal, 10(4): 316-322. https://doi.org/10.1093/oxfordjournals.eurheartj.a059488

[6] Ebrahimi, Z., Loni, M., Daneshtalab, M., Gharehbaghi, A. (2020). A review on deep learning methods for ECG arrhythmia classification. Expert Systems with Applications: X, 7. 100033. https://doi.org/10.1016/j.eswax.2020.100033

[7] Du, W.Y., Jose, W. (2017). Design of an ECG sensor circuitry for cardiovascular disease diagnosis. International Journal of Biosensors & Bioelectronics, 2(4): 120-125. https://doi.org/10.15406/ijbsbe.2017.02.00032

[8] Abdul Jamil, M.M., Soon, C.F., Achilleos, A., Youseffi, M., Javid, F. (2017). Electrocardiograph (ECG) circuit design and software-based processing using LabVIEW. Journal of Telecommunication, Electronic and Computer Engineering, 9(3-8): 57-66. 

[9] Bogdanov, M., Baigildin, S., Fabarisova, A., Ushenin, K., Solovyova, O. (2020). Effects of lead position, cardiac rhythm variation and drug-induced QT prolongation on performance of machine learning methods for ECG processing. 2020 Ural Symposium on Biomedical Engineering, Radioelectronics and Information Technology (USBEREIT), Yekaterinburg, Russia, pp. 40-43. https://doi.org/10.1109/USBEREIT48449.2020.9117753

[10] Jemilehin, T., Adu, M. (2016). Design and simulation of electrocardiogram circuit with automatic analysis of ECG signal. Analele Universitatii'Eftimie Murgu', 23(1): 155-172.

[11] Mougoufan à, J.B.B., Fouda, J.A.E., Tchuente, M., Koepf, W. (2020). Adaptive ECG beat classification by ordinal pattern based entropies. Communications in Nonlinear Science and Numerical Simulation, 84: 105156. https://doi.org/10.1016/j.cnsns.2019.105156

[12] Nurmaini, S., Darmawahyuni, A., Sakti Mukti, A.N., Rachmatullah, M.N., Firdaus, F., Tutuko, B. (2020). Deep learning-based stacked denoising and autoencoder for ECG heartbeat classification. Electronics, 9(1): 135. https://doi.org/10.3390/electronics9010135

[13] Mykoliuk, I., Jancarczyk, D., Karpinski, M., Kifer, V. (2018). Machine learning methods in electrocardiography classification. ACIT, 2018: 102-105.

[14] Zhang, W., Yu, L., Ye, L., Zhuang, W., Ma, F. (2018). ECG signal classification with deep learning for heart disease identification. In 2018 International Conference on Big Data and Artificial Intelligence (BDAI), Beijing, China, pp. 47-51. https://doi.org/10.1109/BDAI.2018.8546681

[15] Alarsan, F.I., Younes, M. (2019). Analysis and classification of heart diseases using heartbeat features and machine learning algorithms. Journal of Big Data, 6(1): 1-15. https://doi.org/10.1186/s40537-019-0244-x

[16] Alqudah, A.M., Qazan, S., Al-Ebbini, L., Alquran, H., Qasmieh, I.A. (2021). 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, 1-31. https://doi.org/10.1007/s12652-021-03247-0

[17] Ullah, A., Anwar, S.M., Bilal, M., Mehmood, R.M. (2020). Classification of arrhythmia by using deep learning with 2-D ECG spectral image representation. Remote Sensing, 12(10): 1685. https://doi.org/10.3390/rs12101685

[18] Pławiak, P., Acharya, U.R. (2020). Novel deep genetic ensemble of classifiers for arrhythmia detection using ECG signals. Neural Computing and Applications, 32(15): 11137-11161. https://doi.org/10.1007/s00521-018-03980-2

[19] Porumb, M., Iadanza, E., Massaro, S., Pecchia, L. (2020). A convolutional neural network approach to detect congestive heart failure. Biomedical Signal Processing and Control, 55: 101597. https://doi.org/10.1016/j.bspc.2019.101597

[20] Sahoo, S., Mohanty, M., Behera, S., Sabut, S.K. (2017). ECG beat classification using empirical mode decomposition and mixture of features. Journal of Medical Engineering & Technology, 41(8): 652-661. https://doi.org/10.1080/03091902.2017.1394386

[21] Yildirim, Ö. (2019). ECG beat detection and classification system using wavelet transform and online sequential ELM. Journal of Mechanics in Medicine and Biology, 19(1): 1940008. https://doi.org/10.1142/S0219519419400086

[22] Khorrami, H., Moavenian, M. (2010). A comparative study of DWT, CWT and DCT transformations in ECG arrhythmias classification. Expert systems with Applications, 37(8): 5751-5757. https://doi.org/10.1016/j.eswa.2010.02.033

[23] Jenkal, W., Latif, R., Toumanari, A., Dliou, A., El BaAZcharri, O., Maoulainine, F.M.R. (2016). An efficient algorithm of ECG signal denoising using the adaptive dual threshold filter and the discrete wavelet transform. Biocybernetics and Biomedical Engineering, 36(3): 499-508. https://doi.org/10.1016/j.bbe.2016.04.001

[24] Nasim, A., Sbrollini, A., Morettini, M., Burattini, L. (2020). Extended segmented beat modulation method for cardiac beat classification and electrocardiogram denoising. Electronics, 9(7): 1178. https://doi.org/10.3390/electronics9071178

[25] Liu, M., Kim, Y. (2018). Classification of heart diseases based on ECG signals using long short-term memory. 2018 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Honolulu, HI, pp. 2707-2710. https://doi.org/10.1109/EMBC.2018.8512761

[26] Chawla, M.P.S. (2011). PCA and ICA processing methods for removal of artifacts and noise in electrocardiograms: A survey and comparison. Applied Soft Computing, 11(2): 2216-2226. https://doi.org/10.1016/j.asoc.2010.08.001

[27] Kaur, M., Arora, A.S. (2012). Classification of ECG signals using LDA with factor analysis method as feature reduction technique. Journal of Medical Engineering & Technology, 36(8): 411-420. https://doi.org/10.3109/03091902.2012.702851

[28] Alfaras, M., Soriano, M.C., Ortín, S. (2019). A fast machine learning model for ECG-based heartbeat classification and arrhythmia detection. Frontiers in Physics, 7: 103. https://doi.org/10.3389/fphy.2019.00103 

[29] Biggio, B., Nelson, B., Laskov, P. (2012). Poisoning attacks against support vector machines. arXiv preprint arXiv:1206.6389.

[30] Xiao, H., Biggio, B., Nelson, B., Xiao, H., Eckert, C., Roli, F. (2015). Support vector machines under adversarial label contamination. Neurocomputing, 160: 53-62. https://doi.org/10.1016/j.neucom.2014.08.081

[31] Pławiak, P. (2018). Novel methodology of cardiac health recognition based on ECG signals and evolutionary-neural system. Expert Systems with Applications, 92: 334-349. https://doi.org/10.1016/j.eswa.2017.09.022

[32] Ji, Y., Zhang, S., Xiao, W. (2019). Electrocardiogram classification based on faster regions with convolutional neural network. Sensors, 19(11): 2558. https://doi.org/10.3390/s19112558

[33] Radha, M., Fonseca, P., Moreau, A., Ross, M., Cerny, A., Anderer, P., Long, X., Aarts, R.M. (2019). Sleep stage classification from heart-rate variability using long short-term memory neural networks. Scientific Reports, 9(1): 14149. https://doi.org/10.1038/s41598-019-49703-y

[34] Tran, D.T., Vo, H.T., Nguyen, D.D., Nguyen, Q.M., Huynh, L.T., Le, L.T., Do, H.T., Quan, T.T. (2018). A predictive model for ECG signals collected from specialized IoT devices using deep learning. 2018 5th NAFOSTED Conference on Information and Computer Science (NICS), Ho Chi Minh City, pp. 424-429. https://doi.org/10.1109/NICS.2018.8606828

[35] Masetic, Z., Subasi, A. (2016). Congestive heart failure detection using random forest classifier. Computer Methods and Programs in Biomedicine, 130: 54-64. https://doi.org/10.1016/j.cmpb.2016.03.020

[36] Guidi, G., Pettenati, M.C., Miniati, R., Iadanza, E. (2013). Random forest for automatic assessment of heart failure severity in a telemonitoring scenario. 2013 35th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Osaka, Japan, pp. 3230-3233. https://doi.org/10.1109/EMBC.2013.6610229

[37] Hu, Y.H., Palreddy, S., Tompkins, W.J. (1997). A patient-adaptable ECG beat classifier using a mixture of experts approach. IEEE Transactions on Biomedical Engineering, 44(9): 891-900. https://doi.org/10.1109/10.623058

[38] Lee, D.D., Seung, H.S. (1999). Learning the parts of objects by non-negative matrix factorization. Nature, 401(6755): 788-791. https://doi.org/10.1038/44565

[39] Pandey, S.K., Janghel, R.R. (2019). Automatic detection of arrhythmia from imbalanced ECG database using CNN model with SMOTE. Australasian Physical & Engineering Sciences in Medicine, 42(4): 1129-1139. https://doi.org/10.1007/s13246-019-00815-9

[40] Salem, M., Taheri, S., Yuan, J.S. (2018). ECG arrhythmia classification using transfer learning from 2-dimensional deep CNN features. In 2018 IEEE Biomedical Circuits and Systems Conference (BioCAS), Cleveland, OH, USA, pp. 1-4. https://doi.org/10.1109/BIOCAS.2018.8584808

[41] Mahmud, T., Fattah, S.A., Saquib, M. (2020). Deeparrnet: An efficient deep CNN architecture for automatic arrhythmia detection and classification from denoised ECG beats. IEEE Access, 8: 104788-104800. https://doi.org/10.1109/ACCESS.2020.2998788

[42] Baloglu, U.B., Talo, M., Yildirim, O., San Tan, R., Acharya, U.R. (2019). Classification of myocardial infarction with multi-lead ECG signals and deep CNN. Pattern Recognition Letters, 122: 23-30. https://doi.org/10.1016/j.patrec.2019.02.016

[43] Rajpurkar, P., Hannun, A.Y., Haghpanahi, M., Bourn, C., Ng, A.Y. (2017). Cardiologist-level arrhythmia detection with convolutional neural networks. arXiv preprint arXiv:1707.01836.

[44] Nurmaini, S., Umi Partan, R., Caesarendra, W., Dewi, T., Naufal Rahmatullah, M., Darmawahyuni, A., Bhayyu, V., Firdaus, F. (2019). An automated ECG beat classification system using deep neural networks with an unsupervised feature extraction technique. Applied Sciences, 9(14): 2921. https://doi.org/10.3390/app9142921

[45] Ribeiro, A.H., Ribeiro, M.H., Paixão, G.M., Oliveira, D.M., Gomes, P.R., Canazart, J.A., Ferreira, M.P.S., Andersson, C.R., Macfarlane, P.W., Meira Jr, W., Schön, T.B., Ribeiro, A.L.P. (2020). Author Correction: Automatic diagnosis of the 12-lead ECG using a deep neural network. Nature Communications, 11(1): 2227. https://doi.org/10.1038/s41467-020-16172-1

[46] Suresh, P., Narayanan, N., Pranav, C.V., Vijayaraghavan, V. (2020). End-to-end deep learning for reliable cardiac activity monitoring using seismocardiograms. 2020 19th IEEE International Conference on Machine Learning and Applications (ICMLA), Miami, FL, USA, pp. 1369-1375. https://doi.org/10.1109/ICMLA51294.2020.00213

[47] Yao, J., Tridandapani, S., Auffermann, W.F., Wick, C.A., Bhatti, P.T. (2018). An adaptive seismocardiography (SCG)-ECG multimodal framework for cardiac gating using artificial neural networks. IEEE Journal of Translational Engineering in Health and Medicine, 6: 1-11. https://doi.org/10.1109/JTEHM.2018.2869141

[48] Mora, N., Cocconcelli, F., Matrella, G., Ciampolini, P. (2020). Detection and analysis of heartbeats in seismocardiogram signals. Sensors, 20(6): 1670. https://doi.org/10.3390/s20061670

[49] Haescher, M., Höpfner, F., Chodan, W., Kraft, D., Aehnelt, M., Urban, B. (2020). Transforming seismocardiograms into electrocardiograms by applying convolutional autoencoders. ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Barcelona, Spain, pp. 4122-4126. https://doi.org/10.1109/ICASSP40776.2020.9053130

[50] Pan, J., Tompkins, W.J. (1985). A real-time QRS detection algorithm. IEEE Transactions on Biomedical Engineering, BME-32(3): 230-236. https://doi.org/10.1109/TBME.1985.325532

[51] Liu, F., Liu, C., Jiang, X., Zhang, Z., Zhang, Y., Li, J., Wei, S. (2018). Performance analysis of ten common QRS detectors on different ECG application cases. Journal of Healthcare Engineering, 2018: 9050812. https://doi.org/10.1155/2018/9050812

[52] Banerjee, R., Ghose, A., Muthana Mandana, K. (2020). A hybrid CNN-LSTM architecture for detection of coronary artery disease from ECG. 2020 International Joint Conference on Neural Networks (IJCNN), Glasgow, United Kingdom, Glasgow, UK, pp. 1-8. https://doi.org/10.1109/IJCNN48605.2020.9207044

[53] Hou, B., Yang, J., Wang, P., Yan, R. (2019). LSTM-based auto-encoder model for ECG arrhythmias classification. IEEE Transactions on Instrumentation and Measurement, 69(4): 1232-1240. https://doi.org/10.1109/TIM.2019.2910342

[54] Abdullah, L.A., Al-Ani, M.S. (2020). CNN-LSTM based model for ECG arrhythmias and myocardial infarction classification. Advances in Science, Technology and Engineering Systems Journal, 5(5): 601-606. https://doi.org/10.25046/aj050573

[55] Yildirim, O., Baloglu, U.B., Tan, R.S., Ciaccio, E.J., Acharya, U.R. (2019). A new approach for arrhythmia classification using deep coded features and LSTM networks. Computer Methods and Programs in Biomedicine, 176: 121-133. https://doi.org/10.1016/j.cmpb.2019.05.004

[56] Ganguly, B., Ghosal, A., Das, A., Das, D., Chatterjee, D., Rakshit, D. (2020). Automated detection and classification of arrhythmia from ECG signals using feature-induced long short-term memory network. IEEE Sensors Letters, 4(8): 6001604. https://doi.org/10.1109/LSENS.2020.3006756

[57] Goldberger, A.L., Amaral, L.A., Glass, L., Hausdorff, J.M., Ivanov, P.C., Mark, R.G., Mietus, J.E., Moody, G.B., Peng, C.K., Stanley, H.E. (2000). PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation, 101(23): e215-e220. https://doi.org/10.1161/01.CIR.101.23.e215

[58] Alqudah, A.M. (2017). An enhanced method for real-time modelling of cardiac related biosignals using Gaussian mixtures. Journal of Medical Engineering & Technology, 41(8): 600-611. https://doi.org/10.1080/03091902.2017.1382587

[59] Butt, M.M., Akram, U., Khan, S.A. (2015). Denoising practices for electrocardiographic (ECG) signals: A survey. In 2015 International Conference on Computer, Communications, and Control Technology (I4CT), Kuching, Malaysia, pp. 264-268. https://doi.org/10.1109/I4CT.2015.7219578

[60] Elhaj, F.A., Salim, N., Harris, A.R., Swee, T.T., Ahmed, T. (2016). Arrhythmia recognition and classification using combined linear and nonlinear features of ECG signals. Computer Methods and Programs in Biomedicine, 127: 52-63. https://doi.org/10.1016/j.cmpb.2015.12.024

[61] Pan, J., Tompkins, W.J. (1985). A real-time QRS detection algorithm. IEEE Transactions on Biomedical Engineering, BME-32(3): 230-236. https://doi.org/10.1109/TBME.1985.325532

[62] LeCun, Y., Bengio, Y., Hinton, G. (2015). Deep learning. Nature, 521(7553): 436-444. https://doi.org/10.1038/nature14539

[63] Gers, F.A., Schmidhuber, J., Cummins, F. (2000). Learning to forget: Continual prediction with LSTM. Neural Computation, 12(10): 2451-2471. https://doi.org/10.1162/089976600300015015

[64] Zhang, X., Gu, K., Miao, S., Zhang, X., Yin, Y., Wan, C., Yu, Y., Hu, J., Wang, Z., Shan. T., Jing, S., Wang, W., Ge, Y., Chen, Y., Guo, J., Liu, Y. (2020). Automated detection of cardiovascular disease by electrocardiogram signal analysis: a deep learning system. Cardiovascular Diagnosis and Therapy, 10(2): 227. https://doi.org/10.21037/cdt.2019.12.10

[65] Krizhevsky, A., Sutskever, I., Hinton, G.E. (2012). Imagenet classification with deep convolutional neural networks. Advances in Neural Information Processing Systems, 25: 1097-1105.

[66] Yadav, S.S., Jadhav, S.M. (2019). Deep convolutional neural network based medical image classification for disease diagnosis. Journal of Big Data, 6(1): 113. https://doi.org/10.1186/s40537-019-0276-2

[67] Hochreiter, S., Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8): 1735-1780. https://doi.org/10.1162/neco.1997.9.8.1735

[68] Zaremba, W., Sutskever, I., Vinyals, O. (2014). Recurrent neural network regularization. arXiv preprint arXiv:1409.2329.

[69] Raghu, M., Zhang, C., Kleinberg, J., Bengio, S. (2019). Transfusion: Understanding transfer learning for medical imaging. arXiv preprint arXiv:1902.07208.

[70] Alqudah, A.M. (2020). AOCT-NET: A convolutional network automated classification of multiclass retinal diseases using spectral-domain optical coherence tomography images. Medical & Biological Engineering & Computing, 58(1): 41-53. https://doi.org/10.1007/s11517-019-02066-y

[71] Oh, S.L., Ng, E.Y., San Tan, R., Acharya, U.R. (2018). Automated diagnosis of arrhythmia using combination of CNN and LSTM techniques with variable length heart beats. Computers in Biology and Medicine, 102: 278-287. https://doi.org/10.1016/j.compbiomed.2018.06.002

[72] Petmezas, G., Haris, K., Stefanopoulos, L., Kilintzis, V., Tzavelis, A., Rogers, J.A., Katsaggelos, A.K., Maglaveras, N. (2021). Automated atrial fibrillation detection using a hybrid CNN-LSTM network on imbalanced ECG datasets. Biomedical Signal Processing and Control, 63: 102194. https://doi.org/10.1016/j.bspc.2020.102194