Heartbeat signal classification method based on CNN-GRU network model

By combining wavelet transform and heartbeat segmentation with a CNN-GRU network model, the problems of time-consuming and inaccurate feature extraction in ECG signal classification are solved, achieving efficient and accurate ECG signal classification.

CN115221926BActive Publication Date: 2026-02-17JILIN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210855584.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-20
Publication Date
2026-02-17
Estimated Expiration
2042-07-20

AI Technical Summary

Technical Problem

Existing ECG signal classification methods suffer from time-consuming and labor-intensive feature extraction and insufficient classification performance, especially with low accuracy under noise interference.

Method used

After wavelet transform denoising and heartbeat segmentation, the ECG signal is classified using a CNN-GRU network model. The stability and classification accuracy of the model are improved by combining DROPOUT and L2 regularization techniques.

Benefits of technology

It achieves rapid and accurate ECG signal classification, improves classification accuracy, saves time and manpower, and reduces the impact of noise interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221926B_ABST
    Figure CN115221926B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on CNN-GRU network model heartbeat signal classification method, it is related to computer field and medical signal processing field, the purpose of the present application is to solve the problems such as low classification accuracy of ECG signal interference many,The present application includes the following steps: the ECG data is removed by wavelet transform noise, then it is segmented into the form of heartbeat, after the heartbeat after pre-processing is randomly divided into training set, verification set and test set;CNN network model and GRU network model based on the deep learning network model of model is constructed, then the highest accuracy of the model in the trained model is selected to predict data, and the prediction classification result of ECG data is obtained.The method for classifying heartbeat signal based on CNN-GRU network model proposed in the application can realize efficient and accurate classification and identification of ECG signal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention combines knowledge of medical image processing and signal processing, and uses a deep learning network model to classify and process electrocardiogram signals. Background Technology

[0002] Heart diseases are increasingly becoming a threat to human health. Clinically, diagnosis was previously typically made by qualified physicians through electrocardiograms (ECGs). However, due to the inherent weakness of ECG signals, noise interference is often introduced during the acquisition process, affecting the diagnostic accuracy of ECG signals.

[0003] In machine learning-based ECG signal classification methods, XZ Zhang et al. used SMOTE to oversample ECG signals, then used the Minimum Redundancy Maximum Correlation (MRMR) algorithm to select effective features, and subsequently used KNN, SVM and other networks to classify the signals (Zhang XZ, Michael AJ, Zhao JL, et al. "ECG Classification using Machine Learning Techniques and Smote Oversampling Technique," IPMV 2020: 2020 2nd International Conference on Image Processing and Machine Vision. 10-13 (2020)). Liu Teng et al. obtained the ECG signal features after noise removal through discrete wavelet analysis and used a softmax regression model for classification (see Liu Teng, Tang Hong, Zhang Shibing. Research on arrhythmia signal classification algorithm based on machine learning. Computer Applications Research, 37(03): 940-943 (2020)). X Ye et al. first used a DNN network to obtain the probabilistic features of electrocardiogram signals, and then used XGBoost for classification (see Ye X, Huang Y, Lu Q, "Explainable Prediction of Cardiac Arrhythmia Using Machine Learning," 2021 14th International Congress on Image and Signal Processing, BioMedical Engineering and Informatics (CISP-BMEI). IEEE, 1-5 (2021)).

