Automatic electrocardiogram recognition algorithm based on convolutional neural network

Through algorithms based on convolutional neural networks, a network structure including convolutional layer, pooling layer and fully connected layer is constructed, which solves the problem of insufficient accuracy of automatic electrogram recognition in the existing technology, and realizes high accuracy recognition of various cardiac beat types.

CN115227258BActive Publication Date: 2025-04-29SUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210710325.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-22
Publication Date
2025-04-29
Estimated Expiration
2042-06-22

Smart Images

  • Figure CN115227258B_ABST
    Figure CN115227258B_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electrocardiogram automatic recognition algorithm, and discloses an electrocardiogram automatic recognition algorithm based on a convolutional neural network, comprising: a component database: the database used is an arrhythmia database; preprocessing: preprocessing the electrocardiogram signal of the selected lead; data amplification: data amplification of the heartbeat type with a small sample size by changing the sample mean and variance; the network structure comprises 3 convolutional layers, 3 pooling layers and 3 fully connected layers; the invention proposes an electrocardiogram automatic recognition algorithm based on a convolutional neural network, the invention has multiple recognition types and high recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electrocardiogram automatic recognition algorithms, and in particular to an electrocardiogram automatic recognition algorithm based on a convolutional neural network. Background Art

[0002] Electrocardiogram (ECG) is a technology that uses an electrocardiograph to record the changes in electrical activity produced by the heart during each cardiac cycle from the body surface.

[0003] Accurately identifying electrocardiogram data is an important issue, and the current recognition accuracy needs to be improved.

[0004] To solve the above problems, this application proposes an automatic electrocardiogram recognition algorithm based on convolutional neural network. Summary of the invention

[0005] (I) Purpose of the invention

[0006] In order to solve the technical problems existing in the background technology, the present invention proposes an automatic electrocardiogram recognition algorithm based on a convolutional neural network. The present invention has multiple recognition types and high recognition accuracy.

[0007] (II) Technical solution

[0008] To solve the above problems, the present invention provides an automatic electrocardiogram recognition algorithm based on a convolutional neural network, comprising:

[0009] Component database:

[0010] The database used was the arrhythmia database;

[0011] Preprocessing:

[0012] Preprocessing the ECG signal of the selected lead;

[0013] Data augmentation:

[0014] The heart beat types with a small sample size are amplified by changing the sample mean and variance;

[0015] Network structure:

[0016] The network structure contains 3 convolutional layers, 3 pooling layers and 3 fully connected layers, using the error back propagation algorithm to maximize the verification accuracy;

[0017] The training algorithm process is as follows: suppose a sample (x, y) is input, where x and y are both vectors, f represents nonlinear mapping, W represents the connection weight of the convolutional layer, U represents the connection weight of the fully connected layer, b represents the bias of each layer, L represents the number of layers of the network, that is, the Lth layer network, l represents the output channel in the current layer, that is, the first output channel, a represents the output of each layer, and I represents the input of each layer.

[0018] (1) Randomly initialize the connection weights W of each convolutional layer l L , bias b (in this case, L = 2, 4, 6; corresponding to the lth output channel of the convolutional layer), and the connection weights of the fully connected layer Bias (At this time, L = 8, 9, 10; i and j represent the i-th neuron in the current layer and the j-th neuron in the previous layer of the current layer, respectively);

[0019] (2) Forward propagation of input samples: a represents the i-th output of the l-th output channel of the L-th layer (in this case, L = 1, 2, 3, 4, 5, 6, 7); the output of the fully connected layer is also represented by A; (in this case, L = 8, 9, 10, 11);

[0020] Input Layer:

[0021] Convolutional Layer:

[0022] At this time, L = 2, 4, 6, W; is the convolution kernel between the channel l of the layer (convolution layer) and the channel I' of the input layer (pooling layer or input layer) of the layer; where M is the length of the convolution kernel, and K represents the number of channels of the input layer (pooling layer or input layer) of the layer;

