Next Article in Journal
Characterization and Optimization of a Conical Corona Reactor for Seed Treatment of Rapeseed
Previous Article in Journal
Yeast Extract Affecting the Transformation of Biogenic Tooeleite and Its Stability
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Lightweight Ensemble Network for Detecting Heart Disease Using ECG Signals

AI Healthcare Research Center, Department of IT Fusion Technology, Chosun University, Gwangju 61452, Korea
*
Authors to whom correspondence should be addressed.
Appl. Sci. 2022, 12(7), 3291; https://doi.org/10.3390/app12073291
Submission received: 3 February 2022 / Revised: 22 March 2022 / Accepted: 22 March 2022 / Published: 24 March 2022
(This article belongs to the Topic Artificial Intelligence in Healthcare)

Abstract

:
Heart disease should be treated quickly when symptoms appear. Machine-learning methods for detecting heart disease require desktop computers, an obstacle that can have fatal consequences for patients who must check their health periodically. Herein, we propose a MobileNet-based ensemble algorithm for arrhythmia diagnosis that can be easily and quickly operated in a mobile environment. The electrocardiogram (ECG) signal measured over a short period of time was augmented using the matching pursuit algorithm to achieve a high accuracy. The arrhythmia data were classified through an ensemble classifier combining MobileNetV2 and BiLSTM. By classifying the data using this algorithm, an accuracy of 91.7% was achieved. The performance of the algorithm was evaluated using a confusion matrix and a receiver operating characteristic curve. The sensitivity, specificity, precision, and F1 score were 0.92, 0.91, 0.92, and 0.92, respectively. Because the proposed algorithm does not require long-term ECG signal measurement, it facilitates health management for busy people. Moreover, parameters are exchanged when learning data, enhancing the security of the system. In addition, owing to the lightweight deep-learning model, the proposed algorithm can be applied to mobile healthcare, object detection, text recognition, and authentication.

1. Introduction

Biosignals are indicators of physical health that allow the management of various diseases, such as muscle pain, insomnia, and heart disease [1,2,3]. The electrocardiogram (ECG) is the most important signal for confirming the state of the heart [4,5].
In an ECG, the heartbeat is represented by electrical signals. The heart rate of a healthy person is usually between 60 and 100 beats per minute [6]. When a person is exercising, tense, or excited, the heart beats faster. There are typically no problems in such cases; however, when the heart beats irregularly for no reason, this symptom is called arrhythmia. According to NHANES 2015–2018 data, the prevalence of cardiovascular disease (comprising coronary heart disease, heart failure, stroke, and hypertension) in adults ≥20 years of age is 49.2% overall (126.9 million in 2018) and increases with age for both males and females. The prevalence of cardiovascular disease excluding hypertension is 9.3% overall (26.1 million in 2018) [7]. The rapid increase in the number of heart-disease patients due to changes in eating habits and reduced exercise has contributed to the most serious death rate of modern people. The most representative type of heart disease is arrhythmia. Early detection of arrhythmia is crucial, because arrhythmia causes symptoms such as dizziness, fainting, chest pain, and difficulty breathing, and can lead to heart attacks [8].
Methods of diagnosing arrhythmia include periodically visiting a hospital or using a Holter monitor. However, both of these are inconvenient for patients and can be expensive. In addition, ECG signals measured by widely used smart watches are acquired over a short period of <1 min; therefore, it is impossible to identify cardiovascular diseases, including arrhythmia, using such devices.
Methods for detecting arrhythmia include detection of early contraction of the ventricles using the RR interval [9], analysis using the discrete Fourier transform [10,11], and analysis based on the Hilbert transform [12,13]. These arrhythmia diagnosis methods must be performed by a specialist, and for the early detection of heart disease, a large quantity of ECG data must be checked for irregular events. In addition, there are many factors to be considered for accurate diagnosis, such as the patient’s movements and signal interference problems that occur when ECG signals are measured during normal activities [14]. Furthermore, the “silver generation” and residents of mountainous areas or islands cannot visit the hospital often, owing to a lack of transportation, physical aging, or disease.
To overcome these difficulties, we propose an arrhythmia detection algorithm combining MobileNetV2-BiLSTM and a matching pursuit algorithm that can accurately diagnose arrhythmia using ECG data. To increase the accuracy of the algorithm, the ECG signal in the time domain was converted to the frequency domain using a scalogram.
Because the proposed algorithm augmented ECG data using matching pursuit, it was possible to accurately detect arrhythmia through ECG signals measured within a short timeframe by learning a large quantity of data. The proposed algorithm used the ECG database provided by MIT-BIH [15,16]. An experiment was conducted for increasing the classification accuracy using a small quantity of data. The number of data used in the algorithm is 654, with approximately 164 data per class. For training algorithms, this scale of data is insufficient. To solve this problem, the matching pursuit algorithm is used, which can decompose data or duplicate data. The matching pursuit algorithm can eliminate noise because it can approximate the signal. By combining MobileNetV2-BiLSTM and matching pursuit and applying the proposed algorithm to ECG signals, we confirmed the possibility of developing an efficient health-management algorithm applicable to mobile devices.

2. Related Work

2.1. MobileNetV2 and Machine Learning