[0004] In deep learning-based ECG signal classification methods, He et al. used continuous wavelet transform (CWT) to convert the original ECG signal into a spectrogram, and then extracted features and classified them using a CNN network (see Runnan H, Kuanquan W, Na Z, et al. Automatic Detection of Atrial Fibrillation Based on Continuous Wavelet Transform and 2D Convolutional Neural Networks, "Frontiers in Physiology, 9:1206 (2018)"). Wu et al. used ECG signals from the MIT-BIH database as their experimental dataset. They first segmented the signals into heartbeats, then used the SMOTE algorithm to expand the dataset and balanced the proportions of different categories. Finally, a CNN network was used to classify the ECG signals into five different categories (see Wu Ran, Tang Qingyao, Jiang Xiaoming, et al. Research on Multi-Kernel Scale Convolutional Neural Network Classification Algorithm for ECG Components. Journal of Chongqing University of Posts and Telecommunications (Natural Science Edition), 34(02):243-249 (2022)). Liu Xinwen et al. effectively improved the low classification accuracy of noisy ECG signals by cleaning the data and training the CNN network with a boot-hard loss function (see Liu Xinwen, Wang Huan, Li Zongjin, "An Approach for Deep Learning in ECG Classification Tasks in the Presence of Noisy Labels," 2021 43rd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC). IEEE, (2021)).

[0005] So far, scholars at home and abroad have proposed many methods for classifying electrocardiogram signals, but there are still some obvious shortcomings: (1) Machine learning methods need to be divided into two steps: feature extraction and classifier design. Feature extraction requires experts in related fields, which is time-consuming and labor-intensive; (2) The classification performance of network models is still insufficient. Summary of the Invention

[0006] To address the issues of high interference and low classification accuracy in electrocardiogram (ECG) signals, this invention performs wavelet transform denoising and heartbeat segmentation on the ECG signals to obtain noise-removed heartbeat data. This data is then classified using a deep learning CNN-GRU network model, thereby improving classification accuracy.

[0007] The specific steps of the technical solution adopted in this invention are as follows:

[0008] Step 1: Select twelve leads of ECG signals to construct an ECG signal dataset;

[0009] Step 2: Remove noise that interferes with the effective information of the signal using wavelet transform;

[0010] Step 3: Locate the R peak and use the obtained R peak position information to perform heartbeat segmentation processing to obtain an equal-length heartbeat form of electrocardiogram signal;

[0011] Step 4: Construct a CNN-GRU network model and feed the equal-length heartbeat signals obtained in Step 3 into the deep learning network model for training.

[0012] Step 5: Input the test set data into the already trained network, and output its corresponding signal category.

[0013] The implementation process of step two is as follows:

[0014] (a) Read the raw electrocardiogram data from the dataset;

[0015] (b) Noise suppression is achieved by utilizing the characteristics of wavelet multi-scale decomposition; the formula for the wavelet transform during decomposition is:

[0016]

[0017] Among them, W t (a,b) represents the obtained wavelet function, X(t) represents the original electrocardiogram data, Ψ() represents the basic wavelet function, and a and b represent the transformation factors, respectively.

[0018] After wavelet transform, the ECG signal is converted into a mixture of multiple small waveform functions, thus obtaining the coefficients of the corresponding functions. Then, a threshold is set to remove the coefficients corresponding to noise. A commonly used threshold is used, and the formula is:

[0019]

[0020] Where M and N represent the size of the input data, and σ is calculated using the following formula:

[0021]

[0022] Here, X corresponds to the wavelet coefficients in the high-frequency part, and Median represents the median function used.

[0023] Then, the soft thresholding method is used for processing, and the formula is:

[0024]

[0025] Here, W is the wavelet function obtained from formula (1), W δ It is the soft threshold function obtained corresponding to the threshold δ.

[0026] (c) The inverse wavelet transform method was used to reconstruct the signal and obtain the noise-removed electrocardiogram signal.

[0027] The formula is as follows:

[0028]

[0029] in, X1(t) is the signal after noise removal, Ψ() represents the basic wavelet function, ω is the frequency, and a and b represent the transform factors, respectively.

[0030] The specific implementation process of heartbeat segmentation processing on the signal obtained in step two in step three is as follows:

[0031] (a) To segment the ECG signal into a heartbeat pattern, the location of the R peak must first be found. First, the data is scanned using windows of different lengths T. An adaptive thresholding method is used to obtain the threshold corresponding to different window positions. The region of interest is located between the two intersection points of the threshold and the ECG signal. By default, the location corresponding to the maximum value in the region of interest is the location of the R peak. All R peak location values ​​are read and the labeled data is observed. The T value with the most correct R peaks is selected.

