Classification method of 12-lead electrocardiogram based on automatic deep convolutional learning model

By using the Resnet34 model and H-reg method in the electrocardiogram classification, and combining the SHAP function to improve the interpretability of the model, the problem of low accuracy and inexplicability of deep learning models in the electrocardiogram classification is solved, and more efficient classification is achieved and decision visualization.

CN115105085BActive Publication Date: 2024-12-03GUANGZHOU XINGSHU CLOUD TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210661407.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-13
Publication Date
2024-12-03
Estimated Expiration
2042-06-13

AI Technical Summary

Technical Problem

Existing deep learning models have problems such as low classification accuracy and inaccurate feature extraction in electrocardiogram classification, especially due to the underfitting phenomenon caused by the small number of physiological signal data sets, and the black box nature of deep learning models makes decisions unexplainable. .

Method used

The automatic deep convolutional learning model based on Resnet34 is used to classify twelve-lead electrocardiogram, combine with wavelet transformation for denoising, optimize feature extraction using the H-reg method, improve the classification accuracy of the model, and improve the capability of the model through the SHAP function. Explanatory.

Benefits of technology

The accuracy of ECG classification and the interpretability of the model are improved, and the imbalance problem during feature extraction is balanced through the H-reg method. The SHAP function makes the model decision process more transparent and visual.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115105085B_ABST
    Figure CN115105085B_ABST
Patent Text Reader

Abstract

The present invention provides a classification method for a twelve-lead electrocardiogram based on an automatic deep convolutional learning model, specifically: Step 1: De-noise the sample electrocardiogram signal; and divide the denoised electrocardiogram signal into a training set and a test set; Step 2: Construct a deep convolutional learning model based on Resnet34; Step 3: One-Hot encode each type of heartbeat type label in the electrocardiogram signal; Step 4: Use the training set to train the deep convolutional learning model of step 3; After the training is completed, save the model parameters and accuracy with the highest accuracy; and use the test set to test the accuracy of the trained deep convolutional learning model. Step 5: Input the actual electrocardiogram signal into the deep convolutional learning model based on Resnet34 obtained after training to obtain the category of the actual electrocardiogram signal. The present invention improves the accuracy of classification and increases the interpretability of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of time series classification. Background Art

[0002] Currently, electrocardiogram is the most widely used method for detecting heart problems. A standard electrocardiogram has 12 leads, including 6 limb leads (I, II, III, aVR, aVL, aVF) and 6 chest leads (V1, V2, V3, V4, V5, V6) recorded by body surface electrodes. Electrocardiogram-based detection provides important assistance to doctors' judgments, so an electrocardiogram detection system with high accuracy has a wide range of application value.

[0003] At present, the first type of research on heartbeat is the classic feature extraction method based on machine learning, while the second type is based on advanced deep learning methods. Traditional machine learning methods for heartbeat research mainly rely on manual feature extraction, because different ECG waveforms vary greatly. Due to the extensive development and research of deep learning, the use of deep learning algorithms for ECG classification has the following advantages. (1) The signal requires less preprocessing; (2) Features can be extracted automatically. By utilizing the layer-by-layer nonlinear representation of the deep network, the deep-level features in the ECG data are obtained by training the network, which improves the accuracy of the automatic classification algorithm. However, the existing deep learning networks still have the following shortcomings:

[0004] 1. The classification accuracy is not high, and a deeper network model is needed to improve the accuracy of the model. Due to the small number of some physiological signal data sets, the general deep learning model is prone to underfitting during the training process, resulting in low classification and prediction accuracy.

[0005] 2. At present, when extracting features of input data, deep learning models will extract features that are irrelevant to the output, thus affecting the accuracy of the final output. Summary of the invention

[0006] Purpose of the invention: In order to solve the problems existing in the above-mentioned prior art, the present invention provides a classification method for twelve-lead electrocardiogram based on an automatic deep convolutional learning model.

[0007] Technical solution: The present invention provides a classification method for a twelve-lead electrocardiogram based on an automatic deep convolutional learning model, which specifically includes the following steps:

[0008] Step 1: De-noise the sample ECG signal; and divide the de-noised ECG signal into a training set and a test set;

