Classification of Electrocardiogram of Congenital Heart Disease Patients by Neural Network Algorithms

The study intended to explore the eﬀect of diﬀerent neural network algorithms in the electrocardiogram (ECG) classiﬁcation of patients with congenital heart disease (CHD). Based on the single convolutional neural network (CNN) ECG algorithm and the recurrent neural network (RNN) ECG algorithm, a multimodal neural network (MNN) ECG algorithm was constructed utilizing the MIT-BIH database as training set and test set. Furthermore, the MNN ECG algorithm was optimized to establish an improved MNN (IMNN) algorithm, which was applied to the diagnosis of CHD patients. The CHD patients admitted between August 2016 and August 2019 were selected for analysis to compare the classiﬁcation eﬀect and accuracy rate of IMNN, MNN, CNN ECG, and RNN ECG algorithms. It was found that the RNN ECG algorithm had higher classiﬁcation sensitivity and true positive rate in terms of normal or bundle (NB) branch block beat, supraventricular abnormal (SA) rhythm, abnormal ventricular (AV) beat, and fusion beat (FB) than the CNN ECG algorithm ( P < 0 . 05), and the classiﬁcation sensitivity and true positive rate of IMNN algorithm in the four aspects were signiﬁcantly higher than those of MNN algorithm ( P < 0 . 05). The classiﬁcation accuracy of CNN ECG algorithm and RNN ECG algorithm was above 98%, while that of MNN algorithm and IMNN algorithm was better than that of CNN ECG algorithm and RNN ECG algorithm, and the accuracy rate can reach 98.5% or more. Moreover, the accuracy rate of the IMNN algorithm can reach more than 98%. In conclusion, IMNN not only has a good classiﬁcation ability in the simulated environment but also performs well in the actual environment, which is worthy of clinical promotion.


Introduction
e heart is a vital organ. Heart disease is the number one killer threatening human health in the world today, and CHD is the most common type of congenital malformations, accounting for about 28% of various congenital malformations [1,2]. e incidence of CHD cannot be underestimated, accounting for 0.4% to 1% of living infants. It means that there are 150,000 to 200,000 new patients with CHD every year in China. Arrhythmia is the most common manifestation of CHD [3]. Once an arrhythmia occurs, it interferes with the heart's ability to pump blood and may cause sudden loss of heart function or cardiac arrest. ECG signal is one of the most effective clinical medical bio-signals for predicting heart disease. It is easy to detect and can clearly reflect the regularity of heartbeat fluctuations, so as to achieve effective diagnosis and prediction of heart disease [4]. At present, there are two main methods of electrocardiogram classification, namely, the classification method based on waveform shape and the classification method based on waveform characteristics. e classification method based on waveform shape needs to extract feature waveform.
en, medical classification rules are used to judge it. However, the classification method based on waveform shape requires high ECG quality, poor anti-interference ability and high recognition accuracy of each waveform feature point, so it is not suitable for dynamic ECG processing. e classification method based on waveform characteristics is the most widely used ECG classification and recognition method at present, and it can be combined with the deep neural network to make the overall classification accuracy higher [5,6]. At present, the clinical recognition of ECG signals mostly adopts the method of manual analysis by clinicians, but the diagnosis process is time-consuming and laborious, and the accuracy of the diagnosis results will be different due to the doctor's professional level. Realizing accurate, convenient, and fast automatic ECG signal recognition technology is the goal set by domestic and foreign scholars [7]. With the advancement of deep learning models, people have paid more attention to the direct classification of ECG signals using CNN models in recent years [8]. Among many deep learning models, multimodal neural network can obtain more comprehensive features, improve model robustness, and ensure that the model can still work effectively in the absence of some modes. erefore, it is feasible to apply it in medicine. erefore, on the basis of neural network, a variety of neural networks were analyzed. Besides, a multimodal neural network was constructed to study its role in ECG classification and ECG analysis of CHD patients.

ECG Signal Classification of Single CNN.
To explore the ability of CNN to extract features and classify ECG signals in the ECG signal dataset, a CNN was first designed, the structure of which is shown in Figure 1. e convolution model had three one-dimensional convolutional layers, three one-dimensional pooling layers, a fully connected layer, and a softmax output layer.
In the convolutional network, the input is a one-dimensional feature vector of length L Y � [y 1 , y 2 , y 3, . . ., y L ], the convolutional layer of the first layer is composed of X convolution kernels, where the size of each convolution kernel is 1 × Z, and the coefficient of the convolution kernel is w i ∈ R S , i where ReLU represents the nonlinear activation function and b k is the offset corresponding to the convolution kernel. Generally speaking, the number of hidden neurons contained in each layer should be much larger than the dimension of the input feature vector. After the calculation of the convolutional layer, the image does not appear to be obviously smaller, and the feature particles of the image are still scattered. On this basis, a pooling layer is added after the convolutional layer. It can ensure that the data are reduced in dimensionality on the basis of data translation with no deformation. Deep CNN is often composed of multiple convolutional pooling layers, multiple fully connected layers, and a softmax output layer. Assuming that the network has N layers, N m is the fully connected layer, the N n th layer is the final output layer, and the number of output units is the final classification category K, then the whole calculation process is as follows: where o i is the output of the ith layer, x i and y i are relevant parameters that the network needs to learn, a Nn is the value before the last output layer is activated, and P(t | x) is the posterior probability that belongs to category T, which is judged by CNN after inputting X. Convolutional layer 1 of the single CNN contains 6 filters with a size of 1 × 10. Convolutional layer 2 contains 6 filters with a size of 1 × 10. Convolutional layer 3 contains 128 filters with a size of 1 × 10. Pooling layer 1 contains 6 filters of 1 × 2, pooling layer 2 contains 6 filters of 1 × 2, and pooling layer 3 contains 128 filters of the size of 1 × 2. ere are 1024 filters in the fully connected layer.