MobileNetV2 is an image-classification model that was proposed in 2018 [17]. It is a lightweight network that preserves performance to the greatest extent possible, and compared with previously proposed networks, the size of the classifier model is significantly reduced by applying the average-pooling technique in the process of converting the feature group into the classifier group. The feature stage has a structure in which convolutional modules are repeatedly stacked. MobileNetV2 has a conv. + batch normalization (BN) + rectified linear unit (ReLU) structure, and the computational burden and model size are reduced by using a depth-wise convolutional layer as an intermediate layer. In the process of converting spatial information into a fully connected (FC) layer, the weight of the FC layer is limited to the number of channels by applying average pooling rather than the existing tensor shape conversion [18].
In a previous study, computed-tomography and X-ray data related to COVID-19 were classified using six different models, including MobileNetV2 [19]. The model performance was evaluated according to the accuracy, precision, recall, and F1 score. Among the models tested, MobileNetV2 and VGG19 exhibited the best performance.
There are many reports of heart-disease diagnosis using machine learning. A review was conducted to identify the trends of machine-learning-based and data-driven techniques for heart-disease diagnosis with imbalanced data [20]. A meta-analysis was performed using 451 reports acquired from reputed journals between 2012 and 15 November 2021.
Machine learning, which can accurately classify data, uses a high-performance central processing unit (CPU); thus, it has excellent computational processing power and uses multiple high-performance graphics. Because machine-learning algorithms are developed with a focus on performance, the operating environment of the algorithm is not considered. However, patients with heart disease must check their health regularly and cannot carry a high-performance desktop. To solve this problem, a machine-learning method that can be implemented on a mobile device is required. MobileNetV2 is a convolutional neural network (CNN)-based algorithm designed for applications wherein the computational resources are limited or the battery performance is important.

2.2. Bidirectional Long Short-Term Memory (BiLSTM)

BiLSTM is a circulating neural network that can process data that change over time, such as video [21,22]. The original circulating neural network had the problem of data loss after repeated backpropagation, but BiLSTM mitigates the problem of data loss using a forget gate. The core of the BiLSTM neural network comprises the sequence input layer and the long short-term memory (LSTM) layer. The sequence input layer inputs sequence or time-series data into the neural network. The LSTM layer learns the data according to the sequence time flow.

2.3. Matching Pursuit

The matching pursuit algorithm was developed to linearly decompose signals in order to understand their characteristics. When the original signal is decomposed, the characteristics of the original signal are identified by considering the time and frequency domains simultaneously, e.g., the wavelet and Fourier transforms, in the order of energy [23].

2.4. Database

The MIT-BIH database, which is widely used in arrhythmia-related studies, contains ECG data categorized into 17 classes. This dataset consists of ECG signals with durations of 10 s from 45 participants. The MIT-BIH database is commonly used by researchers to develop heart-related algorithms [24,25,26]. Table 1 presents details regarding the databases used in this study.
Figure 1 shows the ECG signals included in the database. “NSR” corresponds to a normal ECG signal. AFIB is one of the heart diseases that can be detected using ECG signals. PVC and LBBB correspond to premature ventricular contractions and left bundle branch block beats, respectively, and also represent abnormal heartbeats.

2.5. Wavelet Transform

The wavelet transform is a multi-resolution system capable of processing signals in various frequency bands by converting the input sampling frequency into another set of sampling frequencies. By applying this transform to an ECG signal, noise removal and waveform segmentation can be performed simultaneously, providing a high resolution for each feature element in the signal. The wavelet transform can be used to analyze the converted signal in the desired frequency band by multiplying the input signal by the wavelet function and scale function, and dividing the frequency band into high- and low-frequency segments [27,28,29].

2.6. Previous Study

Tuncer et al. [2] classified arrhythmia signals using the 1D-HLP technique. Using the 1D-HLP, 512 dimensional features are extracted from each of the five levels of the low-pass filter. These features are subjected to 1 Nearest Neighbor (1-NN) classifier for classification with four distance metrics. The authors obtained a classification accuracy of 95.0% when classifying 17 arrhythmia classes using the MIT-BIH arrhythmia ECG Database.
Ribeiro, H.D.M., et al. [30] proposed an algorithm that could classify the ECG signal of both healthy and sick people. The proposed lightweight solution uses quantized one-dimensional deep convolutional neural networks, and is ideal for real-time continuous monitoring of cardiac rhythm. It is capable of providing one output prediction per second. It is accurate (sensitivity of 98.5% and specificity of 99.8%) and can be implemented on a smartphone, which is energy-efficient and fast, requiring 7.65 ms per prediction
Naz et al. [31] proposed a new deep-learning approach for the detection of ventricular arrhythmias (VA). Initially, the ECG signals were transformed into images, and this had not been done before. Subsequently, these images were normalized and utilized to train the AlexNet, VGG-16, and Inception-v3 deep-learning models. The results were evaluated on the MIT-BIH Database, and an accuracy of 97.6% was achieved.
Cai et al. [32] developed a deep-learning-based approach for multi-label classification of ECG, named Multi-ECGNet, which can effectively identify patients with multiple heart diseases simultaneously. The experimental results show that Multi-ECGNet can achieve a high score of 0.863 (micro-F1-score) in classifying 55 types of arrhythmias.
Park et al. [33] proposed an ECG signal multiclassification model using deep learning. The authors used a squeeze-and-excitation residual network (SE-ResNet), a residual network (ResNet) with a squeeze-and-excitation block. The authors compared SE-ResNet with ResNet as a baseline model for various depths of the layer (18/34/50/101/152). The SE-ResNet classifier with 152 layers achieved an F1 score of 97.05% for seven-class classifications. The model surpassed the baseline model, ResNet, by +1.40% for seven-class classification.
Lee et al. [34] proposed a novel method for generating a gray-level co-occurrence matrix (GLCM) and gray-level run-length matrix (GLRLM) from one-dimensional signals. The authors extracted the morphological features for automatic ECG signal classification. The extracted features were combined with six machine-learning algorithms to classify cardiac arrhythmias. Of the six machine-learning algorithms, combining XGBoost with the proposed features yielded an accuracy of 90.46%, an AUC of 0.982, a sensitivity of 0.892, a precision of 0.900, and an F1 score of 0.895, and presented better results than wavelet features with XGBoost.
Existing technology for arrhythmia diagnosis makes it difficult for patients to detect diseases in their daily lives. This is due to structural problems with the arrhythmia diagnosis technology. When deep learning is used to detect arrhythmia it involves a very large amount of computation, because it is developed with a focus on performance. This deep-learning computer uses high-performance GPUs and memory. However, it has spatial limitations because it is not portable. Although arrhythmia diagnosis technology is being developed, it is not practically helpful for patients with arrhythmia. To solve these problems, patients need solutions to be available on mobile devices that are now widely available to many people.