[0009] Step 2: Build a deep convolutional learning model based on Resnet34;

[0010] Step 3: One-Hot encode each type of heartbeat type label in the ECG signal;

[0011] Step 4: Use the training set to train the deep convolutional learning model based on Resnet34 in step 3; after the training is completed, save the model parameters and accuracy with the highest accuracy; and use the test set to test the accuracy of the trained deep convolutional learning model based on Resnet34;

[0012] Step 5: Input the actual ECG signal into the trained Resnet34-based deep convolutional learning model to obtain the category of the actual ECG signal.

[0013] Furthermore, in step 1, the electrocardiogram signal is denoised using a wavelet transform method.

[0014] Furthermore, the deep convolutional learning model based on Resnet34 includes: a first convolutional layer, a first batch normalization layer, a first ReLU activation layer, a maximum pooling layer, first to fourth residual convolution blocks, an average pooling layer, a fully connected layer and a Sigmoid activation function layer connected in sequence;

[0015] The first to fourth residual convolution blocks have the same structure, and all include a second convolution layer, a second batch normalization layer, a second and third ReLU activation layers, a elimination layer, a third convolution layer, a third batch normalization layer and an addition module; the second convolution layer, the second batch normalization layer, the second ReLU activation layer, the elimination layer, the third convolution layer and the third batch normalization layer are connected in sequence, the input of the addition module is connected to the output of the third batch normalization layer and the input of the residual convolution block, and the output of the addition module is connected to the third ReLU activation layer.

[0016] Furthermore, the loss function used when training the deep convolutional learning model based on Resnet34 is:

[0017]

[0018] Among them, loss cross entropy (x,c) represents the loss function, X represents the total number of ECG signals in the training set, and C represents the total number of categories. x,t =1 means the xth ECG signal belongs to the tth category. x,t =0, it means that the xth ECG signal does not belong to the tth category; p x,c Represents the probability that the xth ECG signal belongs to the tth category.

[0019] Furthermore, the deep convolutional learning model based on Resnet34 uses the H-reg method for feature extraction optimization:

[0020]

[0021] Among them, x represents the xth ECG signal, Indicates that x follows the distribution of the sample data set, represents the mathematical expectation of the second norm, n is a hyperparameter, Indicates the importance of each feature value extracted in the learned model.

[0022] Furthermore, the accuracy is calculated using the following formula in step 4:

[0023]

[0024] Where F1 is the accuracy, TP represents the number of sample ECG signals whose outputs are positive examples during training and are actually positive examples. FP represents the number of sample ECG signals whose outputs are positive examples during training but are actually negative examples. FN represents the number of sample ECG signals whose outputs are negative examples during training but are actually positive examples.

[0025] Furthermore, the method also includes using the SHAP function to explain the impact of each lead on the final output decision of the learning model.

[0026] Beneficial effects:

[0027] 1. The present invention can automatically classify nonlinear medical sensor data and relatively improve the accuracy of model classification. The present invention adopts the H-reg method to balance the problem of unbalanced eigenvalues ​​encountered during feature extraction, and reduces the influence value of data with high eigenvalues ​​and increases the influence value of data with low eigenvalues ​​to improve the classification accuracy of the model. Therefore, the present invention can improve the classification accuracy of the model.

[0028] 2. Although deep learning models can achieve higher classification performance in prediction tasks, they are generally considered black boxes. Due to the multi-layer nonlinear structure of deep models, the decisions made by deep learning models cannot be tracked by people. Therefore, when the model makes predictions, the behavior of the model cannot be understood by people. This patent uses the SHAP method to solve the above problems, improve the interpretability of the model, and make the decision behavior and decision impact of the model easier to understand in a visual form. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is the overall structure diagram of the model of the present invention.

[0030] Figure 2Schematic diagram of the process of using the SHAP method to increase the interpretability of the model. DETAILED DESCRIPTION

[0031] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0032] The data set used in this embodiment is the CPSC2018 data set (electrocardiogram data set); the CPSC2018 data set mainly classifies heart beats. The specifics of this embodiment are:

[0033] Step 1: Data preprocessing.

[0034] 1.1 Use wavelet transform method to denoise the incoming ECG signal records.