ECG Signal Classification of Single RNN.
RNN itself has certain advantages, especially the variant structure of RNN long short-term memory (LSTM) network. It is a special form of RNN which has three control units of the output gates, input gates, and forget gates. Bidirectional LSTM (BLSTM) further upgrades the LSTM network, so that the input at each moment comes from the information transmitted by the bank layer in the two directions. e network simultaneously combines the output of the front and back hidden layers and obtains the final output at each moment. erefore, BLSTM was adopted for modeling and analysis, and its structure is shown in Figure 2. When the two-dimension RNN performs forward calculations, it only shows the traditional one-way LSTM network. e forward calculation needs to be associated with the input data before the current time. e calculation equation for network forward is as follows: In the reverse calculation, the data to be input in the future are associated, and the network reverse calculation equation is as follows: (4) e LSTM networks in the front and back directions will not be connected to each other, and the respective network states are maintained and guaranteed. On this basis, the network status in different directions is calculated on the output layer, and the calculation equation for the entire network is as follows:

ECG Signal Classification of Multimodal Neural
Network. Because CNN and RNN have different advantages in the recognition and classification of ECG signals, a combined network structure was further designed on this basis. e last layer of the combined network was the feature fusion layer, and it spliced the spatial features obtained by CNN with the time sequence features obtained by BLSTM.
en, these features were sent to the final output layer for classification. e calculation of improved fusion feature network is as follows, where the input length in which h FFL is the hidden state information output by the CNN in the combined neural network, a L CNN is a set of effective ECG features extracted from the input ECG data by the network, and a BLSTM is formed by splicing x output from a set of RNBLSTM ECG signals at all time nodes. It can reflect the abnormal change of ECG signals to a greater extent in the time dimension. However, the feature fusion layer at this stage is only splicing in the direction of a onedimensional vector, and there will be certain redundant features between the morphological features extracted by CNN and the timing features extracted by RNN. Simply splicing into a fusion feature vector will cause redundancy in the number of features, slow down the network training speed, and affect the final classification effect of the network. erefore, certain improvements were made on this basis in the study.

ECG Signal Classification of Improved Multimodal Neural
Network. In this study, the attention mechanism (AM) neural network was combined with the multimodal neural network to make corresponding improvements, and the AM model is shown in Figure 3. e decoding process of the attention model is as follows.
p y i | y 1 , y 2 , y 3 , . . . , y i−1 , x � f y i−1 , s i , a i , where a i is the counted attention, whose function is to associate the output with the related input. e correlation degree between the current output and all inputs b ij is calculated as follows: where u j is the hidden layer information state of the encoder input at the jth position and weight b ij is defined as follows according to equation (8): where e ij is a prefeedback neural network. In the neural network, the attention module is usually an additional neural network that can give different weights to different parts of the input. Target data classification is more sensitive, which can effectively improve system performance in natural ways. Scientific Programming used in the experiment were randomly selected. e database consisted of 48 marked records and was divided into two groups. e first set of data contained 23 ECG records randomly selected from the ECG data, and the other group of data contained 25 ECG records that appeared rarely in practice but were clinically important. Each record took about 30 minutes, which was composed of two-way lead signals, and the signal sampling rate was 360 Hz. e algorithm in this study was based on single-lead data, so only 45 recorded II-lead heartbeats were selected for the experiment. To make the classification results more standard, the ECG beats were classified as follows: normal or bundle branch block beat (NB), supraventricular abnormal rhythm (SA), abnormal ventricular beat (AV), fusion beat (FB), and uncategorized beats (UC).

Research Subjects.
A total of 127 patients with CHD were selected to receive examinations in the hospital from August 2016 to August in 2019. ey were diagnosed as CHD after ultrasound examination. e ultrasound examination is shown in Figure 4. Figures 4(a) and 4(b) show color Doppler ultrasound images of patients diagnosed as CHD, respectively. On this basis, the same experienced professional doctor collected the single-lead ECG signals of all patients, preprocessed all the collected ECGs after the collection, and input all the data into the neural network for classification after preprocessing. All patients signed informed consent forms, and this study obtained permission from the ethics committee of the hospital.