3. Methodology

Figure 2 shows the workflow of the proposed algorithm. The proposed arrhythmia detection method involves preprocessing to minimize noise and resize the ECG signals. To increase the accuracy of the algorithm, the training data were sufficiently selected through the matching pursuit algorithm. The wavelet transform was used for feature-point extraction. Arrhythmia was detected using a MobileNetV2-BiLSTM neural network.

3.1. Preprocessing

Noise in ECG signals is caused by various factors, such as the environment, whether the electrodes are in good contact with the patient, movement of the measurement cable, movement of the baseline due to breathing, and movement of the patient. These factors affect the shape and size of the waveform, reducing the accuracy of arrhythmia detection. To minimize noise, a Butterworth notch filter and a moving-average filter were designed. Figure 3 shows the signal-processing results.

3.2. Data Augmentation

A matching pursuit algorithm was used to augment the training data. This algorithm can generate additional signals that are similar to the original signal.
The original signal must be decomposed to generate a similar signal. First, the basic signals g 0 and a 0 that most closely reflect the original signal are calculated, as follows:
F ( t ) = a 0 g 0 ( t ) + R ( t ) ,
where R(t) represents the remainder of the original signal after it is decomposed using the base signal g 0 , and a 0 is a coefficient that optimally represents the given signal in terms of the minimal mean square error given any base signal g 0 . The approximated signal that best represents a given original signal has the smallest error value when approximating the original signal. Therefore, to determine this basic signal function and the coefficient value, we define Equation (2), which gives the difference between the original signal and its approximation.
E ( a 0 | g 0 ) = f a 0 g 0 ,   f a 0 g 0
Finding the coefficient a 0 that minimizes Equation (2), this becomes an optimal value from the viewpoint of the least square error. The minimized E ( a 0 | g 0 ) is given as
E ( a 0 | g 0 ) = f   f f , g 0 2 .
To minimize Equation (2), the default signal with the maximum value of f , g 0 2 and the default signal with the largest inner-product absolute value are set to the signal g 0 to decompose the input signal. For minimizing Equation (2), the expansion coefficient a 0 is expressed as follows:
a 0 = f , g 0 .
Equations (2)–(4) are used to determine the basic signal with the largest absolute value of the original signal and the inner product. This procedure represents the input signal using a basic signal that is most similar to the original signal. After a given input signal is decomposed, the original signal is redefined using the approximate error signal f(t), as indicated by Equation (5). This procedure is repeated until the original signal is completely decomposed. Thus, the matching pursuit algorithm decomposes the original signal into appropriate basic signals.
f ( t ) { f ( t ) a 0 g 0 ( t ) }
Figure 4 shows the results of generating a signal similar to the original signal by changing the coefficient.

3.3. Wavelet Transform

Equation (6) represents the wavelet function ψ(a, d)(x) using the scale coefficient a and the transition element d.
ψ ( a ,   d ) ( x ) = 1 a + x ( t ) ψ ( t d a ) d t ,
The discrete signal x(n) of the ECG can be converted into a discrete wavelet by discretizing the scaling element (a) and the transition element (d) in Equation (6). At the level j = −1, it can be expressed by combining a high-frequency signal D 2 j [ x ( n ) ] and a low-frequency signal A 2 j [ x ( n ) ] . The ECG signal is expressed as x(n) = D 2 j [ x ( n ) ] + A 2 j [ x ( n ) ] and generally satisfies Equations (7) and (8).
D 2 j [ x ( n ) ] = k = 1 D 2 j ( k ) ψ 2 j ( n 2   j k )
A 2 j [ x ( n ) ] = k = 1 A 2 j ( k ) ψ 2 j ( n 2   j k )
In this case, 2 j indicates that the number of samples is divided by two as the level j decreases. Equation (7) represents a signal with a high-frequency component, which is related to the transition elements of the signal. Equation (8) shows the low-frequency component of the signal, which is related to the scale of the signal. The high- and low-frequency components of the input signal are divided according to the level j.
D k (detail) is the finite impulse response (FIR) high-band filter coefficient associated with the wavelet coefficient, and A k (approximation) is the FIR low-band filter coefficient associated with the scale function coefficient. The signal whose length is reduced by half through each filter is repeatedly converted to the next scale level. The wavelet coefficient indicates the similarity to the wavelet-generating function. This represents the frequency signal. Figure 5 shows the results of applying the wavelet transform to the ECG signal.

3.4. Proposed ECG Signal Classification Method

An algorithm combining MobileNetV2 and BiLSTM was developed for classifying arrhythmia data. MobileNetV2 classified the arrhythmia data, and BiLSTM maintained the sequence data to improve the performance of the arrhythmia classification model. A diagram of the MobileNetV2-BiLSTM algorithm for classifying arrhythmia data is shown in Figure 6.
The data ratio was the highest with 283 NSR data and the lowest with 103 LBBB data. The balance data may cause overfitting problems, because the number of data is insufficient. To solve this problem, data were added using the matching pursuit algorithm in this study.
The matching pursuit algorithm was developed to decompose signals in order to understand their characteristics. During the decomposition of the signal to be analyzed, the time and frequency domains are simultaneously considered by applying the wavelet transform or Fourier transform.
When a signal is added, the matching pursuit algorithm first determines the length of the signal to be added. Subsequently, a signal that most closely reflects the original signal is generated. At this time, the minimum square error (MSE) is used. A smaller MSE corresponds to a higher degree of similarity to the original signal. In the above formula, g 0 represents a basic signal, and a 0 represents a signal with a minimized MSE. R(t) represents the signal remaining after the original signal is decomposed using g 0 . A matching pursuit function can be applied to the original signal to generate several signals with small MSE values.
MobileNetV2 extracts random features from the input data. Figure 7 shows the MobileNetV2-BiLSTM structure.
The input size was 227 × 227 × 3. The data size was changed to 114 × 114 × 32 by applying a stride of 2 × 2 in the first convolutional layer. BN and ReLU functions were applied, and subsequently, depth-wise convolution (3 × 3 × 1), BN, the ReLU function, and convolution were applied to reduce the amount of computation.
MobileNetV2 contains 16 blocks, and all the blocks were implemented in the same manner, as shown in Figure 8.
Because sequence data processing is difficult with general neural networks, a special recurrent neural network was used for BiLSTM. Each LSTM layer has three gates that transmit or control data and can learn by considering the gradient decay problem. LSTM obtains the information of all the cells over time. However, data cannot be learned after the cell in which the current learning is in progress. BiLSTM is an improved version of LSTM, in which forward propagation and backpropagation are used to learn information implied in the past and future, respectively. Consequently, this model can handle time-series data more efficiently. Figure 9 shows the structure of the BiLSTM model.
The first LSTM layer was used to calculate the sequence information at the current time. The second layer was used to read the same sequence in the reverse direction and add reverse sequence information to extract meaningful features of the input data. The output value between the LSTM layers was transmitted to not only the adjacent unit but also the input of the next LSTM layer. The weight of the LSTM could be updated by the forward and backward propagation of the neuron. After the characteristics of each input signal were extracted, a BiLSTM classification model was configured. Dropout was added to the BiLSTM layer to prevent overfitting of the model. The learning results were used as inputs to an FC layer. The ECG signal was classified in the FC layer, and a softmax layer was used to output the result.