[0023] Pooling layer:

[0024]

[0025] At this time, L = 3, 5, 7; k is the pooling step size;

[0026] Fully connected layer:

[0027]

[0028] At this time, L = 9, 10, 1, a 8 for a 7 The output channels of A are connected in series. L The i-th output of R is A L-1 length;

[0029] (3) Error back propagation: δ L Recorded as Where e is the output error, I L is the input of the Lth layer, and the errors corresponding to different layers are as follows;

[0030] Fully connected layer:

[0031]

[0032] At this time, L = 11, the symbol represents the new vector obtained by multiplying the corresponding positions,

[0033]

[0034] At this time, L = 9, 10, T represents the transposition operation, so we get:

[0035]

[0036]

[0037] Pooling layer: The error is passed from the upper layer (convolutional layer), δ 7 is δ 9 Disconnect in the original connection order.

[0038]

[0039] At this time, L = 3, 5, the symbol * represents convolution, that is, and Convolution; is the convolution kernel between the channel l′ of the upper layer (convolution layer) and the channel l of the pooling layer; flip is the reverse operation of the input one-dimensional data;

[0040] Convolutional Layer:

[0041]

[0042] At this time, L = 2, 4, 6; where upsample is upsampling. For this paper, average pooling is used. Upsampling sampling means that the error is back-propagated from the upper layer (pooling layer) error δ L+1 Evenly distributed to the corresponding neurons in this layer;

[0043] and Convolution:

[0044]

[0045]

[0046] (4) The update amount of the batch training parameters containing p samples at time t is:

[0047]

[0048]

[0049] (5) Weight update at time t:

[0050] W L (t) = W L (t)-αΔW L (t)-μW L (t-1) (14)

[0051] b L (t) = b L (t)-αΔb L (t)-μb L (t-1) (15)

[0052] Among them, α is the learning rate, u is the momentum term coefficient;

[0053] (6) Repeat (1) to (5) to update the parameters until the update amount is less than a certain small threshold or the number of training times is reached to obtain the network model.

[0054] Preferably, the arrhythmia database contains 48 records, each record contains two leads, the sampling rate is 360Hz, each data length is about 30min, and a total of about 109,000 heartbeats, of which about 70% are normal heartbeats. The heartbeat type, rhythm information and signal quality corresponding to the ECG signal are all saved in the annotation file.

[0055] Preferably, bior wavelet is selected for 8th-order wavelet transform, 1st and 2nd layers of high-frequency noise and 8th layer of low-frequency information are removed and then reconstructed to remove baseline drift and high-frequency noise interference; in the network training stage, since the position of the R wave has been given in the annotation file, the R wave is not detected. In the specific measurement process, the differential threshold method is used to detect the R wave, and then the ECG data is segmented with the R wave as the center. Each segmented segment is 440 sampling points long and usually contains morphological information of more than one complete heartbeat. Each segmented heartbeat segment is standardized so that its mean is 0 and its standard deviation is 1.

[0056] Preferably, the input layer is set as the first layer, the second, fourth and sixth layers are convolutional layers, the one-dimensional convolution kernel lengths are 21, 13 and 12 respectively, the corresponding number of output channels are 10, 12 and 8, the third, fifth and seventh layers are average pooling layers, the pooling step size is 2, and finally the multilayer perceptron with 90, 40 and 13 neurons respectively.

[0057] Preferably, the initial learning rate α is 0.5, and the learning rate is reduced with the training cycle. In order to speed up the training, a momentum term is added, and its coefficient u is set to 0.8. In addition, a small batch training method is adopted, and the batch size p is set to 64.