[0035] Since medical sensors are easily interfered by external factors when collecting physiological signals, it is necessary to use wavelet transform to denoise the ECG signal dataset (i.e., the CPSC2018 dataset).

[0036] After the data is denoised, each piece of data in the CPSC2018 data set will be labeled and classified. Because the length of the data of each lead is different, the data needs to be truncated. In this embodiment, the length of the data truncated is 15,000 data points, that is, 30s, 500Hz data, and the data with insufficient time length is filled with 0.

[0037] 1.2 Divide the data set into a training set and a test set of the ECG signal data set. In this embodiment, the CPSC2018 data set is classified according to the ratio of 7:1:2 for training set, validation set, and test set.

[0038] Step 2: Build a deep convolutional learning model based on Resnet34.

[0039] 2.1 Build a deep convolutional learning model based on Resnet34 for training ECG signals. The deep convolutional learning model based on Resnet34 built in this embodiment is used to train ECG signals. Figure 1As shown. After the ECG data is processed by the one-dimensional convolution (Conv1d) layer, the batch normalization (BatchNorm1d) layer, the rectified linear unit (ReLU) activation layer, and the maximum pooling layer (MaxPooling) for feature extraction, the data is placed in the convolution block for processing. This embodiment adopts 4 residual convolution blocks linked in sequence as residual blocks (Residual Block). In each convolution block, there are two one-dimensional convolution (Conv1d) layers, two batch normalization (BatchNorm1d) layers, a dropout (Dropout) layer, and two rectified linear unit (ReLU) activation layers. The Conv1d layer is used to automatically extract features, the BatchNorm1d layer makes the model faster and more stable, the rectified linear unit (ReLU) activation layer performs nonlinear activation, and the Dropout layer reduces overfitting. 1×1 convolution is used for size matching and skip connection. The average pooling layer (Avg pooling) is used to pool the features extracted from the stacked residual blocks (ResidualBlock). The data is then connected and aggregated through a fully connected layer (Dense), and the aggregated results are sent to the output layer for prediction using Sigmoid as the activation function.

[0040] 2.2 Initialize the architecture of the deep convolutional learning model based on Resnet34, set the loss function and hyperparameters; the hyperparameters mainly include: model input data length, step size, activation function, optimizer, number of sample training batches, and number of iterations.

[0041] The loss function used in this embodiment is the cross entropy loss function, as shown in Formula 1.

[0042]

[0043] Among them, loss cross entropy (x,c) represents the loss function, X represents the total number of ECG signals in the training set, and C represents the total number of categories. x,t =1 means the xth ECG signal belongs to the tth category. x,t =0, it means that the xth ECG signal does not belong to the tth category; p x,c Represents the probability that the xth ECG signal belongs to the tth category.

[0044] The deep convolutional learning model based on Resnet34 uses the H-reg method to optimize feature extraction when optimizing the features of the input data, as shown in Formula 2:

[0045]

[0046] Among them, x represents the xth ECG signal, Indicates that x follows the distribution of the sample data set, represents the mathematical expectation of the second normal form, n is a hyperparameter used to control the balance of data, Indicates the importance of each eigenvalue extracted in the learning model. In this embodiment, n is 12, and Formula 2 represents the penalty of the L-2 norm for high eigenvalues ​​and small penalty for low eigenvalues, so the parameter value will be more balanced.

[0047] The other parameters of the deep convolutional learning model based on Resnet34 are set as follows: batch size is set to 32, the number of training epochs is set to 40, the optimizer uses the Adam optimizer, the machine learning rate is set to 0.001, and the activation function is ReLU.

[0048] Step 3: Use the deep convolutional learning model based on Resnet34 to train the ECG signal data to achieve automatic classification of the data.

[0049] 3.1 One-Hot encode each heartbeat type label in the ECG signal.

[0050] 3.2 Set the ratio of the validation set to the training set.

[0051] 3.3 Input the training set of ECG signal data into the built deep convolutional learning model for training to obtain the model parameters with the highest accuracy for the current task model.

[0052] F1-score is the harmonic mean of precision and recall, which takes both precision and recall into account. Therefore, F1-score is more convincing than other evaluation criteria. The calculation formula of F1-score is shown in Formula 3:

[0053]

[0054] Where Pre is the accuracy, and its calculation formula is shown in the following formula 4:

[0055]

[0056] Rec is the recall rate, and its calculation formula is shown in the following formula 5:

[0057]

[0058] Among them, TP represents the number of sample ECG signals whose outputs are positive examples during training and are actually positive examples; FP represents the number of sample ECG signals whose outputs are positive examples during training but are actually negative examples; FN represents the number of sample ECG signals whose outputs are negative examples during training but are actually positive examples.

[0059] 3.4 After training is completed, save the model parameters and accuracy with the highest accuracy.

[0060] Step 4: Use the deep convolutional learning model saved in step 3 to test and classify the ECG signals of the test set.

[0061] Step 5: Using the input and output, use the SHAP method to increase the interpretability of the model. The flowchart of the SHAP method is as follows Figure 2 shown.

[0062] In this embodiment, a 12-lead ECG data is input into the model, so as to realize automatic classification of the ECG data and realize the visualization information of the model's interpretable decision distribution and decision impact.

[0063] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.

Claims

1. A 12-lead electrocardiogram classification method based on an automatic deep convolutional learning model, characterized by: The specific steps include: Step 1: De-noise the sample ECG signal; and divide the de-noised ECG signal into a training set and a test set; Step 2: Build a deep convolutional learning model based on Resnet34; Step 3: One-Hot encode each type of heartbeat type label in the ECG signal; Step 4: Use the training set to train the Resnet34-based deep convolutional learning model in step 3; After the training is completed, the model parameters and accuracy with the highest accuracy are saved; and the accuracy of the trained deep convolutional learning model based on Resnet34 is tested using the test set; Step 5: Input the actual ECG signal into the trained Resnet34-based deep convolutional learning model to obtain the category of the actual ECG signal; The loss function used when training the deep convolutional learning model based on Resnet34 is: Among them, loss crossentropy (x, t) represents the loss function, X represents the total number of ECG signals in the training set, and C represents the total number of categories. x,t =1, indicating that the xth ECG signal belongs to the tth category. x,t =0, it means that the xth ECG signal does not belong to the tth category; p x,c represents the probability that the xth ECG signal belongs to the tth category; The deep convolutional learning model based on Resnet34 uses the H-reg method for feature extraction optimization: Among them, x represents the xth ECG signal, Indicates that x follows the distribution of the sample data set, represents the mathematical expectation of the second norm, n is a hyperparameter, Indicates the importance of each feature value extracted in the learning model; In step 4, the accuracy is calculated using the following formula: Among them, F1 is the accuracy, Pre is the precision, Rec is the recall rate, TP represents the number of sample ECG signals whose outputs are positive examples during training and are actually positive examples. FP represents the number of sample ECG signals whose outputs are positive examples during training but are actually negative examples. FN represents the number of sample ECG signals whose outputs are negative examples during training but are actually positive examples.

2. The twelve-lead electrocardiogram classification method based on the automatic deep convolutional learning model according to claim 1 is characterized in that: In the step 1, the electrocardiogram signal is denoised using a wavelet transform method.

3. The twelve-lead electrocardiogram classification method based on the automatic deep convolutional learning model according to claim 1, characterized in that: The deep convolutional learning model based on Resnet34 includes a first convolutional layer, a first batch normalization layer, a first ReLU activation layer, a maximum pooling layer, first to fourth residual convolution blocks, an average pooling layer, a fully connected layer and a Sigmoid activation function layer connected in sequence; The first to fourth residual convolution blocks have the same structure, and all include a second convolution layer, a second and third batch normalization layer, a second and third ReLU activation layer, a elimination layer, a third convolution layer and an addition module; the second convolution layer, the second batch normalization layer, the second ReLU activation layer, the elimination layer, the third convolution layer and the third batch normalization layer are connected in sequence, the input of the addition module is connected to the output of the third batch normalization layer and the input of the residual convolution block, and the output of the addition module is connected to the third ReLU activation layer.

4. The twelve-lead electrocardiogram classification method based on the automatic deep convolutional learning model according to claim 1, characterized in that: The method also includes using the SHAP function to explain the impact of each lead on the final output decision of the learning model.