|Year : 2018 | Volume
| Issue : 2 | Page : 55-59
Analysis of 12-lead electrocardiogram signal based on deep learning
Yangxin Chen1, Gang Du2, Jiangting Mai1, Wenhao Liu1, Xiaoqiao Wang3, Junxia You4, Yuyang Chen5, Yong Xie1, Hai Hu6, Shuxian Zhou1, Jingfeng Wang1
1 Department of Cardiology, Sun Yat-Sen Memorial Hospital of Sun Yat-Sen University; Guangdong Province Key Laboratory of Arrhythmia and Electrophysiology, Guangzhou, Guangdong Province, China
2 Zhujiang Hospital, Southern Medical University; Department of Bioinformatics, Guangzhou Gencoding Lab, Guangzhou, Guangdong Province, China
3 Department of Anesthesiology, Second Affiliated Hospital of Guangzhou Medical University, Guangzhou, Guangdong Province, China
4 Department of Bioinformatics, Guangzhou Gencoding Lab, Guangzhou, Guangdong Province, China
5 Department of Cardiology, Sun Yat-Sen Memorial Hospital of Sun Yat-Sen University, Guangzhou, Guangdong Province, China
6 Department of Tumor Chemotherapy, Sun Yat-Sen Memorial Hospital of Sun Yat-Sen University, Guangzhou, Guangdong Province, China
|Date of Web Publication||5-Feb-2019|
Prof. Jingfeng Wang
Department of Cardiology, Sun Yat-Sen Memorial Hospital of Sun Yat-Sen University, Guangzhou 510120, Guangdong Province
Source of Support: None, Conflict of Interest: None
Background: In this work, a deep learning method is proposed to identify the types of arrhythmia. Methods: The 12-lead electrocardiogram signal is first denoised by filters to eliminate the baseline drift and the myoelectric interference. Then, the filtered signal is sliced into beats and sent to a deep neural network, which contains four convolutional layers, two gated recurrent unit layers, and one full-connected layer. Features in both the spatial domain and the time-frequency domain can be extracted implicitly by the deep neural network, instead of being extracted manually. Results: On the test split of the dataset, our neural network model achieves an accuracy of 98.15%. Among the accuracies for the four types of arrhythmia, respectively, the lowest one is 96% and the highest is 99%. Our model is must better than a baseline support vector machines classifier, with a test accuracy of 73.54%. Conclusion: The results give a supportive evidence to make our model clinically applicable to assist physicians in diagnosing certain diseases.
Keywords: 12-Lead electrocardiogram, arrhythmia, deep learning, denoising, neural network, support vector machine
|How to cite this article:|
Chen Y, Du G, Mai J, Liu W, Wang X, You J, Chen Y, Xie Y, Hu H, Zhou S, Wang J. Analysis of 12-lead electrocardiogram signal based on deep learning. Int J Heart Rhythm 2018;3:55-9
|How to cite this URL:|
Chen Y, Du G, Mai J, Liu W, Wang X, You J, Chen Y, Xie Y, Hu H, Zhou S, Wang J. Analysis of 12-lead electrocardiogram signal based on deep learning. Int J Heart Rhythm [serial online] 2018 [cited 2020 Aug 6];3:55-9. Available from: http://www.ijhronline.org/text.asp?2018/3/2/55/250862
Yangxin Chen, Gang Du and Jiangting Mai contributed equally to this work.
| Introduction|| |
An electrocardiogram (ECG) is a waveform chart of the electrical activity of the heart during each cardiac cycle, which is reflected in the electrical response of the body surface. ECG reflects the law of cardiac activity and the physiological status of each body part. Therefore, ECG is an important reference for myocardial ischemia and arrhythmia diagnosis. In the traditional diagnosis of the heart diseases, the doctor needs to make conclusions according to his/her own experiences by observing the patient's ECG and symptoms, which has a higher requirement for the doctor's experiences. In addition, doctor's observation of the ECG is usually limited to the time-domain features, while frequency domain features also contain valuable information. At present, most of the intelligent analysis tasks of ECG data are based on traditional machine learning (ML). However, there are drawbacks of traditional ML, which are the need of manually extracted features and the use of shallow feature learners., Deep learning (DL) neural networks and in particular convolutional neural networks (CNN) have gained a lot of applications in multi-dimensional signal processing problems, such as computer vision, natural language processing, and speech recognition. In the latest report of Andrew Ng's group, they used a 34-layer CNN, whose performance exceeded the average cardiologist performance in both recall and precision based on the single-lead ECG data from a wearable monitor. An ECG signal is a time series, in which the long short-term memory neural network (LSTM) has a good performance for mining information. The gated recurrent unit (GRU), which is a variant of the LSTM, is simpler than the LSTM but as good as the LSTM.
In this work, a DL model stacking a CNN and a GRU is presented, and its ECG classification results are shown. The model uses both the time-frequency features and the spatial features extracted from data consist of a 12-lead signal, instead of using pure CNN. The accuracy of this DL model is much higher than that of a support vector machine (SVM) classifier.
| Materials and Methods|| |
The DL model, we constructed contains four convolutional layers, two GRU layers, and one fully connected layer. [Figure 1] shows the model structure. In the CNN part, convolutional layers have 64, 128, 128, 128 kernels of size 3 × 3, respectively. Moreover, each GRU layer had 32 nodes. At the end of the network, there is a fully connected layer with four nodes.
In this paper, the ECG data used are obtained from St. Petersburg Institute of Cardiological Technics 12-Lead Arrhythmia Database (Incart; St. Petersburg, Russia). This database consists of 75 annotated recordings. Each record, sampled at 257 Hz, is 30 minutes long and has 12 standard leads. All of the data contain over 175,000 heartbeats and are annotated with the abbreviations of the disease names. There are 11 classes in total, but not all of them can be used in this work, due to the extreme imbalance of data. The data is distributed as shown in [Table 1].
| Methodology|| |
Only four classes were chosen: N, V, A, and R, which represent normal, premature ventricular contraction, atrial premature beats, and right bundle branch block beat, respectively.
Raw ECG data contain a lot of noises, of which the most important sources are the baseline drift, power frequency interference, and myoelectric interference. Power frequency interference is usually filtered on the hardware. Therefore, only the other two were considered.
We first removed baseline drift from ECG signals. Due to the movement of chest muscles during human breathing, baseline of the ECG signal tends to rise and fall, instead of lying in a straight line. Baseline drift is low-frequency noise, with frequency ranging from 0.05 Hz to 2 Hz. It made great changes in the morphology of ECG signals. Median filtering was adopted in this work to remove baseline drift. Steps were described as follows.
Take an odd number N as the window length. For each pointpin the ECG signal, center this point and take (N-1)/2 points forward as well as backward. Then, the median of the amplitudes of those N points was found as the drift of point p. Finally, after subtracting the drift from the original signal we get the data without baseline drift. [Figure 2] shows the original signal, baseline drift, and filtered signal.
|Figure 2: Electrocardiogram signal before and after median filtering and baseline drift denoising|
Click here to view
Myoelectric interference is caused by muscle tremors of the body surface. The frequency band is very wide, ranging from 5 Hz to 2000 Hz, showing irregular and rapid changes in waveform. Since the low-frequency noise will be removed during baseline drift denoising, this article will use wavelet transform to filter out the high-frequency part of myoelectric interference, which is mainly reflected in the ECG as small burrs.
In this work, the fourth-order wavelet transform is performed on the baseline drifted ECG signal. Then, we get approximate coefficients and detail coefficients. Most of the high-frequency noise is in the detail coefficients, so a threshold processing is to be performed on them to denoise. Finally, get the denoised detail coefficients and approximate coefficients to reconstruct a new signal, and wavelet denoise has been done. [Figure 3] shows signals before and after wavelet denoising.
Identification of heart rhythm
Although an ECG signal is obtained from a patient with heart disease, it is impossible that all the heart beats are abnormal. Usually, the normal and abnormal beats are mixed together. Therefore, we should slice an ECG signal into a list of heartbeats and use those heartbeats to train the network.
All the ECG signals are annotated beat by beat, both the R peaks and labels. According to the sampling rate and duration of a heartbeat, there are about 257 points in each beat. We use the R peak as the center of each heartbeat and include 100 data points before and 149 after the R peak into the data of the heartbeat. After slicing signals into heartbeats, the preprocessing has been done. [Figure 4] shows a 12-lead heartbeat.
Due to the imbalance of the data, we use all of 1941 samples of label A, and select 1941 samples randomly from classes N, R, and V, respectively. About 80% of samples are used for training and 20% for validation. The inputs of the network are matrixes of size 12 × 250. We first used each lead of signal to train the model, found that classification result is not bad. Then, we sent all the 12 leads into the network and got a better result. The entire training was performed 100 times on a workstation with an Intel Xeon 2.00 GHz processor and 64 GB of RAM.
Besides, the same dataset is used to train the SVM classifier. We tried all four kernels in rbf, linear, poly, and sigmoid, and changed the C value between 0 and 1 with intervals of 0.05.
| Results|| |
DL model results
The average loss of 12 single-lead ECG training is 0.173, and the average accuracy is 0.9517, generally lower than that of 12-lead data, which is 0.9815. [Figure 5] shows the curves of accuracy and loss of those two types of training. Using 12-lead ECG data for training has higher classification accuracy than using only one lead and is more stable.
|Figure 5: Comparison of training-validation loss and accuracy between single-lead and 12-lead electrocardiogram inputs|
Click here to view
[Figure 6] shows the confusion matrix of the four classes. It can be seen that the classification accuracy of each category is very high, even the lowest atrial premature beats also reach 96%.
Of the four kernels, linear kernel performs best with C value at 0.04839, and as C increases, overfitting becomes more and more serious. The training accuracy and testing accuracy are 0.8364 and 0.7354, respectively, much lower than the DL method.
| Discussion|| |
Many researchers have done analysis on ECG signals, most of which are based on single-lead or two-lead ECG signals., However, the standard 12-lead ECG signal system can reflect the status of heart from different angles. If only one or two leads of ECG are used, some important information may be missed, which may affect the accuracy of the judgment, and even cannot distinguish certain diseases.
The strong learning ability of deep neural network makes DL shine in many fields. It can autonomously learn the inherent laws of data and does not need to extract features manually. This avoids the loss of part of the information due to the limitations of human experience. When there are enough data with good quality, the effect of DL tends to be good.
To realize the intelligent diagnosis of ECG signals, we constructed a deep neural network with four convolutional layers and two GRU layers as the main body in this work. We have arranged the 12 leads of a heartbeat in the form of a two-dimensional matrix, which the CNN is suitable for processing. It can find the features of ECG signal in the spatial domain. Besides, the GRU is good at processing time series. It can dig out the information of ECG signal in the time-frequency domain. In the end, our model achieved high classification accuracy. When we trained the model with 12-lead ECG data, the general testing accuracy was as high as 98%, much higher than that of SVM, which is the common method used by many researchers in 12-lead ECG signal classification. This result is enough to make our model clinically applicable to assist physicians in diagnosing certain diseases. However, due to the lack of data, this work only deals with four categories, and the application area is relatively narrow, which still needs to be improved.
Financial support and sponsorship
This work is mainly supported by the National Natural Science Foundation of China (No. 81570213, 81570329, 91439125, 81500307, 81700215, 81300071, 81600233, 81770229, and 81700359) and the PhD Start-up Fund of Guangzhou Medical University, China (No. 2014C31).
Conflicts of interest
There are no conflicts of interest.
| References|| |
Smith DW, Nowacki D, Li JK. ECG T-wave monitor for potential early detection and diagnosis of cardiac arrhythmias. Cardiovasc Eng 2010;10:201-6.
Luo K, Li J, Wang Z, Cuschieri A. Patient-specific deep architectural model for ECG classification. J Health Care Eng 2017;2017:13.
Deng L, Yu D. Deep learning: Methods and applications. Found Trends Signal Process 2014;7:197-387.
Wang J, Cao H, Zhang JZ, Qi Y. Computational protein design with deep learning neural networks. Sci Rep 2018;8:6349.
Rajpurkar P, Hannun AY, Haghpanahi M, Bourn C, Ng AY. Cardiologist-Level Arrhythmia Detection with Convolutional Neural Networks. Ithaca (NY): ArXiv Org; c2017.
Yu Z, Moirangthem DS, Lee M. Continuous timescale long-short term memory neural network for human intent understanding. Front Neurorobot 2017;11:42.
Che Z, Purushotham S, Cho K, Sontag D, Liu Y. Recurrent neural networks for multivariate time series with missing values. Sci Rep 2018;8:6085.
Lo CI, Chang SS, Tsai JP, Kuo JY, Chen YJ, Huang MY, et al.
Evaluation of the accuracy of ECG captured by CardioChip through comparison of lead I recording to a standard 12-lead ECG recording device. Acta Cardiol Sin 2018;34:144-51.
Li JS, Holmes WH. Analog implementation of median filter for real-time signal processing. Circuits Syst IEEE Trans 1988;35:1032-3.
Safdarian N, Dabanloo NJ, Attarodi G. A new pattern recognition method for detection and localization of myocardial infarction using T-wave integral and total integral as extracted features from one cycle of ECG signal. J Biomed Sci Eng 2014;7:818-24.
Hamilton PS, Tompkins WJ. Quantitative investigation of QRS detection rules using the MIT/BIH arrhythmia database. IEEE Trans Biomed Eng 1986;33:1157-65.
[Figure 1], [Figure 2], [Figure 3], [Figure 4], [Figure 5], [Figure 6]