Statistical
Analysis. SPSS 22.0 was adopted for statistical analysis, and percentages were adopted to express the counting results. e t test was adopted to compare the two groups, and P < 0.05 meant obvious difference.

Classification Comparison between Single CNN and Single RNN.
e comparison of classification based on single CNN ECG algorithm and classification based on RNN ECG algorithm is shown in Figure 5. In contrast with the single CNN, RNN had higher classification sensitivity and true positive rate in terms of NB, SA, AV, FB, and UC (P < 0.05). In terms of classification accuracy, the classification accuracy of both was good (P > 0.05).

Comparison of Training Results.
e experiments were all carried out with GTX1060 graphics card. e multimodal neural network ECG algorithm and the improved multimodal neural network ECG algorithm both used 82,600 ECG data for training and used the remaining 21,000 ECG data to test the corresponding model. e relationship between the loss value and the number of iterations of the multimodal neural network ECG algorithm is shown in Figure 6, and that of the improved multimodal neural network ECG algorithm is shown in Figure 7. e results show that the loss value of the improved multimode neural network ECG algorithm was obviously smaller.

Comparison of Classification Results.
e classification of the multimodal neural network ECG algorithm and the improved one is shown in Figure 8. In contrast with the multimodal neural network, the improved one had higher classification sensitivity and true positive rate in terms of NB, SA, AV, FB, and UC (P < 0.05). e accuracy of single CNN ECG algorithm, RNN ECG algorithm, multimodal neural network ECG algorithm, and improved multimodal neural network ECG algorithm was further compared, and the results are shown in Figure 9. e results showed that the classification results of the multimodal neural network ECG algorithm and the improved one were obviously better than the classification results of the single CNN ECG algorithm and the RNN ECG algorithm, and the single CNN ECG algorithm had the worst classification effect.

Actual Classification Results of CHD Patients.
e actual clinical data were applied to classify CHD mixed with ECG, and the classification was carried out using the multimodal neural network ECG algorithm and the improved one ( Figure 10). e results obtained in practice were similar to simulations. e classification accuracy of the improved multimodal neural network ECG algorithm was obviously higher than that of the multimodal neural network ECG algorithm, and the accuracy rate was higher than 98%.

Discussion
In the automatic analysis of ECG signals at this stage, the characteristic detection of heartbeat beats is crucial because it influences a lot for obtaining heart activity [9]. Performing a t,2 a t,3 a t,T a t,1 Scientific Programming feature wave positioning on the preprocessed ECG signal and obtaining the corresponding feature wave parameters are the prerequisites for the automatic identification and classification of ECG signals [10]. e research of Patro et al. mentioned that CNN was used in many medical image recognitions, and the overall resolution was better [11]. It was similar to the results of ECG data classification based on the network in the study. However, the CNN does not have the ability to directly simulate the dynamic characteristics of time series data. Moreover, convolution operation in the time dimension cannot make full use of the forward and backward correlation of ECG signals in the time dimension. As a result, it is difficult for it to find effective temporal characteristics. erefore, for the one-dimensional ECG signal that needs to be processed, modeling the sequence changes in time is needed [12][13][14]. Sharma et al. counted and sorted algorithms used in medical images. e results showed that LSTM based on RNN can solve the problems of overfitting, gradient dispersion, difficulty in training, and other issues in the training of neural network model [15]. It was consistent with the results in the study that classification of the BLSTM neural network obtained was better than that of the CNN. e advantages of CNN and RNN were further combined for different processing objects to propose a multimodal neural network structure. e proposed one used CNN to extract features of ECG signals and was combined with RNN that was good at processing time series. e combined automatic identification and classification method was able to better solve the problem of poor generalization ability of the automatic classification algorithm. ese problems are due to individual differences such as heartbeat intensity and heart rate in the same disease. Besides, the combined method can obviously improve the identification and classification of ECG signals. Canobbio et al. also mentioned in the research that the multimodal neural network can distinguish ECG characteristics well [16].

Conclusion
Based on the study of the single CNN ECG algorithm and the RNN ECG algorithm, the multimodal neural network ECG algorithm was constructed and corresponding improvements were made to the algorithm on this basis. en, it was applied in the simulated environment and CHD patients, respectively. e results suggested that the multimodal neural network ECG algorithm itself has certain advantages, and the classification accuracy rate is high. On this basis, the improved multimodal neural network ECG algorithm has further improved the classification accuracy and can be applied to actual cases. In this study, a new research method of ECG of patients with CHD is proposed, and the corresponding optimization is carried out in combination with the deep neural network, which is worthy of clinical promotion. However, the research is only limited to single-lead ECG, and whether it performs well in multilead ECG images needs to be further explored. At the same time, there are fewer samples in this experimental study and there is no subdivision of patients with different types of CHD, which requires further in-depth study.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.