[0058] Preferably, the amplified heartbeat types include (the corresponding symbols in brackets indicate the heartbeat types): ventricular flutter (!), ventricular fusion wave (F), junctional premature beat (J), accelerated atrial escape beat (a), true paced fusion beat (f), junctional escape beat (j) and untransmitted P wave (x), while heartbeat types with a large sample size are not amplified, including: normal heartbeat (N), left bundle branch block heartbeat (L), right bundle branch block heartbeat (R), atrial premature beat (A), ventricular premature beat (V) and paced heartbeat ( / ).

[0059] Preferably, in order to avoid the problem of data imbalance, 2000 samples of each type of heartbeat are randomly selected from the amplified data to form a 26000 sample set. In order to evaluate the performance of the model more objectively, this paper uses ten-fold cross validation to evaluate model 1, that is, all samples are divided into 10 parts, one of which is used as test data and the other 9 are used as training data. The model is evaluated by the average result of 10 tests, that is, each training set is 23400 random samples and the test set is 2600 random samples.

[0060] The above technical solution of the present invention has the following beneficial technical effects:

[0061] This paper uses the CNN algorithm to identify the type of heartbeat. The network contains 3 convolutional layers, 3 pooling layers and 3 fully connected layers. The CNN self-learning is used to extract the input segmented ECG signal features, and then the multi-layer perceptron is used to identify and classify the input features. The error back propagation method is used to train the model. Finally, the average accuracy of the test is 99.24%, the average specificity is more than 99.59%, and the average positive prediction result and sensitivity are 95.0% and 95.06%. For noisy signals, this network still has a high accuracy, which is of great significance for dynamic electrocardiogram testing in actual use. A network using end-to-end learning convolutional neural networks can identify up to 13 types of heartbeats with a high accuracy. Its characteristics of identifying a variety of heartbeat types, high reliability, fast speed and ease of use can play an important role in the automatic diagnosis of arrhythmias in the future. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 This is a heartbeat recognition flow chart of an automatic electrocardiogram recognition algorithm based on a convolutional neural network proposed by the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solutions and advantages of the present invention more clear, the following is a detailed description of the present invention in conjunction with the specific implementation methods and with reference to the attached drawings. Figure 1 , the present invention is further described in detail. It should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concept of the present invention.

[0064] like Figure 1 -As shown, the present invention proposes an automatic electrocardiogram recognition algorithm based on a convolutional neural network, which is characterized by including:

[0065] Component database:

[0066] The database used was the arrhythmia database;

[0067] Preprocessing:

[0068] Preprocessing the ECG signal of the selected lead;

[0069] Data augmentation:

[0070] Since the sample size of each heartbeat type in the database used is uneven, only 13 types of heartbeats with relatively large sample sizes are considered. For these 13 types of heartbeats, the difference in sample size is still large. In order to balance the sample size of each type of heartbeat, the heartbeat types with smaller sample sizes are amplified by changing the sample mean and variance. The amplified heartbeat types include (the corresponding symbols of the heartbeat type are indicated in brackets): ventricular flutter (!), ventricular fusion wave (F), junctional premature beat (J), accelerated atrial escape beat (a), true paced fusion beat (f), junctional escape beat (j) and untransmitted P wave (x), while the heartbeat types with larger sample sizes are not amplified, including: normal heartbeat (N), left bundle branch block heartbeat (L), right bundle branch block heartbeat (R), atrial premature beat (A), ventricular premature beat (V) and paced heartbeat ( / ).

[0071] In order to avoid the problem of data imbalance, 2000 samples of each type of heartbeat were randomly selected from the amplified data to form a 26000 sample set. In order to evaluate the performance of the model more objectively, this paper uses ten-fold cross validation to evaluate model 1, that is, all samples are divided into 10 parts, one of which is used as test data and the other 9 as training data. The model is evaluated by the average result of 10 tests, that is, each training set is 23400 random samples and the test set is 2600 random samples.

[0072] Network structure:

[0073] CNN is one of the fastest-growing artificial neural networks in recent years. It can be regarded as a multi-layer perceptron with a special structure. It is often used in image recognition, natural language processing and other fields. The network usually contains convolutional layers, pooling layers and fully connected layers. Convolutional layers and pooling layers are alternately and repeatedly stacked at the front end of the network to extract the features of the input data. The output of the convolutional layer undergoes a nonlinear mapping of the activation function and then outputs it to the pooling layer. The pooling layer can reduce the data dimension, avoid overfitting, and enhance the robustness of the network. Commonly used pooling operations include maximum pooling and average pooling. This article uses average pooling. The one-dimensional signal obtained by connecting the output channels of the last average pooling layer in series is used as the input of the fully connected layer. Multiple fully connected layers form a multi-layer perceptron for classification and recognition results.

[0074] The network structure of this paper contains 3 convolutional layers, 3 pooling layers and 3 fully connected layers. The input layer is set as the first layer, the 2nd, 4th and 6th layers are convolutional layers, the one-dimensional convolution kernel lengths are 21, 13 and 12 respectively, and the corresponding number of output channels is 10, 12 and 8. The 3rd, 5th and 7th layers are average pooling layers with a pooling step of 2. Finally, there is a multilayer perceptron with 90, 40 and 13 neurons respectively.

[0075] The error back propagation algorithm is used to maximize the verification accuracy. The initial learning rate α is 0.5, and the learning rate is reduced with the training cycle. In order to speed up the training, a momentum term is added, and its coefficient u is set to 0.8. In addition, the small batch training method is adopted, and the batch size p is set to 64.

[0076] This network is a CNN that processes one-dimensional data. Its training algorithm flow is as follows: Assume that a sample (x, y) is input, where x and y are both vectors, f represents nonlinear mapping, W represents the connection weight of the convolutional layer, U represents the connection weight of the fully connected layer, b represents the bias of each layer, L represents the number of layers of the network, i.e., the Lth layer network, l represents the output channel in the current layer, i.e., the first output channel, a represents the output of each layer, and I represents the input of each layer;

[0077] (1) Randomly initialize the connection weights W of each convolutional layer l L , bias b (in this case, L = 2, 4, 6; corresponding to the lth output channel of the convolutional layer), and the connection weights of the fully connected layer Bias (At this time, L = 8, 9, 10; i and j represent the i-th neuron in the current layer and the j-th neuron in the previous layer respectively).

[0078] (2) Forward propagation of input samples: a represents the i-th output of the l-th output channel of the L-th layer (in this case, L = 1, 2, 3, 4, 5, 6, 7); the output of the fully connected layer is also represented by A; (in this case, L = 8, 9, 10, 11);

[0079] Input Layer:

[0080] Convolutional Layer:

[0081] At this time, L = 2, 4, 6, W; is the convolution kernel between the channel l of the layer (convolution layer) and the channel I' of the input layer (pooling layer or input layer) of the layer; where M is the length of the convolution kernel, and K represents the number of channels of the input layer (pooling layer or input layer) of the layer;

[0082] Pooling layer:

[0083]

[0084] At this time, L = 3, 5, 7; k is the pooling step size.

[0085] Fully connected layer:

[0086]

[0087] At this time, L = 9, 10, 1, a 8 for a 7 The output channels of A are connected in series. L The i-th output of R is A L-1 length;

[0088] (3) Error back propagation: δ L Recorded as Where e is the output error, I L is the input of layer L. The errors corresponding to different layers are as follows:

[0089] Fully connected layer:

[0090]

[0091] At this time, L = 11, the symbol Represents the new vector obtained by multiplying the corresponding positions.

[0092]

[0093] At this time, L = 9, 10, T represents the transposition operation, so we get:

[0094]

[0095]

[0096] Pooling layer: The error is passed from the upper layer (convolutional layer), δ 7 is δ 9Disconnect in the original connection order.

[0097]

[0098] At this time, L = 3, 5, the symbol * represents convolution, that is, and Convolution; is the convolution kernel between the channel l′ of the upper layer (convolution layer) and the channel l of the pooling layer; flip is the reverse operation of the input one-dimensional data;