[0032] (b) To further filter the location of R-peaks, a thresholding process was implemented. First, the two markers located at the beginning and end of the ECG signal were removed, as these markers may not contain complete heartbeat data. Then, the values ​​that could separate R-peaks from non-R-peaks were set as thresholds to further filter R-peaks.

[0033] (c) Select N points on the left and M points on the right of the R peak to form a heartbeat. In order to ensure that a complete heartbeat is obtained, the position of the marker points can be further set. The position value of the initial marker point should be greater than N, and the position value of the last marker point should be less than the position value obtained by subtracting M from the total position value of the ECG signal. In this way, heartbeat data of equal length can be obtained and used as the input of the subsequent network.

[0034] Step 4: Construct a CNN-GRU network model and feed the obtained isometric heartbeat data into the deep learning network model for training.

[0035] In step four, to further improve the stability and running speed of the CNN-GRU network model, DROPOUT and L2 regularization techniques were adopted. DROPOUT involves removing neurons from the network model according to a certain proportion, while L2 regularization restricts some parameters of the loss function to prevent overfitting.

[0036] The 0th layer of the CNN-GRU network model is used for the input signal, which has a size of (M+N)×12, where (M+N) represents the length of the data and 12 represents the voltage signal of twelve leads.

[0037] The first part of the CNN-GRU network structure consists of two convolutional layers (Conv1D), a max pooling layer (MaxPooling1D), a convolutional layer (Conv1D), an average pooling layer (AvegPooling1D), and a dropout layer.

[0038] The parameters for the first convolutional layer, Conv1D, are as follows:

[0039] The number of filters is 4.

[0040] kernel size = 4

[0041] strides = 1

[0042] The activation function is the ReLU function.

[0043] To prevent overfitting during training, L2 regularization was added, with the corresponding parameter set to 0.01.

[0044] The output feature map size is calculated using padding="valid";

[0045] After the input data is processed by the first convolutional layer, the first-level features of the input data are obtained, and the size of the resulting feature response map is 397×4.

[0046] The parameters for the second convolutional layer, Conv1D, are as follows:

[0047] The number of filters is 16.

[0048] kernel size = 8

[0049] strides = 1

[0050] The activation function is the ReLU function.

[0051] Similarly, this layer also incorporates L2 regularization with a parameter set to 0.01.

[0052] The output feature map size is calculated using padding="valid";

[0053] After the output of the previous layer passes through this convolutional layer, the output size is 390×16;

[0054] Next, we will set the parameters for the max pooling layer MaxPooling1D as follows:

[0055] Pooling size pool_size = 2,

[0056] strides = 2

[0057] Fill with padding="valid",

[0058] Its output characteristic response map size is 195×16;

[0059] The parameters for the third convolutional layer are:

[0060] The number of filters is 32.

[0061] kernel size kernel_size = 16,

[0062] strides = 1

[0063] The activation function is the ReLU function.

[0064] L2 regularization was also added to this convolutional layer, with its corresponding parameter set to 0.01.

[0065] The output feature map size is calculated using padding="valid";

[0066] After the third convolutional layer, the output size is 180×32;

[0067] Next is the average pooling layer, with the following parameters:

[0068] Pooling size pool_size = 2,

[0069] strides = 2

[0070] Fill with padding="valid",

[0071] Its output characteristic response map size is 90×32;

[0072] The Dropot layer has a dropout rate of 60% and an output feature response map size of 90×32.

[0073] The second part of the CNN-GRU network model consists of the GRU layer. The parameters of the GRU layer are set as follows: the number of neurons is set to 300, and the size of the feature response map after passing through the GRU layer is 90×300.

[0074] The third part of the CNN-GRU network model is the Flatten layer, which transforms the multidimensional input into a one-dimensional one, and the output feature response map has a size of 27000×1.