3.5. Performance Evaluation

The sensitivity, specificity, precision, and F1 score were calculated to evaluate the performance of the presented model. Sensitivity refers to the percentage of data that are actually positive and are classified as positive. The sensitivity of the proposed model was calculated as 0.92 using Equation (9).
Sensitivity = T P P = T P T P + F N
Specificity refers to the ratio of negative data classified as negative. The specificity of the proposed model was calculated as 0.91 using Equation (10).
Specificity = T N N = T N T N + F P
Precision refers to the ratio of data whose predicted value and actual value match as positive among subjects whose prediction is positive. It indicates how well positive data are classified. The precision of the proposed model was calculated as 0.92 using Equation (11).
Precision = T P T P + F P
The F1 score is the most representative method for evaluating the performance of deep-learning classification models. The proposed model exhibited high F1 scores, as the precision and sensitivity were not biased toward either side.
F 1   score = 2 × precision × sensitivity precision + sensitivity

4. Results and Discussion

Using the proposed model, i.e., the MobileNetV2-BiLSTM algorithm, 2000 ECG signals were classified. The data for each class were augmented to 500 using the matching pursuit algorithm. Figure 10 presents the classification results. As shown, the LBBB data were best classified among the four classes. This is because the LBBB data had the most prominent features, such as baseline fluctuations and changes in the QRS complex, among the ECG signals. The AFIB data exhibited an accuracy of 92.8%, and were also classified relatively well compared with the other data, because the signal interval was not constant and the signal amplitude was small. The NSR data had the lowest classification accuracy because they had no noticeable features compared with the other data.
The sensitivity of the proposed model was calculated as 0.92 using Equation (9). The specificity of the proposed model was calculated as 0.91 using Equation (10). The precision of the proposed model was calculated as 0.92 using Equation (11). The F1 score of the proposed model was calculated as 0.92 (on average) using Equation (12). Table 2 presents the performance of the proposed algorithm.
The receiver operating characteristic (ROC) curve is an important indicator for measuring the performance of classifiers [35]. It indicates how the true positive rate (TPR) changes when the false positive rate (FPR) changes. Here, the TPR represents the sensitivity. By setting the FPR as the X-axis and the TPR as the Y-axis, the changes in the TPR with respect to the FPR were examined. The true negative rate (TNR) is an indicator corresponding to the sensitivity.
The presented algorithm was trained by considering the following parameters. This set value was determined by conducting several experiments using MobileNet v2-BiLSTM and comparing the results. Table 3 Computational or time-complexity evaluation table of proposed algorithms.
The batch size refers to the size of a group when the dataset used for training is divided into several groups. The training dataset is divided because it takes a long time to train if the entire dataset is entered into a neural network. The batch size used in this study was 30. Data rotation is a procedure applied to improve the efficiency when an algorithm learns. Neural networks have different learning outcomes depending on the state of data. When the same image is inputted differently, the neural network recognizes different data. (1) The normal image is the same as input (2), but the image is rotated. The data rotation used in this study was set to five. ‘Data shift’ refers to the movement of data in the pixels. Similar to data rotation, the input data can be completely different if they shift by pixel size, which can improve the learning efficiency. The data shift for this algorithm was set to 3. Overfitting problems may occur in deep-learning algorithms. To prevent this, a verification process is required, and in this study the verification was conducted 50 times.
‘Time elapsed’ refers to the time taken by this algorithm to classify the data. This algorithm classified the data in 23 m 30 s. An epoch means that the MobileNet v2-Bilstm algorithm learns all datasets once. The number of epochs of this algorithm was set to 40. Iteration refers to learning 1/n-sized data once the entire dataset is divided into n equal parts. In the arrhythmia detection study, it was set as 120. The learning rate is the amount an algorithm can learn at once, and in this study, the learning rate was set to 0.01. If the learning rate is too large or too small, overfitting occurs; therefore, it is common to set it to 0.001 to 0.01.
Figure 11 shows the ROC curve for the MobileNetV2-BiLSTM algorithm. The higher the value on the left, the better the ROC curve. The ROC curve can be used to calculate the change in the TPR while changing the FPR from 0 to 1. When the threshold is specified as 1, the FPR is 0, and conversely, when the threshold is 0, the FPR becomes 1. The TPR based on the change in the FPR value becomes the ROC curve.
The area under the ROC curve (AUC) for each class indicated the performance of the classifier, with a larger area corresponding to a better performance. The AUCs for all the data are presented in Table 4.
The PVC, LBBB, and AFIB data had AUCs close to 1, indicating that the signals were classified accurately. The NSR data had an AUC value of 0.982, which was smaller than those of the other classes, but still indicates a high-performance classifier (defined as having an AUC value of ≥0.8). Therefore, the NSR data were also classified accurately. Figure 12 shows the results of K-fold cross validation.
The most important goal of deep-learning algorithms is “how accurately data can be classified”. In general, deep-learning algorithms are used to predict unknown data with limited data held by the system. The accuracy increases with an increasing number of data. There is no problem if the data are sufficient, but when the system learns with limited data, it is important to use the data it holds as efficiently as possible. Cross validation reveals how efficiently the system can use data. Therefore, this method was used to verify the performance of the proposed algorithm.
The performance of the MobileNetV2-BiLSTM algorithm was analyzed using K-fold cross validation. The dataset was divided into 12 groups, and one of the groups was extracted and used as the test set. The remaining 11 groups were used as training sets. The test was repeated 12 times.
The accuracy increased with the K value. The accuracy of the algorithm was maximized when the K value was 10, and it decreased as K increased further. The minimum accuracy was 79.7%, the maximum accuracy was 93.3%, and the average accuracy was 86.21%.
ECG signals contain noise. For example, noise caused by factors such as patient movement, impedance between the skin and electrodes, and movement of cables reduces the accuracy of the algorithm and should be minimized. In this study, a MATLAB-based Butterworth filter was designed. The filter band was set as 5 Hz for high-pass and 250 Hz for low-pass, and the band-stop filter was designed for 60 Hz.
Figure 13 shows the experimental evaluation results for the performance of the MATLAB-based filter. The raw signal with noise is shown in blue, and the result of applying the filter is shown in red. Comparing the two signals revealed that the noise of the baseline was reduced.
The digital filter was designed with general settings. Sometimes, the input data require a different filter band. For example, if another ECG study is performed using a different ECG database, the settings of the Butterworth filter used in this study must be changed. Alternatively, a filter other than the Butterworth filter may need to be used. Figure 14 presents ECG signals to which the Fourier transform was applied. The two ECG signals represent the results of the fast Fourier transform. They exhibit different frequency characteristics. Considering these frequency characteristics, the proposed algorithm should design an appropriate filter regardless of which ECG signal is input. The plan currently under consideration involves calculating the signal-to-noise ratio (SNR) of the signal and redesigning the filter when the SNR is too low.
The ECG signals used in this study were obtained from the MIT-BIH database. Digital filters were designed and applied to increase the classification accuracy. Subsequently, the learning data were sufficiently secured using the matching pursuit algorithm. Data classification was performed using the MobileNetV2-BiLSTM algorithm.
The dataset used consisted of four classes, and the number of data was unbalanced. To solve this problem, the matching pursuit algorithm was used to analyze signals, adding 500 pieces of data from all classes. In this study, the proposed data augmentation method was used only to detect heart disease. However, if research on data aggregation progresses, we will be able to solve problems arising from unbalanced datasets. In addition, because the proposed method can arbitrarily add data measured in a short period of time, e.g., ECG signals, sufficient learning data can be secured, which can increase the algorithm accuracy.
The advantage of this algorithm is that arrhythmia diagnosis using a mobile device is possible. Deep learning, which has recently been used in various ways, has problems, such as the use of high-performance CPUs and the consumption of large amounts of memory and power, because it focuses on performance. However, MobileNet is an algorithm designed for use in situations where the computational performance is limited; thus, it can solve the aforementioned problems.
The accuracy of the proposed model was 91.7%. Considering that the accuracy of the existing arrhythmia detection algorithm has reached approximately 99%, the performance of the proposed algorithm was not excellent. In addition to the accuracy, the sensitivity, specificity, and precision were poor compared with previous studies. However, the objective of the proposed method is to allow heart patients to check their health using mobile devices in their daily lives.
To overcome the disadvantages of this study, further research on the weight reduction of the model, the learning method of deep learning, and noise reduction is needed.

