ECG Signal Classification Algorithm Based on Fusion Features

Cardiovascular disease is a common and frequently-occurring disease in clinic. Cardiovascular disease detection has become the primary concern of people’s health and the mortality is very high. In order to improve the accuracy and universality of the current ECG signal classification algorithm under multi-classification conditions, an ECG signal classification algorithm based on fusion features is proposed. The algorithm uses multi-layer Convolution Neural Network and Recurrent Neural Networks. The spatial and temporal features of ECG signals are extracted automatically. Finally, the accurate classification of ECG signals is realized by using multi-fusion features. In order to verify the accuracy of the algorithm, using MIT-BIH arrhythmia database as the standard test data, the classification accuracy of the algorithm is 99.42%. Compared with the ECG classification algorithm in document[1] [2], the algorithm proposed in this paper abandons the complexity of the traditional ECG algorithm in the process of data feature extraction and solving the problem of insufficient feature extraction of single convolution neural network for one-dimensional ECG signal leads to poor classification effect of small probability samples. The classification sensitivity of ECG classification is improved from 83.00% of single convolution network to 97.07% of class S (supraventricular abnormal beats) classification sensitivity, The classification sensitivity of Class F (Fused Rhythm) is increased from 74.48% to 97.24%, which significantly improves the classification sensitivity of small probability abnormal rhythms, and increases the universality of ECG classification algorithm in multi-class beat recognition.


Introduction
Artificial intelligence technology is very popular in recent years. With the increase of computational power, the conditions restricting deep learning have been solved, and deep learning technology has made rapid progress. The most extensive application of deep learning technology in medical treatment is undoubtedly medical diagnosis, among which ECG automatic diagnosis is one of the important tools for heart disease diagnosis. At present, most of the proposed ECG classification algorithms do not apply AAMI(The Association for the Advancement of Medical Instrumentation) standard, but arbitrarily select a number of MIT-BIH beats to classify. They are not universal and can not scientifically and effectively compare the merits and demerits of each algorithm. This is a very serious problem in the field of ECG classification.All the experiments in this paper are based on the classification criteria and evaluation criteria stipulated by AAMI standard.
In this paper, two kinds of deep neural network structures are proposed to perform multi-class experiments on MIT-BIH arrhythmia data. In model one, the network structure of three layers of onedimensional convolution layer, three layers of one-dimensional pooling layer and softmax output layer

Method
ECG signal classification is a multi-classification task for one-dimensional signal input. The input is one-dimensional ECG sequence signal = [ 1 , 2 , 3, … ],The output is the corresponding label = [ 1 , 2, 3 , … ], Each output tag corresponds to the category of the input ECG beat, and the cross-entropy is used as the objective function to optimize all samples in the training set.
p represents the probability value of the label which is determined by the network model. In this section, the detailed model structure of the proposed single convolution network based ECG classification algorithm and fusion feature based ECG classification algorithm, as well as the process of MIT-BIH ECG data preprocessing and model training and evaluation are given.

Network structure
In this paper, two kinds of neural network models for ECG signal classification are presented as shown in figure. 1 figure 1. The model consists of three layers of convolution, three layers of pooling, one layer of full connection and softmax output layer in series. A convolution layer is followed by a pool layer with three cycles. The input ECG signals are extracted by convolution network for low-level edge features and deep abstract features, and all features are sent to the final softmax output layer for classification judgment, and the probability values of each category of the samples are output. CNN-BILSTM model is shown in figure 2, the model is composed of CNN network and RNN network in parallel. The convolution network part is identical with the convolution part of model 1. The cycle part is slow in training because of the long length of single-beat ECG signal, therefore, the length of the input ECG signal is scaled and constructed by single-layer convolution and single-layer pooling structure. The eigenvectors of points are used to facilitate the training of circular networks. In view of the fact that bi-directional long-short term memory networks extract more information from each time node than unidirectional long-short term memory networks, so in the cycle part, BILSTM network is used to extract the time series feature of ECG signal, and the feature fusion layer is connected in the output layer of parallel network. The temporal and spatial features extracted from CNN and RNN networks are fused. Finally, the fused features are fed into the softmax output layer for classification judgment, and the probability values of each category of the samples are output. is easy to be compared horizontally. In order to verify the effectiveness and rationality of the proposed algorithm, the experimental data in this paper are also from MIT-BIH arrhythmia database [4], which consists of 48 annotated records, each of which takes about 30 minutes and consists of two lead signals. The sampling rate of the signal is 360HZ. Each record contains three files, atr, dat and hea. Atr is a tag file, which keeps the position and type of the heart beat labeled manually. Dat is a data file, which keeps the original data of the signal needed. Hea is a header file, which records the number, lead number, sampling rate, coding format and other information of the data. The algorithm proposed in this paper is validated by single lead data. Because the lead types used in 48 records are not identical, only 45 records contain complete lead II data, so this section of the experiment uses the 45 records of lead II heart beats to carry out experiments.