[0099] Convolutional Layer:

[0100]

[0101] At this time, L = 2, 4, 6; where upsample is upsampling. For this paper, average pooling is used. Upsampling sampling means that the error is back-propagated from the upper layer (pooling layer) error δ L+1 Evenly distributed to the corresponding neurons in this layer;

[0102] and Citrus aurantium:

[0103]

[0104]

[0105] (4) The update amount of the batch training parameters containing p samples at time t is:

[0106]

[0107]

[0108] (5) Weight update at time t:

[0109] W L (t) = W L (t)-αΔW L (t)-μW L (t-1) (14)

[0110] b L (t) = b L (t)-αΔb L (t)-μb L (t-1) (15)

[0111] Among them, α is the learning rate and u is the momentum term coefficient.

[0112] (6) Repeat (1) to (5) to update the parameters until the update amount is less than a certain small threshold or the number of training times is reached to obtain the network model.

[0113] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. In addition, the appended claims of the present invention are intended to cover all changes and modifications that fall within the scope and boundaries of the appended claims, or the equivalent forms of such scope and boundaries.

Claims

1. An automatic electrocardiogram recognition algorithm based on convolutional neural network, characterized in that: include: Component database: The database used was the arrhythmia database; Preprocessing: Preprocessing the ECG signal of the selected lead; Data augmentation: The heartbeat types with a small sample size are amplified by changing the sample mean and variance; Network structure: The network structure contains 3 convolutional layers, 3 pooling layers and 3 fully connected layers, using the error back propagation algorithm to maximize the verification accuracy; The training algorithm process is as follows: Assume that a sample (x, y) is input, where x and y are both vectors, f represents nonlinear mapping, W represents the connection weight of the convolutional layer, U represents the connection weight of the fully connected layer, b represents the bias of each layer, L represents the number of layers of the network, that is, the Lth layer network, l represents the output channel in the current layer, that is, the first output channel, a represents the output of each layer, and I represents the input of each layer; (1) Randomly initialize the connection weights W of each convolutional layer l L , bias b (in this case, L = 2, 4, 6; corresponding to the lth output channel of the convolutional layer), and the connection weights of the fully connected layer Bias (2) Forward propagation of input samples: a represents the i-th output of the l-th output channel of the L-th layer (in this case, L = 1, 2, 3, 4, 5, 6, 7); the output of the fully connected layer is also represented by A; (in this case, L = 8, 9, 10, 11); Input Layer: Convolutional Layer: At this time, L = 2, 4, 6, W; is the convolution kernel between the channel l of the layer (convolution layer) and the channel I' of the input layer (pooling layer or input layer) of the layer; where M is the length of the convolution kernel, and K represents the number of channels of the input layer (pooling layer or input layer) of the layer; Pooling layer: At this time, L = 3, 5, 7; k is the pooling step size, Fully connected layer: At this time, L = 9, 10, 1, a 8 for a 7 The output channels of A are connected in series. L The i-th output of R is A L-1 length; (3) Error back propagation: δ L Recorded as Where e is the output error, I L is the input of the Lth layer, and the errors corresponding to different layers are as follows; Fully connected layer: At this time, L = 11, and the symbol ⊙ represents the new vector obtained by multiplying the corresponding positions. At this time, L = 9, 10, T represents the transposition operation, so we get: Pooling layer: The error is passed from the upper layer (convolutional layer), δ 7 is δ 9 Disconnect in the original connection order. At this time, L = 3, 5, the symbol * represents convolution, that is, and Convolution; is the convolution kernel between the channel l′ of the upper layer (convolution layer) and the channel l of the pooling layer; flip is the reverse operation of the input one-dimensional data; Convolutional Layer: At this time, L = 2, 4, 6; where upsample is upsampling. For this paper, average pooling is used. Upsampling sampling means that the error is back-propagated by the upper layer (pooling layer) error δ L+1 Evenly distributed to the corresponding neurons in this layer; and Convolution: (4) The update amount of the batch training parameters containing p samples at time t is: (5) Weight update at time t: W L (t)=W L (t)-αΔW L (t)-μW L (t-1) (14) b L (t)=b L (t)-αΔb L (t)-μb L (t-l) (15) Among them, α is the learning rate, u is the momentum term coefficient; (6) Repeat steps (1) to (5) to update the parameters until the update amount is less than a certain small threshold or the number of training times is reached to obtain the network model.