5. Conclusions

We proposed an artificial-intelligence model for classifying arrhythmia using MobileNetV2-BiLSTM and a matching pursuit algorithm. The ECG data measured over a short period were augmented with sufficient quantities of data using the matching pursuit algorithm, and the MobileNetV2-BiLSTM-based arrhythmia diagnosis results exhibited an accuracy of 91.7%. The performance of the model was evaluated using the ROC curve, and the average AUC was 0.994, indicating that the performance of the classifier was excellent. The algorithm arbitrarily added ECG data to increase its accuracy. In this process, the matching pursuit algorithm was used, and a large number of data could be secured. The data augmentation method used in the present study can be applied to imbalanced datasets. If the dataset is imbalanced, an overfitting problem can occur, reducing the accuracy. If the matching pursuit algorithm can solve the imbalance problem, the proposed algorithm can classify data from various datasets in addition to the ECG datasets used in this study. Owing to the widespread use of portable devices, various applications of lightweight algorithms will be developed in the future. After further research, the proposed MobileNetV2-BiLSTM model is expected to be useful in various fields, such as healthcare and the Internet of Things, in addition to disease monitoring.

Author Contributions

S.S. constructed the arrhythmia-detection algorithm and suggested the concepts for the work; M.K. performed the experiments; G.Z. analyzed the ECG data; J.J. and Y.T.K. supervised the writing of the article. All authors have read and agreed to the published version of the manuscript.

Funding

Healthcare AI Convergence R&D Program through the National IT Industry Promotion Agency of Korea (NIPA) funded by the Ministry of Science and ICT (No. S0316-21-1001), Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (No. 2018R1A6A1A03015496).

Informed Consent Statement