[0075] The fourth part of the CNN-GRU network consists of the first fully connected layer Dense, the Dropout layer, and the second fully connected layer Dense. The size of the first fully connected layer Dense in the fourth part is 27000×1. Here, the ReLU function is used as the activation function, and the output size is 128×1.

[0076] Then connect the Dropout layer. Dropout is a regularization technique that randomly discards some neurons. The proportion of neurons discarded is set to 50%, and the number of outputs is 128×1.

[0077] The output of the Dropout layer is fed into the second fully connected layer, Dense. The output space has a dimension of 2, the activation function is softmax, and the number of outputs is 2×1, corresponding to the probabilities of normal and abnormal signals.

[0078] The beneficial effects of this invention are:

[0079] Introducing artificial intelligence methods into the diagnosis of electrocardiogram (ECG) signals is beneficial for both saving medical costs and promoting the development of smart healthcare. This invention utilizes deep learning for ECG signal classification. Wavelet transform is applied to remove noise from the ECG signal, as it is simpler and faster. Then, heartbeat segmentation is performed to more accurately extract effective features, thereby reducing the influence of interfering features. Finally, a CNN-GRU network is constructed for classification. The CNN-GRU network can extract signal features not only from the spatial domain but also from the temporal domain, thus achieving higher classification accuracy. This method saves both time and manpower, enabling rapid and accurate classification and identification of various ECG signal categories. Attached Figure Description

[0080] Figure 1 This is a flowchart of the present invention;

[0081] Figure 2This is a flowchart of removing interference from electrocardiogram signals using wavelet transform.

[0082] Figure 3 These are comparison images of wavelet transform denoising.

[0083] Figure 4 This is a comparison chart showing the results of segmenting and processing electrocardiogram signals in a dataset to obtain heartbeat data.

[0084] Figure 5 This is a schematic diagram of the overall structure of the CNN-GRU network model used in this invention when using the publicly available dataset from the China Electrocardiogram Competition;

[0085] Figure 6 This is the loss change curve obtained by training the CNN-GRU model using the publicly available dataset from the China Electrocardiogram Competition.

[0086] Figure 7 This is a classification result diagram showing the confusion matrix obtained by this invention when using the publicly available dataset of the China Electrocardiogram Competition;

[0087] Figure 8 This is the ROC curve obtained by using the publicly available dataset from the China Electrocardiogram Competition in this invention; Detailed Implementation

[0088] like Figure 1 As shown, this invention provides a heartbeat signal classification method based on a CNN-GRU network model. To more accurately illustrate the technical solution of this invention, a specific embodiment is provided below to further explain and describe the invention.

[0089] The specific steps of the embodiment are as follows:

[0090] Step 1: Select the publicly available dataset from the China Electrocardiogram Competition as the dataset for this invention. Each record contains voltage signals from twelve leads.

[0091] Step 2: Wavelet transform was used to remove noise from the data. The process is as follows: Figure 2 ;

[0092] The specific process of step two is as follows:

[0093] (a) Read electrocardiogram (ECG) data from the publicly available dataset of the China ECG Competition;

[0094] (b) Noise suppression is performed using the characteristics of wavelet decomposition at 9 scales; the formula for the wavelet transform during decomposition is:

[0095]

[0096] Among them, W t(a,b) represents the obtained wavelet function, X(t) represents the original electrocardiogram data, Ψ() represents the basic wavelet function, and a and b represent the transformation factors, respectively.

[0097] After wavelet transform processing, the corresponding small waveform function of the signal is obtained, along with its coefficients. Then, a threshold is set to remove the noise component. A commonly used threshold is used, and the formula is:

[0098]

[0099] Where M and N represent the dimensions of the input data, and σ is calculated using the following formula:

[0100]

[0101] Here, X represents the wavelet coefficients in the high-frequency part, and Median represents the median function used.

[0102] Then, the soft thresholding method is used for processing, and its formula is:

[0103]

[0104] Here, W is the wavelet function obtained from formula (1), W δ It is the soft threshold function obtained corresponding to the threshold δ.