Introduction of ECG Standard Database and Data Preprocessing
In order to compare scientifically and effectively with other algorithms, the classifications of ECG classified in the experiment will be strictly in accordance with AAMI standards. ECG beats are divided into five categories: N (normal or bundle branch block), S (supraventricular abnormal beats), V (ventricular abnormal beats), F (fusion beats), Q (unclassified beats) and U (unidentified beats), The specific division is shown in Table 1 below: At the same time, AAMI standard also stipulates the evaluation criteria of arrhythmia detection algorithm, including the calculation method of algorithm accuracy (confusion matrix), and accuracy (Acc), sensitivity (Sen), true positive rate (Ppr) as a reference to measure classification performance. In medical diagnosis, it is expected that every disease can be accurately judged, so Sen in classification is a very important measurement index.
The original data of MIT-BIH has been processed by notch-filter and 0.1-100HZ band-pass filtering. Although there are some noise disturbances, because the deep neural network can extract the characteristics of the signal independently, in order to enhance the generalization ability of the model and enhance the robustness of the network, therefore, no filtering and denoising operations are performed on the original data. In the process of dealing with raw data, we need to use the WFDB toolkit provided by Physio Bank ATM to read every raw data ".dat" file and ".atr" annotation file. According to the position of R point labeled manually, the original ECG signal is effectively cut. The left side of R point is 100 and the right side is 150. The data of 250 points per beat is stored in the array. When the beat is cut, 250 points can basically contain all the main wave signals of an ECG beat. Next, according to the classification criteria stipulated by AAMI, all ECG rhythms are divided into five categories, among which ECG rhythm types which are not within the scope of the five categories are discarded. In order to accelerating the convergence speed of the network, preventing the disturbance of abnormal ECG data and avoiding unnecessary numerical problems, The original data after cutting need to be normalized by one step to reduce the influence of the change of signal distribution. Max-min normalization method is adopted which is commonly used. The formula is as follows: is the maximum amplitude of all signals and is the minimum amplitude of all signals. Finally, 45 ECG records and their corresponding tags are stored in an array file.

Training
The pretreated 103129 cardiac data were randomly disturbed and divided into training set and test set according to the ratio of 4 to1. The number of training set was 82500 and the test set was 20629 respectively. The input format of the network model data was 82500*250 matrix and the corresponding label was 1*82500 matrix.
For the two neural network models proposed in this paper, end-to-end supervised learning was adopted. In order to accelerate network attenuation, Adam Optimizer algorithm was used in both models, the batch-size is set to 128, and the learning rate was attenuated once every 10,000 steps, so that the model could converge to the optimal value. In the training process of CNN network, the model loss value converged to the minimum value when the training proceeded to 100000 steps, and the accuracy rate of training set (Acc) reached 99%. The cut heartbeat signal was entered into the BILSTM network in time sequence, and the hidden unit information output at each time point was saved. The time series characteristic matrix was formed by splicing the cut heartbeat signal into a matrix vector. At the fusion level, the space characteristic matrix of CNN network and the time series characteristic matrix of BILSTM were fused and spliced, and the loss value was calculated and weight parameters were updated by back propagation. When the model was trained to 50000 step, the loss value of the model tend to be stable and converged to the minimum value, and the Acc of the training set reaches 100%.
Because of the sample imbalance problem of MIT-BIH arrhythmia data classified according to AAMI standard, the test results of some small probability samples in the test set are poor, so data enhancement operation is carried out on the small probability samples. The small sample type heartbeat is randomly re-sampled using linear interpolation algorithm, and the frequency of this type heartbeat is expanded to between 60bpm and 120bpm. These ways not only increased the proportion of small probability samples in the overall training set, but also expanded heartbeat according to different frequencies. Finally, it increased the diversity of performance of single type in different people and prevented the problem of inaccurate recognition caused by the difference of individual heart rate in the prediction process, and enabled the model to learn more about the characteristics of heartbeat of small probability samples. The proposed network model was trained on the original data sample and the enhanced data sample respectively, and the test results of the CNN network model and the combined network model based on the fusion feature were compared under the two sample distributions.

Test
By saving the trained model network parameters and validating the model with test data, the confusion matrix under test data was outputted, and the accuracy (Acc), sensitivity (Se) and true positive rate (Pp), respectively were calculated. The predicted results of CNN network and combination network  [6]. The results are as Table 2: The test results show that the overall recognition accuracy of the combined network model based on fusion features reaches 98.92% before data enhancement, the sensitivity of S-type heartbeat is increased by 9.14% compared with CNN network, and the sensitivity of F-type is increased by 12.42%. After data enhancement, the overall recognition accuracy of the model is increased to 99.42%. Compared with the literature 5 algorithm which performs best in class S, the sensitivity of the model in class S is increased by 7.25%. Compared with the literature 6 algorithm which performs best in F class, the sensitivity of the model in F class is improved by 3.43%. It can be seen that the model is superior to all other algorithms in the overall recognition effect and the recognition effect of each class.

Result
In order to compare other algorithms horizontally, we refer to the recent literature [7] [8] [9] [10] on validating ECG classification on MIT-BIH datasets, including the research results based on traditional ECG feature classification and deep neural network classification, as shown in Table 3: From the table, it can be seen that the proposed ECG recognition algorithm based on fusion features reached to better recognition effects. Compared with other traditional algorithms, the proposed algorithm does not need complex feature engineering and has not undergone any complex pre-processing. It is simple to operate. Compared with the deep network, the model occupies less memory because of fewer layers, and the overall classification effect and the classification effect on each category are significantly improved compared with other algorithms in the literature.

Conclusion
By analysing and comparing the mature CNN network in the field of image recognition and the RNN network model which has advantages in time series information modeling, this paper proposes an ECG signal classification algorithm based on fusion features. Moreover, the recognition effect of MIT-BIH arrhythmia data set is validated. The comparative experiments show that the model improves the overall accuracy of classification and the classification effect of small probability class samples significantly, and the model is smaller. It has obvious advantages in memory proportion and real-time inference. This algorithm is suitable for off-line diagnosis on terminal equipment, because it is convenient and fast, and it has good recognition effect. It is of great significance in future telemedicine and real-time home monitoring.