Patient consent was waived due to the retrospective nature of the study, and the analysis used anonymous clinical open data.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Yıldırım, Ö.; Pławiak, P.; Tan, R.S.; Acharya, U.R. Arrhythmia detection using deep convolutional neural network with long duration ECG signals. Comput. Biol. Med. 2018, 102, 411–420. [Google Scholar] [CrossRef] [PubMed]
  2. Tuncer, T.; Dogan, S.; Pławiak, P.; Acharya, U.R. Automated arrhythmia detection using novel hexadecimal local pattern and multilevel wavelet transform with ECG signals. Knowl. Based Syst. 2019, 186, 104923. [Google Scholar] [CrossRef]
  3. Rocha, V.D.A.; do Carmo, J.C.; Nascimento, F.A.D.O. Weighted-cumulated S-EMG muscle fatigue estimator. IEEE J. Biomed. Health Inform. 2017, 22, 1854–1862. [Google Scholar] [CrossRef] [PubMed]
  4. Zhou, S.; AbdelWahab, A.; Sapp, J.L.; Sung, E.; Aronis, K.N.; Warren, J.W.; Chrispin, J. Assessment of an ECG-Based System for Localizing Ventricular Arrhythmias in Patients with Structural Heart Disease. J. Am. Heart Assoc. 2021, 10, e022217. [Google Scholar] [CrossRef] [PubMed]
  5. Aamir, K.M.; Ramzan, M.; Skinadar, S.; Khan, H.U.; Tariq, U.; Lee, H.; Khan, M.A. Automatic Heart Disease Detection by Classification of Ventricular Arrhythmias on ECG Using Machine Learning. CMC-Comput. Mater. Contin. 2022, 71, 17–33. [Google Scholar]
  6. Ahmed, N.; Zhu, Y. Early detection of atrial fibrillation based on ECG signals. Bioengineering 2020, 7, 16. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  7. A Report from the American Heart Association. Available online: https://www.ahajournals.org/doi/10.1161/CIR.0000000000000950 (accessed on 2 February 2022).
  8. Saboori, R.; Salehi, A.W.; Vaidya, P.; Gupta, G. Classification of Arrhythmia Using Machine Learning Techniques. In Innovations in Information and Communication Technologies (IICT-2020); Springer: Cham, Switzerland, 2021; pp. 445–452. [Google Scholar]
  9. Faust, O.; Acharya, U.R. Automated classification of five arrhythmias and normal sinus rhythm based on RR interval signals. Expert Syst. Appl. 2021, 181, 115031. [Google Scholar] [CrossRef]
  10. Liu, S.; Shao, J.; Kong, T.; Malekian, R. ECG Arrhythmia classification using high order spectrum and 2D graph Fourier transform. Appl. Sci. 2020, 10, 4741. [Google Scholar] [CrossRef]
  11. Raut, N.V.; Deolekar, R.V. ECG Arrhythmia Classification using Fast Fourier Transform and Principal Component Analysis. IJIRT J. 2021, 8, 786–791. [Google Scholar]
  12. Sahoo, S.; Mohanty, M.; Sabut, S. Automated ECG beat classification using DWT and Hilbert transform-based PCA-SVM classifier. Int. J. Biomed. Eng. Technol. 2020, 32, 287–303. [Google Scholar] [CrossRef]
  13. Gupta, V.; Mittal, M. R-peak based Arrhythmia Detection using Hilbert Transform and Principal Component Analysis. In Proceedings of the 2018 3rd International Innovative Applications of Computational Intelligence on Power, Energy and Controls with their Impact on Humanity (CIPECH), Ghaziabad, India, 1–2 November 2018; pp. 1–4. [Google Scholar]
  14. Karunadas, C.P.; Mathew, C. Comparison of arrhythmia detection by conventional Holter and a novel ambulatory ECG system using patch and Android App, over 24 h period. Indian Pacing Electrophysiol. J. 2020, 20, 49–53. [Google Scholar] [CrossRef] [PubMed]
  15. Singh, V.; Tewary, S.; Sardana, V.; Sardana, H.K. Arrhythmia Detection-A Machine Learning based Comparative Analysis with MIT-BIH ECG Data. In Proceedings of the 2019 IEEE 5th International Conference for Convergence in Technology (I2CT), Bombay, India, 29–31 March 2019; pp. 1–5. [Google Scholar]
  16. Yan, W.; Zhang, Z. Online Automatic Diagnosis System of Cardiac Arrhythmias Based on MIT-BIH ECG Database. J. Healthc. Eng. 2021, 2021, 1819112. [Google Scholar] [CrossRef] [PubMed]
  17. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 4510–4520. [Google Scholar]
  18. Khan, A.H.; Hussain, M.; Malik, M.K. Cardiac disorder classification by electrocardiogram sensing using deep neural network. Complexity 2021, 2021, 5512243. [Google Scholar] [CrossRef]
  19. Ahsan, M.M.; Nazim, R.; Siddique, Z.; Huebner, P. Detection of COVID-19 patients from CT scan and chest X-ray data using modified MobileNetV2 and LIME. Healthcare 2021, 9, 1099. [Google Scholar] [CrossRef]
  20. Ahsan, M.M.; Siddique, Z. Machine learning-based heart disease diagnosis: A systematic literature review. arXiv 2021, arXiv:2112.06459. [Google Scholar]
  21. Wang, J.; Li, W. Atrial fibrillation detection and ECG classification based on CNN-BILSTM. arXiv 2020, arXiv:2011.06187. [Google Scholar]
  22. Luo, L.; Yang, Z.; Yang, P.; Zhang, Y.; Wang, L.; Lin, H.; Wang, J. An attention-based BiLSTM-CRF approach to document-level chemical named entity recognition. Bioinformatics 2018, 34, 1381–1388. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  23. Hernando-Ramiro, C.; Lovisolo, L.; Cruz-Roldán, F.; Blanco-Velasco, M. Matching Pursuit Decomposition on Electrocardiograms for Joint Compression and QRS Detection. Circuits Syst. Signal Process. 2019, 38, 2653–2676. [Google Scholar] [CrossRef]
  24. Apandi, Z.F.M.; Ikeura, R.; Hayakawa, S. Arrhythmia detection using MIT-BIH dataset: A review. In Proceedings of the 2018 International Conference on Computational Approach in Smart Systems Design and Applications (ICASSDA), Kuching, Malaysia, 15–17 August 2018; pp. 1–5. [Google Scholar]
  25. Dias, F.M.; Monteiro, H.L.; Cabral, T.W.; Naji, R.; Kuehni, M.; Luz, E.J.d.S. Arrhythmia classification from single-lead ECG signals using the inter-patient paradigm. Comput. Methods Programs Biomed. 2021, 202, 105948. [Google Scholar] [CrossRef] [PubMed]
  26. Kuila, S.; Dhanda, N.; Joardar, S. Feature Extraction and Classification of MIT-BIH Arrhythmia Database. In Proceedings of the 2nd International Conference on Communication, Devices and Computing, Haldia, India, 14–15 March 2019; Springer: Singapore, 2020; pp. 417–427. [Google Scholar]
  27. Sundarasekar, R.; Thanjaivadivel, M.; Manogaran, G.; Kumar, P.M.; Varatharajan, R.; Chilamkurti, N.; Hsu, C.H. Internet of things with maximal overlap discrete wavelet transform for remote health monitoring of abnormal ECG signals. J. Med. Syst. 2018, 42, 228. [Google Scholar] [CrossRef] [PubMed]
  28. Xu, X.; Liang, Y.; He, P.; Yang, J. Adaptive motion artifact reduction based on empirical wavelet transform and wavelet thresholding for the non-contact ECG monitoring systems. Sensors 2019, 19, 2916. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  29. Dwivedi, A.K.; Ranjan, H.; Menon, A.; Periasamy, P. Noise reduction in ECG signal using combined ensemble empirical mode decomposition method with stationary wavelet transform. Circuits Syst. Signal Process. 2021, 40, 827–844. [Google Scholar] [CrossRef]
  30. Ribeiro, H.D.M.; Arnold, A.; Howard, J.P.; Shun-Shin, M.J.; Zhang, Y.; Francis, D.P.; Zolgharni, M. ECG-based real-time arrhythmia monitoring using quantized deep neural networks: A feasibility study. Comput. Biol. Med. 2022, 143, 105249. [Google Scholar] [CrossRef]
  31. Naz, M.; Shah, J.H.; Khan, M.A.; Sharif, M.; Raza, M.; Damaševičius, R. From ECG signals to images: A transformation based approach for deep learning. PeerJ Comput. Sci. 2021, 7, e386. [Google Scholar] [CrossRef] [PubMed]
  32. Cai, J.; Sun, W.; Guan, J.; You, I. Multi-ECGNet for ECG arrythmia multi-label classification. IEEE Access 2020, 8, 110848–110858. [Google Scholar] [CrossRef]
  33. Park, J.; Kim, J.K.; Jung, S.; Gil, Y.; Choi, J.I.; Son, H.S. ECG-signal multi-classification model based on squeeze-and-excitation residual neural networks. Appl. Sci. 2020, 10, 6495. [Google Scholar] [CrossRef]
  34. Lee, H.; Yoon, T.; Yeo, C.; Oh, H.; Ji, Y.; Sim, S.; Kang, D. Cardiac Arrhythmia Classification Based on One-Dimensional Morphological Features. Appl. Sci. 2021, 11, 9460. [Google Scholar] [CrossRef]
  35. Understanding AUC–ROC Curve. Available online: https://towardsdatascience.com/understanding-auc-roc-curve-68b2303cc9c5 (accessed on 2 February 2022).