2. The electrocardiogram automatic recognition algorithm based on convolutional neural network according to claim 1 is characterized in that: The arrhythmia database contains 48 records, each with two leads, a sampling rate of 360 Hz, and each data length of about 30 minutes. It contains a total of about 109,000 heartbeats, of which about 70% are normal heartbeats. The heartbeat type, rhythm information, and signal quality corresponding to the ECG signal are all saved in the annotation file.

3. The electrocardiogram automatic recognition algorithm based on convolutional neural network according to claim 1 is characterized in that: The bior wavelet was selected for 8th-order wavelet transform, which removed the 1st and 2nd layers of high-frequency noise and the 8th layer of low-frequency information and then reconstructed to remove the baseline drift and high-frequency noise interference; During the network training stage, the R wave was not detected because its position was given in the annotation file. In the actual measurement process, the differential threshold method was used to detect the R wave, and then the ECG data was segmented with the R wave as the center. Each segmented segment was 440 sampling points long and usually contained more than one complete heartbeat morphological information. Each segmented heartbeat segment was standardized to have a mean of 0 and a standard deviation of 1.

4. The electrocardiogram automatic recognition algorithm based on convolutional neural network according to claim 1 is characterized in that: The input layer is set as the first layer, the second, fourth and sixth layers are convolutional layers, the one-dimensional convolution kernel lengths are 21, 13 and 12 respectively, and the corresponding number of output channels is 10, 12 and 8. The third, fifth and seventh layers are average pooling layers with a pooling step of 2. Finally, there is a multilayer perceptron with 90, 40 and 13 neurons respectively.

5. The electrocardiogram automatic recognition algorithm based on convolutional neural network according to claim 1 is characterized in that: The initial learning rate α is 0.5, and the learning rate is reduced with the training cycle. In order to speed up the training, a momentum term is added, and its coefficient u is set to 0.

8. In addition, the small batch training method is adopted, and the batch size p is set to 64.

6. The electrocardiogram automatic recognition algorithm based on convolutional neural network according to claim 1 is characterized in that: The amplified heartbeat types include (the corresponding symbols in brackets indicate the heartbeat type): ventricular flutter (!), ventricular fusion wave (F), junctional premature beat (J), accelerated atrial escape beat (a), true paced fusion beat (f), junctional escape beat (j) and unconducted P wave (x), while the heartbeat types with a large sample size are not amplified, including: normal beat (N), left bundle branch block beat (L), right bundle branch block beat (R), atrial premature beat (A), ventricular premature beat (V) and paced beat ( / ).

7. The electrocardiogram automatic recognition algorithm based on convolutional neural network according to claim 1 is characterized in that: In order to avoid the problem of data imbalance, 2000 samples of each type of heartbeat were randomly selected from the amplified data to form a 26000 sample set. In order to evaluate the performance of the model more objectively, this paper uses ten-fold cross validation to evaluate model 1, that is, all samples are divided into 10 parts, one of which is used as test data and the other 9 as training data. The model is evaluated by the average result of 10 tests, that is, each training set is 23400 random samples and the test set is 2600 random samples.

Citation Information

Patent Citations

  • Classification method for arrhythmia based on one-dimension convolution neural-network and S transformation

    CN107811626A

  • Automatic arrhythmia analysis method based on deep neural network

    CN108937912A