[0105] (c) The inverse wavelet transform is used to reconstruct the signal, and its formula is as follows:

[0106]

[0107] in, X1(t) represents the denoised signal, Ψ() represents some basic wavelet functions, ω represents the frequency, and a and b represent the transform factors, respectively.

[0108] This yields the electrocardiogram signal after noise removal.

[0109] Step 3: Locate the R peak of the ECG signal, and perform heartbeat segmentation on the ECG signal sequenced at the sampling points before and after the R peak to obtain an ECG signal in the form of equal-length heartbeats;

[0110] The specific process of step three is as follows:

[0111] (a) The `heartpy` library from the open-source Python library was used. When performing heartbeat segmentation on the ECG signal, the location of the R-peak is first needed. An adaptive thresholding method was used here. First, a 0.75s window was used to calculate the threshold at different window positions of the signal. The region of interest (ROI) lies between the two intersection points of the threshold and the ECG signal; the maximum value in the ROI is the value corresponding to the R-peak. The `process` function from the `heartpy` library was used to process the ECG signal, returning two dictionary-like values: one storing temporary values ​​and the other storing the calculated values. All labeled R-peak position values ​​were read.

[0112] (b) To further filter the locations of R-peaks, a threshold process was implemented. First, the two markers located at the beginning and end of the ECG signal were removed, as these markers may not contain complete heartbeat data. Then, after observing the data, values ​​that could distinguish between R-peaks and non-R-peaks were set as thresholds for filtering. Markers with peak values ​​less than the threshold were considered non-R-peaks by default, thus allowing all R-peaks to be obtained.

[0113] (c) Select 149 points on the left and 200 points on the right of the R peak as a heartbeat. In order to ensure that a complete heartbeat is obtained, the position of the marker points is further restricted. The position value of the initial marker point should not be less than 149, and the position value of the last marker point should be less than the position value obtained by subtracting 200 from the total position value of the ECG signal. In this way, multiple heartbeat data of equal length can be obtained and used as the input of the subsequent network.

[0114] After heartbeat segmentation, all the obtained heartbeat signals are randomly allocated according to a ratio of 4:1:1, and then used for training the network, validating the network, and predicting the network.

[0115] Step 4: Construct as follows Figure 3 The CNN-GRU network model shown takes the obtained isometric heartbeat data and feeds it into the deep learning network model for training.

[0116] The CNN-GRU network structure includes an input layer, a Conv1D convolutional layer, a Pooling1D pooling layer, a Dense fully connected layer, a Dropout layer, a Flatten layer, a GRU layer, and an output layer. The specific process of step four is as follows:

[0117] (a) The 0th layer of the CNN-GRU network model is the input layer, and the input signal size is 400×12, where 400 represents the length of the data and 12 represents the voltage signal of twelve leads;

[0118] (b) After the input layer, the first part of the CNN-GRU network model is formed. The first part of the CNN-GRU network model consists of a convolutional layer (Conv1D), a max pooling layer (MaxPooling1D), an average pooling layer (AvegPooling1D), and a dropout layer. The parameters of the first convolutional layer (Conv1D) are set as follows:

[0119] The number of filters is 4.

[0120] kernel size = 4

[0121] strides = 1

[0122] The activation function is the ReLU function.

[0123] To prevent overfitting during training, L2 regularization was added, with the corresponding parameter set to 0.01.

[0124] The output feature map size is calculated using padding="valid";

[0125] After the input data is processed by the first convolutional layer, the first-level features of the input data are obtained, and the size of the resulting feature response map is 397×4.

[0126] The parameters for the second convolutional layer, Conv1D, are as follows:

[0127] The number of filters is 16.

[0128] kernel size = 8

[0129] strides = 1

[0130] The activation function is the ReLU function.

[0131] Similarly, add an L2 regularization operation with a parameter set to 0.01 to this layer.

[0132] The output feature map size is calculated using padding="valid";

[0133] After the output of the previous layer passes through this convolutional layer, the output size is 390×16;

[0134] Next, we will set the parameters for the max pooling layer MaxPooling1D as follows:

[0135] Pooling size pool_size = 2,

[0136] strides = 2

[0137] Fill with padding="valid",

[0138] Its output characteristic response map size is 195×16;

[0139] The parameters for the third convolutional layer are:

[0140] The number of filters is 32.

[0141] kernel size kernel_size = 16,

[0142] strides = 1

[0143] The activation function is the ReLU function.

[0144] L2 regularization was also added to this convolutional layer, with its corresponding parameter set to 0.01.

[0145] The output feature map size is calculated using padding="valid";

[0146] After the third convolutional layer, the output size is 180×32;

[0147] Next is the average pooling layer, with the following parameters:

[0148] Pooling size pool_size = 2,

[0149] strides = 2

[0150] Fill with padding="valid",

[0151] Its output characteristic response map size is 90×32;

[0152] Next is a Droppot layer, where the proportion of dropped neurons is set to 60%, and the output feature response map size is 90×32;

[0153] (c) The second part of the CNN-GRU network model consists of GRU layers, and the parameters of the GRU layers are set as follows:

[0154] The number of neurons is 300.

[0155] After passing through the GRU layer, the feature response map size is 90×300;

[0156] (d) The third part of the CNN-GRU network model is the Flatten layer, which transforms the multidimensional input into a one-dimensional one, and the output feature response map has a size of 27000×1.

[0157] (e) The fourth part of the CNN-GRU network consists of two fully connected layers, Dense and Dropout layers. The last fully connected layer, Dense (output layer), outputs a 2×1 feature vector (corresponding to the probabilities of normal and abnormal signals). The size of the first fully connected layer, Dense, in the fourth part is 27000×1. Here, the ReLU function is used as the activation function, and the output size is 128×1.

[0158] Then connect the Dropout layer. Dropout is a regularization technique that randomly discards some neurons. The proportion of neurons discarded is set to 50%, and the number of outputs is 128×1.

[0159] The output of the Dropout layer is fed into the second fully connected layer, Dense, which has an output space dimension of 2, an activation function of softmax, and 2×1 outputs.

[0160] (f) After randomly arranging the heartbeat data, 1000 data points were selected as the test set, and then 4548 data points were extracted as the training set and 1000 data points were extracted as the validation set.

[0161] This invention selects the Adam optimizer to update the parameters in the model and uses the categorical cross-entropy loss function to measure the difference between the output value and the true value. This loss function outputs the one-hot form of the electrocardiogram signal corresponding to each category, and its formula is as follows:

[0162]

[0163] Where y is the actual value, It is the predicted probability value.

[0164] A total of 50 training rounds were conducted, and the resulting loss curve is as follows: Figure 4 As shown, the more training iterations there are, the more stable the loss curve becomes.

[0165] Step 5: Select the network model with the highest training accuracy to perform classification and prediction processing on the ECG signal. Input the ECG signal to be tested into the trained network model and output its corresponding classification category.

[0166] After training, heart rate data from 1000 test sets are fed into the network model, and the network model finally outputs the classification prediction results of the 1000 test set data.

[0167] Step 6: Compare the obtained classification results with the actual classification categories of the tested ECG signals to obtain the training accuracy of this network model.

[0168] This invention first uses a confusion matrix method to display the network classification prediction results, such as... Figure 5 As shown, the values ​​on the diagonal of the confusion matrix that belong to the correct classification are relatively large, which means that this CNN-GRU network model has a very good classification effect on ECG signals in the publicly available dataset of the Chinese ECG Competition.

[0169] Next, more precise evaluation metrics were used to evaluate the network model. Precision, recall, and F1 score were selected for evaluation, with the following formulas:

[0170]

[0171]

[0172]

[0173] Here, TP represents real normal data and predicts the total number of normal data, FP represents real abnormal data but predicts the total number of normal data, and FN represents real normal data but predicts the total number of abnormal data.

[0174] Precision represents the number of actual normal heartbeats among the samples predicting normal heartbeats. Therefore, precision can be used to determine whether the network model can accurately predict the data. Recall represents the number of predicted normal heartbeats among all actual normal heartbeats. Therefore, recall can be used to determine whether the network model can predict all data. The F1 score is a comprehensive assessment of both precision and recall. The final results are as follows: Figure 6 As shown, this network model achieves a precision of 96% and a recall of 94% for classifying and predicting ECG signals, resulting in an F1 score of 0.95. Based on these data, it can be concluded that this CNN-GRU network model can achieve high-precision and comprehensive classification and prediction of ECG signals.

[0175] Subsequently, because the distribution of normal and abnormal data in the dataset is not balanced, and the receptivity curve (ROC curve) is not affected by the distribution changes of different categories of data in the dataset, the ROC curve was introduced. The mathematical meaning of the ROC curve is a curve on a two-dimensional coordinate system. The horizontal axis represents the false positive rate (FRP), which is the ratio of abnormal heartbeats predicted as normal heartbeats; the vertical axis represents the true positive rate (TPR), which is the ratio of normal heartbeats predicted as normal heartbeats. The formulas for calculating both are as follows:

[0176]

[0177]

[0178] Here, TN represents the actual outlier data and predicts the total number of outliers.

[0179] This curve typically lies above the line connecting points (0, 0) and (1, 1), where (0, 0) indicates the network model classifies all samples in the dataset as anomalous, and (1, 1) indicates the network model classifies all data in the dataset as normal. To more accurately assess the network model, the AUC value is introduced. From a physical perspective, the AUC value is the probability that, for any randomly selected sample, the probability of truly normal data being predicted as normal data is greater than the probability of truly anomalous data being predicted as normal data. The formula is:

[0180] AUC = P(P) 正 >P 负 (12)

[0181] Among them, P 正 P represents the probability that real, normal data is predicted as normal data. 负 Data representing true anomalies can be predicted as normal data.

[0182] Therefore, from a mathematical perspective, the AUC value corresponds to the area covered by the ROC curve, which is generally between 0.5 and 1. An AUC of 0.5 indicates that the network model has no classification ability, while an AUC greater than 0.5 means that the probability of predicting true normal data as normal data is greater than the probability of predicting true abnormal data as abnormal data. In this case, the network model can achieve classification, and the larger the value, the better the performance.

[0183] The ROC curve shows that the AUC value of this network model is 0.94. The table below shows the final index results obtained when using the public dataset of the China Electrocardiogram Competition.

[0184] Table 1

[0185]

[0186] This indicates that the network model has a higher probability of predicting real normal data as normal data than it has a higher probability of predicting real abnormal data as normal data, and its classification performance is excellent.

Claims

1. A method for classifying a heart beat signal based on a CNN-GRU network model, characterized in that, The steps of the method are as follows: Step one, select twelve-lead electrocardio signal to construct electrocardio signal data set; Step two, remove the noise disturbing the effective information of the signal by wavelet transform; Step three, locate the R peak, and use the obtained R peak position information to perform heart beat segmentation processing, so as to obtain the equal length heart beat form electrocardio signal; Step four, construct a CNN-GRU network model, and input the equal length electrocardio signal segmented in step three into the deep learning network model for training; Step five, input the test set data into the network which has been trained, and output the corresponding signal category; The input signal size of the CNN-GRU network model in step four is , represents the length of the data, and 12 represents the voltage signals of twelve leads. The first part of the network model is composed of two convolution layers Conv1D, a maximum pooling layer MaxPooling1D, a convolution layer Conv1D, an average pooling layer AvegPooling1D and a Dropout layer; the first convolution layer Conv1D is set as follows: the number of filters filters = 4, the kernel size kernel_size = 4, the stride strides = 1, the activation function activation is ReLU function, the L2 regularization is set to 0.01, and the padding mode is valid; The second convolution layer Conv1D is set as follows: the number of filters filters = 16, the kernel size kernel_size = 8, the stride strides = 1, the activation function activation is ReLU function, the L2 regularization is set to 0.01, and the padding mode is valid; The maximum pooling layer MaxPooling1D is set as follows: the pooling size pool_size = 2, the stride strides = 2, and the padding mode is valid; The third convolution layer Conv1D is set as follows: the number of filters filters = 32, the kernel size kernel_size = 16, the stride strides = 1, the activation function activation is ReLU function, the L2 regularization is set to 0.01, and the padding mode is valid; The average pooling layer AvegPooling1D is set as follows: the pooling size pool_size = 2, the stride strides = 2, and the padding mode is valid; The Dropout layer discards 60% of the neurons; The second part is a GRU layer with 300 neurons; The third part is a flattening layer Flatten which processes the multi-dimensional input into one dimension; The fourth part is a first fully connected layer Dense, a Dropout layer and a second fully connected layer Dense; the first fully connected layer Dense uses ReLU function as the excitation function, the Dropout layer discards 50% of the neurons, and the activation function of the second fully connected layer Dense is softmax, and the output space dimension is 2, corresponding to the probabilities of normal signal and abnormal signal.

2. The method according to claim 1, wherein, The implementation process of step two is as follows: (a) read the original electrocardio data in the data set; (b) After wavelet transform, the electrocardiosignal is converted into a mixture of multiple wavelet functions, and the coefficients corresponding to the functions are obtained, and then the threshold is set to remove the coefficients corresponding to the noise, (c) The method of wavelet inverse transform is used to reconstruct the signal to obtain the electrocardiosignal after removing the noise.

3. The heart beat signal classification method of the CNN-GRU network model according to claim 2, characterized in that, (b) The formula of wavelet transform in the step of decomposition is: (1) wherein, is the wavelet function obtained, is the original ECG data, is the basic wavelet function, respectively represent the transform factors; The formula of setting threshold is (2) wherein, wherein, M and N represent the size of the input data, The calculation formula is: (3) wavelet coefficients corresponding to the high frequency part, denotes the median function used; The coefficients corresponding to the noise are removed by soft threshold method, and the formula is: (4); is the wavelet function obtained from equation (1), is the threshold value the corresponding soft threshold function.

4. The heart beat signal classification method of the CNN-GRU network model according to claim 2, characterized in that, (c) The method of wavelet inverse transform is used to reconstruct the signal, and the formula is as follows: (5) wherein , is the signal after removing noise, denotes a basic wavelet function, is the frequency, denote the transform factors, respectively.

5. The heart beat signal classification method of the CNN-GRU network model according to claim 1, characterized in that, The specific process of step three is as follows: (a) When performing heart beat segmentation processing on the electrocardiosignal, it is necessary to first find the position of R peak, and here the method of adaptive threshold is used for processing; first, a window with a length of T is used to calculate the moving average line, and the region of interest is calculated between the two intersection points of the moving average line and the electrocardiosignal, and the position corresponding to the maximum value in the region of interest is the position of R peak, and the R peak position value of all labeled points is read; (b) In order to further select the position of R peak, threshold setting is performed; first, remove the two labeled points at the beginning and end of the electrocardiosignal, because these two labeled points may not contain complete heart beat data; then, the threshold is set to further select the R peak; (c) Select N points on the left side of R peak and M points on the right side to form a heart beat, and in order to ensure that complete heart beat is obtained, the position of the labeled point is further set, the position value of the initial labeled point should be greater than N, and the position value of the final labeled point should be less than the position value obtained by subtracting M from the total position value of the electrocardiosignal, so that multiple equal length heart beat data can be obtained and used as the input of the subsequent network.

Citation Information

Patent Citations

  • Electrocardiogram cardiac beat classification identification method and system

    CN108647614A

  • Intelligent classification and recognition method of heart beat of electrocardiogram

    CN111449645A