Figure 1. MIT-BIH database contained several ECG signals. The recordings were digitized at 360 samples per second per channel with a resolution of 11 bits: (a) NSR; (b) AFIB; (c) PVC; (d) LBBB. Two or more cardiologists independently annotated each record.
Figure 1. MIT-BIH database contained several ECG signals. The recordings were digitized at 360 samples per second per channel with a resolution of 11 bits: (a) NSR; (b) AFIB; (c) PVC; (d) LBBB. Two or more cardiologists independently annotated each record.
Applsci 12 03291 g001
Figure 2. Workflow of the proposed algorithm. This algorithm randomly replicates ECG signals and classifies them into four classes using MobileNetV2 and BiLSTM. The data were duplicated using a matching pursuit algorithm. Time domain data were converted to frequency domain using wavelet transforms.
Figure 2. Workflow of the proposed algorithm. This algorithm randomly replicates ECG signals and classifies them into four classes using MobileNetV2 and BiLSTM. The data were duplicated using a matching pursuit algorithm. Time domain data were converted to frequency domain using wavelet transforms.
Applsci 12 03291 g002
Figure 3. Digital filter was designed in MATLAB and applied to the ECG signal. Butterworth high-pass and low-pass filters were designed (5−250 Hz), and a band-stop filter was used to reduce the noise at 60 Hz.
Figure 3. Digital filter was designed in MATLAB and applied to the ECG signal. Butterworth high-pass and low-pass filters were designed (5−250 Hz), and a band-stop filter was used to reduce the noise at 60 Hz.
Applsci 12 03291 g003
Figure 4. ECG signals generated by the matching pursuit algorithm. The matching pursuit algorithm generates a correlation matrix obtained through the inner product and selects values in the order such that the correlation size is the largest. The matching pursuit algorithm uses this value to output similar signals.
Figure 4. ECG signals generated by the matching pursuit algorithm. The matching pursuit algorithm generates a correlation matrix obtained through the inner product and selects values in the order such that the correlation size is the largest. The matching pursuit algorithm uses this value to output similar signals.
Applsci 12 03291 g004
Figure 5. Scalogram was used to investigate the frequency characteristics of the ECG signals. A higher voltage of the signal corresponded to a clearer scalogram result. (a) ECG signal; (b) scalogram of the ECG signal.
Figure 5. Scalogram was used to investigate the frequency characteristics of the ECG signals. A higher voltage of the signal corresponded to a clearer scalogram result. (a) ECG signal; (b) scalogram of the ECG signal.
Applsci 12 03291 g005
Figure 6. Diagram of the proposed algorithm. The input data consisted of four classes, and a MATLAB-based digital filter was used for preprocessing. The matching pursuit algorithm was used for data augmentation. MobileNetV2-BiLSTM was applied in the data classification process.
Figure 6. Diagram of the proposed algorithm. The input data consisted of four classes, and a MATLAB-based digital filter was used for preprocessing. The matching pursuit algorithm was used for data augmentation. MobileNetV2-BiLSTM was applied in the data classification process.
Applsci 12 03291 g006
Figure 7. MobileNetV2-BiLSTM structure for classifying data. ECG data are input to BiLSTM through a convolution operation and classified in the FC layer. MobileNet V2 and BiLSTM were combined by Matlab-based Network designer.
Figure 7. MobileNetV2-BiLSTM structure for classifying data. ECG data are input to BiLSTM through a convolution operation and classified in the FC layer. MobileNet V2 and BiLSTM were combined by Matlab-based Network designer.
Applsci 12 03291 g007
Figure 8. Block included in MobileNetV2. The block performs the resize process and convolution of the input data. Normalization is performed in blocks so that algorithms can process data. MobileNetv2 has 16 interconnected blocks.
Figure 8. Block included in MobileNetV2. The block performs the resize process and convolution of the input data. Normalization is performed in blocks so that algorithms can process data. MobileNetv2 has 16 interconnected blocks.
Applsci 12 03291 g008
Figure 9. Architecture of BiLSTM. A bidirectional LSTM (BiLSTM) layer learns bidirectional long-term dependencies between time steps of time series or sequence data. These dependencies can be useful when you want the network to learn from the complete time series at each time step.
Figure 9. Architecture of BiLSTM. A bidirectional LSTM (BiLSTM) layer learns bidirectional long-term dependencies between time steps of time series or sequence data. These dependencies can be useful when you want the network to learn from the complete time series at each time step.
Applsci 12 03291 g009
Figure 10. Results of arrhythmia detection using an ensemble network. Red color indicates cases of misclassification. Green indicates exact classification. Gray indicates the classification result. The values at the end of each row and column indicate accuracy and error rate.
Figure 10. Results of arrhythmia detection using an ensemble network. Red color indicates cases of misclassification. Green indicates exact classification. Gray indicates the classification result. The values at the end of each row and column indicate accuracy and error rate.
Applsci 12 03291 g010
Figure 11. Arrhythmia detection results. A larger AUC corresponds to better performance. AUC denotes the area under the graph, and the four graphs represent the AUC that is proportional to the accuracy of each class.
Figure 11. Arrhythmia detection results. A larger AUC corresponds to better performance. AUC denotes the area under the graph, and the four graphs represent the AUC that is proportional to the accuracy of each class.
Applsci 12 03291 g011
Figure 12. Results of K-fold validation for evaluating the classification performance of the algorithm. When the K value is equal to N, this algorithm performs the verification N times and calculates the average value for all the results. A K value of 10 yielded the best results. If the K value exceeds 10, the accuracy gradually decreases.
Figure 12. Results of K-fold validation for evaluating the classification performance of the algorithm. When the K value is equal to N, this algorithm performs the verification N times and calculates the average value for all the results. A K value of 10 yielded the best results. If the K value exceeds 10, the accuracy gradually decreases.
Applsci 12 03291 g012
Figure 13. Noise removal using a MATLAB-based digital filter. The raw and filtered signals are shown in blue and red, respectively. The cutoff frequencies were set as 5, 250, and 60 Hz for low-pass, high-pass, and band-stop, respectively.
Figure 13. Noise removal using a MATLAB-based digital filter. The raw and filtered signals are shown in blue and red, respectively. The cutoff frequencies were set as 5, 250, and 60 Hz for low-pass, high-pass, and band-stop, respectively.
Applsci 12 03291 g013
Figure 14. Fourier transform was applied to two ECG signals with different frequency characteristics. After applying digital filters to eliminate noise, Fourier transforms confirmed that the designed filter removed the signal in the appropriate frequency band.
Figure 14. Fourier transform was applied to two ECG signals with different frequency characteristics. After applying digital filters to eliminate noise, Fourier transforms confirmed that the designed filter removed the signal in the appropriate frequency band.
Applsci 12 03291 g014
Table 1. Datasets used in this study.
Table 1. Datasets used in this study.
Data IndexData ClassNumber of Data
1–283Normal sinus rhythm (NSR)283
284–418Atrial fibrillation (AFIB)135
419–551Premature ventricular contraction (PVC)133
552–654Left bundle branch block beat (LBBB)103
Table 2. Algorithm performance evaluation results.
Table 2. Algorithm performance evaluation results.
Data IndexClassSensitivitySpecificityPrecisionF1 Score
1NSR0.810.710.870.84
2AFIB0.940.980.930.94
3PVC0.920.970.910.92
4LBBB10.990.960.98
Average-0.920.910.920.92
Table 3. Computational or time-complexity evaluation table of proposed algorithms.
Table 3. Computational or time-complexity evaluation table of proposed algorithms.
OptionValueOptionValue
Batch size30Time elapsed23 m 30 s
Data rotation5Epoch40
Data shift3Iteration120
Validation frequency50Learning rate0.01
Table 4. AUCs of the algorithm.
Table 4. AUCs of the algorithm.
ClassAUC
NSR0.982
AFIB0.997
PVC0.996
LBBB0.999
Average0.994
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Shin, S.; Kang, M.; Zhang, G.; Jung, J.; Kim, Y.T. Lightweight Ensemble Network for Detecting Heart Disease Using ECG Signals. Appl. Sci. 2022, 12, 3291. https://doi.org/10.3390/app12073291

AMA Style

Shin S, Kang M, Zhang G, Jung J, Kim YT. Lightweight Ensemble Network for Detecting Heart Disease Using ECG Signals. Applied Sciences. 2022; 12(7):3291. https://doi.org/10.3390/app12073291

Chicago/Turabian Style

Shin, Siho, Mingu Kang, Gengjia Zhang, Jaehyo Jung, and Youn Tae Kim. 2022. "Lightweight Ensemble Network for Detecting Heart Disease Using ECG Signals" Applied Sciences 12, no. 7: 3291. https://doi.org/10.3390/app12073291

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop