key: cord-0923637-hr23fso2 authors: Yildirim, Ozal; Talo, Muhammed; Ciaccio, Edward J.; Tan, Ru San; Acharya, U Rajendra title: Accurate Deep Neural Network Model to Detect Cardiac Arrhythmia on More Than 10,000 Individual Subject ECG Records date: 2020-09-08 journal: Comput Methods Programs Biomed DOI: 10.1016/j.cmpb.2020.105740 sha: a15de79245e4f45b00d9cf099f6af1ba656b2c42 doc_id: 923637 cord_uid: hr23fso2 BACKGROUND AND OBJECTIVE: : Cardiac arrhythmia, which is an abnormal heart rhythm, is a common clinical problem in cardiology. Detection of arrhythmia on an extended duration electrocardiogram (ECG) is done based on initial algorithmic software screening, with final visual validation by cardiologists. It is a time consuming and subjective process. Therefore, fully automated computer-assisted detection systems with a high degree of accuracy has an essential role in this task. In this study, we proposed an effective deep neural network (DNN) model to detect different rhythm classes from a new ECG database. METHODS: : Our DNN model was designed for high performance on all ECG leads. The proposed model, which included both representation learning and sequence learning tasks, showed promising results on all 12-lead inputs. Convolutional layers and sub-sampling layers were used in the representation learning phase. The sequence learning part involved a long short-term memory (LSTM) unit after representation of learning layers. RESULTS: : We performed two different class scenarios, including reduced rhythms (seven rhythm types) and merged rhythms (four rhythm types) according to the records from the database. Our trained DNN model achieved 92.24% and 96.13% accuracies for the reduced and merged rhythm classes, respectively. CONCLUSION: : Recently, deep learning algorithms have been found to be useful because of their high performance. The main challenge is the scarcity of appropriate training and testing resources because model performance is dependent on the quality and quantity of case samples. In this study, we used a new public arrhythmia database comprising more than 10,000 records. We constructed an efficient deep neural network (DNN) model for automated detection of arrhythmia using these records. Cardiac arrhythmia, defined as an abnormal heart rhythm, is a common problem in cardiology, and can range from benign to potentially life-threatening rhythm type [1, 2] . Official (Closed) -Non Sensitive Therefore, early detection of arrhythmia is an important clinical task that can save lives. The commonest method to detect cardiac arrhythmia uses the electrocardiogram (ECG), which measures the electrical activity of the heart. The standard 12-lead ECG is recorded over a 10 seconds interval. In general, the ECG records include a long duration (i.e., several hours or days) of heart activity samples, as needed for detecting and analyzing arrhythmia [3] . This task can become time-consuming, tedious, subjective, and costly, because it requires the assistance of trained experts [4, 5] . Therefore, enhanced fully automated computer-aided diagnosis systems (CADs) with high accuracy can be feasible and even essential solutions to assist clinical experts during the analysis process [6, 7] . Machine learning-based approaches are frequently utilized to recognize arrhythmia [8] [9] [10] [11] [12] . Pre-processing, feature extraction, and classification tasks are the main steps involved in these approaches [13] . The feature extraction step has a critical role to achieve high classification performance. The researchers choose both some clinical features (i.e., P, QRS, T wave amplitude and duration, etc.) and arbitrary features to meet this aim. In the feature extraction phase, useful morphological [14, 15] , temporal [14, [16] [17] [18] [19] , frequency-based [20] [21] [22] and/or transform-based [23] [24] [25] [26] [27] [28] features from ECG waveforms are obtained to improve the distinction between samples. The handcrafted feature extraction step requires domain knowledge and increases computational complexity [29, 30] . The requirement for expertise to select optimal features is a challenge [31] . In recent years, deep learning [32, 33] has become a popular subfield of artificial intelligence. The deep learning models usually have an end-toend structure. This architectural structure enables one to perform feature extraction and classification steps together [34] . It has been effectively used in medical applications such as brain image analysis [35] [36] [37] [38] , histopathological images [39] [40] [41] , and brain electroencephalogram (EEG) signal analyses [42] [43] [44] [45] . It has also been adopted for the detection of coronavirus (COVID-19) patients [46] [47] [48] [49] [50] [51] . Deep learning has been the preferred mode of ECG classification over the last few years [4, 31, [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] . One-dimensional convolutional neural networks (1D-CNN) have become popular to classify ECG records because of their one-dimension structure. In 2015, Kiranyaz et. al. [55] proposed a 1D convolutional neural network (1D-CNN) model for patient-specific ECG classification. Acharya et al. [4] developed a nine-layer CNN model to classify five types of heartbeats. They obtained an accuracy of 94.03% from original signals using an augmentation technique. Hannun et al. [56] proposed a CNN model that consists of 33 convolutional layers to classify 12 rhythm categories. They based their work on a large ECG dataset containing Official (Closed) -Non Sensitive 91,232 records from 53,549 patients. Li et al. [57] presented a generic CNN for patientspecific ECG classification. Oh et al. [58] suggested a modified U-net architecture to diagnose beat wise arrhythmia. Li et al. [59] developed a 31-layer 1D residual CNN model to identify five different types of heartbeats. Li et al. [31] recommended a customized CNN model to classify patient-specific heartbeat using 44 records. Yildirim et al. [60] applied a CNN model for classification of 17 cardiac arrhythmias using long-duration ECG signals. Sharker et al. [61] proposed an end-to-end deep learning model to classify 15 ECG classes. Another deep learning algorithm for ECG analysis is long short-term memory networks (LSTM), known as sequence learning. LSTM is a practical approach to analyze time-series data [62] . In the last decade, the LSTM algorithm has been employed for arrhythmia detection [30, [63] [64] [65] [66] [67] [68] [70] [71] [72] [73] . Yildirim [65] proposed a wavelet sequence-based LSTM model to classify ECG signals. Chang et al. [66] employed a bidirectional LSTM model to classify 12 common heart rhythms on 12-lead ECG signals collected from 38,899 patients. Gao et al. [30] used an LSTM model with focal loss (FL) to classify eight different heartbeats. The performance of deep models tends to improve with more training data [32] . Accessing public databases is a major challenge in medicine, as these records are costly and timeconsuming to collect [74] . In addition, legal and ethical issues may arise when collecting data [75] . The most widely used public database for arrhythmia studies is the MIT-BIH Arrhythmia Database [76] collected 40 years ago [77] . This dataset has some limitations, such as imbalanced classes [61] . Therefore, the construction of new large public datasets plays a vital role for studies on arrhythmia. As described herein, we used one of the largest public ECG datasets to detect rhythm classes [78] . The database includes 12-lead ECG signals collected from more than 10,000 individual subjects. We developed a DNN model to classify rhythms from each of 12-lead inputs. We preferred to use the representation and sequence learning structure together because of their salutary performance on both ECG [52, 67, 68, 72] and EEG signals [45] . The novelty of this paper can be summarized as follows: a useful single DNN model has been constructed to detect multiple rhythm classes on 12-lead signals. The experiments are performed on one of the recent largest new ECG datasets, including more than 10,000 subjects. To the best of our knowledge, this is the first deep model study to classify rhythms using this ECG dataset. All of the experiments were performed with interpatient schema. Additionally, the training and testing subjects were different, so that there is no overlap between the train and the test sets. In this paper, we used both representation and sequence learning to detect heart rhythms and conducted the experiments in a large ECG database. The database had been recently published for arrhythmia research and encompasses more than 10,000 individual subject ECG records. In Fig. 1 , a block representation of the materials and methods is given for the study. We designed a new deep neural network model to classify rhythms automatically. In Fig.2 , a block representation of the proposed DNN model is given. We constructed the proposed deep learning model using different layer combinations. We preferred a one-dimensional convolutional neural network (1D-CNN) due to the one-dimensional structure of ECG signals. One-dimensional-CNN models have an excellent ability to learn distinguishing hierarchical features from the raw inputs when applying a 1D convolution. This procedure is also known as representation learning [45] . The model learns low-level features at beginning layers and high-level features through the consecutive layers hierarchically. After the 1D convolution step, many feature matrices termed feature maps emerge. These maps are subsampled by the max-pooling layers to reduce computational cost. A tedious task is to determine the correct parameters, such as the number of filters, kernel size, and strides. We used both our previous experience on the long duration ECG signals [60] and brute force techniques to adjust these parameters. For the number of filters, experiments were made based upon exponents of two, in the range from 16 to 1024. Performance observations were made by selecting values from a smaller search space such as 2, 3, 5, 7, 9 and 13 for kernel sizes. Since the length of the input signal is long, 21 kernels are used in the first layer and 11 strides are used to reduce the computational cost. All of these parameter settings have been adjusted to provide the optimal result by testing for different data partitions. In addition, the parts such as which layers should be used and which parts of the model should be placed are time consuming and difficult processes. These processes can be solved with a satisfactory optimization approach and hardware with high computing power. However, the best opportunity we have is to adjust these parameters with the help of experts by trying many different variations. In the proposed model, the first convolution layer had 64 filters with 21 kernel size that was applied to the raw input signals using an eleven movement amount (strides). The feature maps obtained from this step were sub-sampled in a max-pooling layer. The proposed model consisted of six different convolution layers and four max-pooling layers. We used two batch normalization layers to normalize the data. Overfitting is an important problem for machine learning tasks during training. Two dropout layers were placed at different positions of the model to avoid the overfitting problem. A Leaky-ReLU layer with 0.1 alpha value was used at the beginning layers. It is a useful function to avoid the dying ReLU problem. All layers mentioned so far were used for representation learning. In the model, an LSTM block was used for sequence learning. Some studies on 1D signals such as EEG and ECG [52, 67, 68, 72] show that the combination of representation and sequence learning can yield a higher performance than by using representation learning alone. According to this information, we used a 128 unit LSTM block at the end of the representation learning layers. In Table 1 , we present our implemented DNN model with detailed layer information. In this work, we used a new large ECG database [78] collected by Chapman University and Shaoxing People's Hospital (Shaoxing Hospital Zhejiang University School of Medicine). The database includes a large number of individual subjects -more than 10,000 -with 12-lead ECG signals sampled at a higher than usual sampling rate of 500 Hz. In this database, there are 11 heart rhythms and 56 types of cardiovascular conditions labelled by professional physicians. The database comprises 10,646 patients, and 12-lead ECGs records were acquired over 10 seconds. The Butterworth low pass filter [79] , the local polynomial regression smoother (LOESS) [80] , and Non-Local Means (NLM) techniques [81] had been used sequentially to process raw ECG records. Signal components with a frequency above 50 Hz and the effects of baseline wandering were removed using these methods. In Fig. 3 , the preprocess step is shown with a signal sample and frequency spectrums. In this image, it can be seen that after the pre-processing, frequencies above 50 Hz and the baseline wandering effect are removed. Since some ECG recordings contain only zeros, and some channel values were missing, we used a total of 10,588 topics from this database. Table 2 contains some numerical information about the recordings used, and Fig.4 depicts a distribution rate graph of rhythm classes across the database. Table 2 . Some numerical information about the ECG records used. Age, Mean ± Std In this section, we present experimental results to detect rhythm classes on 10-second ECG signals. We used 11 rhythms with two scenarios, and seven and four categories. In this study, two different experiments were performed on the dataset. The first experiment studied seven rhythm classes; the second, four. Also, 12-lead ECG signals from different subjects were used separately for analysis and performance evaluations. We have used an inter-patient scheme during the experiments. Only a single efficient DNN model was used for all experiments. The hyper-parameters of the DNN model were not altered during training. The standard hyper-parameters of the model were set as a learning value of 0.002, and batch size 128. We categorically used the cross-entropy loss function and Adam optimizer to adjust the weights of the model [82] . All experiments were performed on a computer with specifications of Intel Core i7-7700HQ 2.81GHz CPU, 16GB memory, and 8 GB NVIDIA GeForce GTX 1070 graphics card. The DNN model was constructed using the Keras (v 2.3.1) deep learning library [83] and the TensorFlow (v. 1.14.0) framework. Another important step is preparing train, validation, and test sets for the implementation of the model. There are two standard methods for this task, cross-validation and random splitting. In general, per subject evaluation of the models can provide more reliable results. Each subject in this database has only one unique record. Therefore, the dataset split was done on a per subject basis. The large size of the ECG dataset renders it suitable for random splitting. The dataset randomly divided into training, validation, and test sets as 80%, 10%, and 10%, respectively. We used the same records for training, validation, and testing for the experiments to compare the performances consistently. We evaluated the performance of the model on the test sets using standard evaluation metrics, such as accuracy, specificity, sensitivity, precision, and F-score. The calculations of these criteria, according to distribution of true positive (TP), true negative (TN), false positive (FP) and false negative (FN) samples, are given as follows: (1) Precision=TP/(TP+FP) Recall=TP/(TP+FN) In this section, we used the DNN model on seven rhythm classes. sinus atrium to atrial wandering rhythm, we eliminated these classes during the experiment. In Table 3 , the used dataset includes seven rhythms and is given here with detail. Official (Closed) -Non Sensitive Firstly, we divided the reduced dataset into training, validation, and testing sets as 80%, 10%, and 10%, respectively. It is seen that the data distributions used in this scenario are After the training process, the performance of the DNN model was tested on the unseen test sets. Deep learning models use validation samples for adjusting network parameters. Thus, reliable performance measurements could be obtained from the unseen test sets. The trained model was applied to the test records and yielded promising results on unseen data. In Figure 7 , we showed four confusion matrices obtained during the test process. The confusion matrix has an essential role in the evaluation of the performance of a model. In Fig. 7 For further performance evaluation, we examined the values of the test results for each rhythm class compared with Lead-II input, so as to ascertain which classes yielded a weak or strong performance by the DNN model. We chose the Lead-II signal for this purpose, due to both its high accuracy values, and the fact that it is commonly used in many ECG analysis studies. In Table 5 , some standard performance measurements of rhythm classes on the test subjects are given. for this can be the low number of data in this class. A similar problem was also observed between the SI and SR classes. Accordingly, we present some incorrectly classified signals related to these classes in Fig. 9 . In this figure, some actual and predicted classes are given for the Lead-II signals. On the other hand, the model was able to distinguish sinus bradycardia (SB) signals from other classes, with a 99.04% accuracy performance. Figure 9 . Some examples of AF and SR signals that the proposed model incorrectly predicted (Actual: original class, predicted: detected class by the model). In the previous experiments, the DNN model produced some weak class performances due to similarity, e.g. the AF, AFIB, SR, and SI classes yielded low-performance values. Also, in the dataset, several classes had fewer samples, such as AVNRT, AVRT, and SAAWR. To overcome this, we merged 11 rhythms into four classes as AFIB, grouped supraventricular tachycardia (GSVT), SB, and SR, according to the original dataset article [78] . In Table 6 , some brief information is provided concerning the merged classes. In this experiment, we applied the DNN model on these merged rhythm classes. We divided the merged dataset into training, validation and testing sets as 80%, 10%, and 10%, respectively. The same hyper-parameters from previous experiments were used in this experiment. In Fig. 10 , accuracy and loss graphs for each lead are given during the training step. It can be seen from these plots that the best results are obtained from the Lead-II signal. Also, the model showed consistent results with four rhythm classes. There was no overfitting or underfitting problem. Therefore, our proposed model architecture is robust to detect rhythms with two different scenarios. The trained model has been applied to the unseen test records. We present all confusion matrices for each lead signal in Fig. 11 . Table 7 , the performance metrics on the test sets are given in detail. Official (Closed) -Non Sensitive The best overall performances were obtained from the Lead-II input with 95.43% sensitivity, 98.71% specificity, 95.78% precision, 95.57% F-score, and 96.13% accuracy. We show the class-based performances for the Lead-II input in Table 8 . The lowest sensitivity performance, which emerged from the GSVT class, was 89.94%. Many researchers have attempted to develop an arrhythmia detection system using deep learning architectures. They used different data sources and approaches for this task. We have reported several state-of-the-art studies in Table 9 have already obtained highest accuracy using a single lead. Hence, we did not combine the performance of all leads. However, we analyzed all lead signals and according to the results our model performance can be generalizable to 12-lead signals. We intend to explore this further using a new DL model in future work. In addition, many of the studies [4, 5, 30, 58, 59, 61, 65, 67] are predicated on the detection of heartbeat signals, unlike in our model, which is based on the 10-second ECG input. The main advantages of the system presented in this study can be summarized as:  Only one DNN model was used to classify different rhythm groups with high performance using all lead signals.  We used a public ECG dataset, which is recent, and one of the largest datasets, containing more than 10,000 unique subject data.  The experiments were performed using 11 different rhythm categories with 10-sec ECG records.  All experimental results were reported with inter-patient schema, and the performance of the model was promising.  The model has a good generalization ability to detect ECG arrhythmia for each of 12lead ECG signals.  The model worked on 10-second ECG records and did not require the detection of heartbeats. The main disadvantage of this work is the requirement for sophisticated hardware due to the nature of the deep models. In future works, we will evaluate these ECG records with multitask deep learning models. In addition, some features in non-ECG domains were also provided within this database, and we will try to use these features to improve the performance of deep models. In this paper, a new DNN model comprising both representation and sequence learning structures was proposed to detect arrhythmia. Experiments were performed on a new large public ECG database that includes more than 10,000 unique subject records. The DNN model was applied to the 10-s raw 12-lead ECG signals. The proposed DNN model yielded promising results for each lead input. Two different rhythm class scenarios were used for the experiments. The first scenario included seven rhythm classes, for which the model obtained an accuracy of 92.24%. In the second scenario, 11 rhythm classes were merged into four main rhythm classes. The model achieved an accuracy of 96.13% performance on this dataset. According to the obtained results, it can be said that the proposed DNN model has a good generalization ability for subject-wise classes. Mechanisms of sudden cardiac death Neural mechanisms in life-threatening arrhythmias A convolutional neural network for ECG annotation as the basis for classification of cardiac rhythms A deep convolutional neural network model to classify heartbeats Towards end-to-end ECG classification with raw signal extraction and deep neural networks Computer aided diagnosis for cardiovascular diseases based on ecg signals: a survey A systematic survey of computer-aided diagnosis in medicine: Past and present developments Novel methodology for cardiac arrhythmias classification based on long-duration ECG signal fragments analysis A machine learning approach to multi-level ECG signal quality classification. Computer methods and programs in biomedicine Wavelet-based machine learning techniques for ECG signal analysis Novel deep genetic ensemble of classifiers for arrhythmia detection using ECG signals The application of autoregressive modeling in cardiac arrhythmia classification Automatic classification of CAD ECG signals with SDAE and bidirectional long short-term network Official (Closed) -Non Sensitive A patient-adapting heartbeat classifier using ECG morphology and heartbeat interval features Heartbeat classification using morphological and dynamic features of ECG signals Feature extraction for ECG heartbeats using higher order statistics of WPD coefficients. Computer methods and programs in biomedicine Linear and nonlinear analysis of normal and CAD-affected heart rate signals. Computer methods and programs in biomedicine Application of higher order statistics for atrial arrhythmia classification Application of higher order spectra for accurate delineation of atrial arrhythmia Frequency-domain features for ECG beat discrimination using grey relational analysis-based classifier ECG beat detection and classification system using wavelet transform and online sequential ELM Hypertension diagnosis index for discrimination of high-risk hypertension ECG signals using optimal orthogonal wavelet filter Bank Characterization of ECG beats from cardiac arrhythmia using discrete cosine transform in PCA framework. Knowledge-Based Systems Automated arrhythmia detection using novel hexadecimal local pattern and multilevel wavelet transform with ECG signals. Knowledge-Based Systems Automated detection of shockable and non-shockable arrhythmia using novel wavelet-based ECG features Detection of shockable ventricular arrhythmia using optimal orthogonal wavelet filters Automated heartbeat classification and detection of arrhythmia using optimal orthogonal wavelet filters Automated detection of severity of hypertension ECG signals using an optimal bi-orthogonal wavelet filter bank Automated ECG classification using dual heartbeat coupling based on convolutional neural network An effective LSTM recurrent network to detect arrhythmia on imbalanced ECG dataset Automated Heartbeat Classification Exploiting Convolutional Neural Network With Channel-Wise Attention Deep learning. nature Deep learning Learning deep architectures for AI Brain tumor segmentation using convolutional neural networks in MRI images Automatic segmentation of MR brain images with a convolutional neural network Application of deep transfer learning for automated brain abnormality classification using MR images Convolutional neural networks for multi-class brain disease detection using MRI images Automatic detection of invasive ductal carcinoma in whole slide images with convolutional neural networks Automated invasive ductal carcinoma detection based using deep transfer learning with whole-slide images Automated classification of histopathology images using transfer learning Recurrent neural network based prediction of epileptic seizures in intra-and extracranial EEG Deep convolutional neural network for the automated detection and diagnosis of seizure using EEG signals A deep convolutional neural network model for automated identification of abnormal EEG signals Automated depression detection using deep representation and sequence learning with EEG signals COVID-19 detection using deep learning models to exploit Social Mimic Optimization and structured chest X-ray images using fuzzy color and stacking approaches Automated detection of COVID-19 cases using deep neural networks with X-ray images Explainable Deep Learning for Pulmonary Disease and Coronavirus COVID-19 Detection from X-rays Automated deep transfer learning-based approach for detection of COVID-19 infection in chest X-rays Convolutional CapsNet: A novel artificial neural network approach to detect COVID-19 disease from X-ray images using capsule networks Deep Convolutional Neural Networks based Classification model for COVID-19 Infected Patients using Chest X-ray Images Application of deep learning techniques for heartbeats detection using ECG signals-analysis and review Automated detection of arrhythmias using different intervals of tachycardia ECG segments with convolutional neural network Automated identification of shockable and non-shockable life-threatening ventricular arrhythmias using convolutional neural network Real-time patient-specific ECG classification by 1-D convolutional neural networks Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network Patient-specific ECG classification by deeper CNN from generic to dedicated Automated beat-wise arrhythmia diagnosis using modified U-net on extended electrocardiographic recordings with heterogeneous arrhythmia types Heartbeat classification using deep residual convolutional neural network from 2-lead electrocardiogram Arrhythmia detection using deep convolutional neural network with long duration ECG signals Generalization of Convolutional Neural Networks for ECG Classification Using Generative Adversarial Networks LSTM can solve hard long time lag problems Official (Closed) -Non Sensitive Automated prescreening of arrhythmia using hybrid combination of Fourier-Bessel expansion and LSTM A new approach for arrhythmia classification using deep coded features and LSTM networks. Computer methods and programs in biomedicine A novel wavelet sequence based on deep bidirectional LSTM network model for ECG signal classification Usefulness of Machine-Learning-Based Detection and Classification of Cardiac Arrhythmias with 12-Lead Electrocardiograms Automated diagnosis of arrhythmia using combination of CNN and LSTM techniques with variable length heart beats Ensembling convolutional and long short-term memory networks for electrocardiogram arrhythmia detection AF Classification from a short single lead ECG recording: the PhysioNet/Computing in Cardiology Challenge ECG signal classification for the detection of cardiac arrhythmias using a convolutional recurrent neural network Inter-patient ECG classification with convolutional and recurrent neural networks Comprehensive electrocardiographic diagnosis based on deep learning Single-modal and multi-modal false arrhythmia alarm reduction using attention-based convolutional and recurrent neural networks Guest editorial deep learning in medical imaging: Overview and future promise of an exciting new technique Applications of artificial intelligence in cardiology. The future is already here The impact of the MIT-BIH arrhythmia database Opportunities and challenges of deep learning methods for electrocardiogram data: A systematic review A 12-lead electrocardiogram database for arrhythmia research covering more than 10,000 patients Official (Closed) -Non Sensitive On the theory of filter amplifiers Locally weighted regression: an approach to regression analysis by local fitting A review of image denoising algorithms, with a new one Adam: A method for stochastic optimization Keras: Deep learning library for theano and tensorflow Ecg signal classification with binarized convolutional neural network The PhysioNet/computing in cardiology challenge 2015: reducing false arrhythmia alarms in the ICU Multi-class Arrhythmia detection from 12-lead varied-length ECG using Attention-based Time-Incremental Convolutional Neural Network. Information Fusion The authors declare that there is no conflict of interest.