# Research on the Classification of ECG and PCG Signals Based on BiLSTM-GoogLeNet-DS
## 4 Classification of ECG and PCG Signals Based on BiLSTM-GoogLeNet-DS  
The ECG and PCG signal classification method based on BiLSTM-GoogLeNet-DS is proposed. Different fusion methods, combined with the network structure characteristics of the BiLSTM network and GoogLeNet network, are used to classify the ECG and PCG signals, which make up for the inaccuracy of disease judgment by using the cardiac function signal. Using the ECG and PCG signal classification, a better classification and diagnosis effect was obtained. The implementation steps of this algorithm are as follows:  
Step 1: Obtain the ECG and PCG signals. This paper uses the PCG and ECG signals synchronously collected in the PhysioNet/CINC challenge 2016 heart sound database as the research object. Because the signal acquisition time in the database is different, the length of the signal was unified in the experiment, and 10,000 sampling points of each signal were intercepted for the experiment. The sampling frequency of the signal is 2000 Hz. The database includes 113 normal signals and 292 abnormal signals (405 signals in total). Figure 7 shows the synchronously collected PCG and ECG signals. Figure 6: GoogLeNet structure. Figure 7: PCG and ECG signals. Step 2: Preprocess the ECG and PCG signals. The main purpose is to filter the signals. The useful information of the ECG signal is concentrated below 20 Hz. If the ECG signal has strong power frequency interference, the signal will generally produce a peak at the power frequency of 50 or 60 Hz in the spectrum. The effective frequency of the PCG signal is concentrated below 300 Hz. In this paper, the ECG signal was mainly subjected to low-pass filtering with the cutoff frequency of 20 Hz; a high-pass filter with the cutoff frequency of 25 Hz and a low-pass filter with the cutoff frequency of 400 Hz were performed on the PCG signal. Since there is too much noise in the ECG signal, the denoising results of the ECG signal are given here. Figure 8 shows the comparison of the ECG signal before and after filtering. Step 3: Use the BiLSTM network for training to create the network model. The filtered signals are trained and classified with a total of 405 samples. Moreover, 70% samples are used for training and 30% samples are used for the test. Then the samples are readjusted according to the labels. The abnormal samples and normal samples are placed separately in a centralized manner and then reintegrated into a new dataset. This setting is convenient for network training and results comparison during the test. The integrated ECG and PCG data are spliced and fused as the input of the BiLSTM network. The optimal network model is obtained through training. Then the classification results are obtained. The BiLSTM network architecture is shown in Figure 9.  
Figure 8: Comparison before and after filtering: (**a**) ECG original signal; (**b**) ECG signal after filtering. Figure 9: BiLSTM network structure. Step 4: Convert the filtered one-dimensional ECG and PCG signals into a two-dimensional image. The filtered signal is subjected to the continuous wavelet transform to obtain the wavelet coefficients. Then the scale sequence is converted into the frequency sequence. Finally, the wavelet time- frequency diagram of each signal is obtained by combining the time series. The size of the time-frequency diagram is adjusted to 224 \(\times\) 224, as shown in Figure 10.  
Step 5: Determine the GoogLeNet network structure and improve its structure. The two-dimensional properties of the time-frequency diagram of each signal obtained above are converted into a three-dimensional form 224 \(\times\) 224 \(\times\) 3, which is suitable for the input of the GoogLeNet network. Then 70% of the signals are used for training and 30% of the signals are used for the test. Then determine the GoogLeNet network structure, as shown in Figure 11. The original GoogLeNet network uses different inception modules to generate a total of 144 layers of the network structure.