An ECG signal classification method based on attention mechanism CNN-GRU

By using an attention-based CNN-GRU model, the problem of high misdiagnosis rate in ECG interpretation algorithms was solved, achieving efficient classification of ECG signals and identification of multiple types of arrhythmias, thus improving accuracy and model stability.

CN119014878BActive Publication Date: 2026-03-13DALIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing ECG interpretation algorithms have a high misdiagnosis rate, traditional machine learning algorithms rely on manual operation and have a significant impact on the results, and GRU networks require manual construction of feature relationships, making it difficult to effectively mine ECG features.

Method used

A CNN-GRU model based on an attention mechanism is adopted. ECG signal features are extracted through a convolutional neural network, and classification is performed by combining gated recurrent units and an attention mechanism. Fourier transform and sliding window are used to process the signals, and an attention mechanism is introduced to capture the correlation between signals. The model is trained using cross-entropy loss and RMSprop optimization algorithm.

Benefits of technology

It improved the accuracy of ECG signal classification, enhanced the model's generalization ability and robustness, achieved accurate identification of multiple types of arrhythmias, and reduced the misdiagnosis rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119014878B_ABST
    Figure CN119014878B_ABST
Patent Text Reader

Abstract

This invention presents a CNN-GRU-based ECG signal classification method based on an attention mechanism, belonging to the field of ECG signal classification. The method first collects ECG signals and performs resampling, preprocessing, and annotation to obtain an ECG signal dataset, which is then divided into training and testing sets. A CNN network is used to construct an ECG signal feature extraction network, and a GRU network and an attention mechanism module are used to construct an ECG signal classification network. The training set data is input into the CNN-GRU model for training, and the model with the highest classification accuracy is saved. The test set data is input into the saved model to complete the test, obtaining the final classification accuracy and achieving ECG signal classification. This invention's CNN-GRU-based ECG classification method based on an attention mechanism improves the accuracy of ECG classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of ECG signal classification, and specifically to an ECG signal classification method based on an attention mechanism-based CNN-GRU. Background Technology

[0002] In recent years, the incidence of heart disease has been rising due to factors such as an aging population, chronic cardiovascular diseases, increasing life pressures, and an ever-accelerating pace of life. According to incomplete statistics, approximately one-third of deaths worldwide are caused by heart disease, and in China, about 540,000 people die from sudden cardiac death each year. Clearly, heart disease poses a serious threat to human survival and health. Furthermore, the incidence of heart disease is trending younger, with an increasing proportion of young people affected. Heart disease has become a major threat to human life. Therefore, timely and accurate identification of arrhythmias is crucial for the effective prevention of heart disease and the targeted treatment of cardiovascular diseases.

[0003] Electrocardiography (ECG) is a crucial tool for diagnosing heart diseases. Since its introduction 50 years ago, computer-aided interpretation has become increasingly important in clinical ECG workflows, serving as a vital aid to physician interpretation in many clinical settings. However, existing commercial ECG interpretation algorithms still suffer from high misdiagnosis rates. Traditional machine learning algorithms require complex manual operations such as filtering, feature extraction, and wavelet transforms. These data manipulations heavily rely on medical industry experience and significantly impact the final model results. In recent years, significant progress has been made in using deep learning to classify raw ECG data.

[0004] Convolutional neural networks can extract abstract, high-dimensional features, but they cannot capture contextual information, thus hindering their ability to perform classification. Gated recurrent units (GRUs), on the other hand, are optimized networks based on long short-term memory (LSTM). They simplify the internal unit structure of LSTM, effectively shortening training time while maintaining high prediction accuracy, making them more suitable for arrhythmia detection. However, GRU networks require manual construction of feature relationships, and further optimization is needed to consider combining them with other networks to enhance their ability to extract ECG features. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide an ECG signal classification method based on attention mechanism CNN-GRU, which addresses the shortcomings of the above-mentioned technologies.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: an ECG signal classification method based on attention mechanism CNN-GRU, comprising the following steps:

[0007] S1: Collect ECG signals and perform resampling and preprocessing.

[0008] S1.1 ECG signal acquisition: Select ECG signal data from the database;

[0009] S1.2 ECG signal resampling: The original ECG signal data is segmented by using a sliding window to cover all segments; during the resampling process, the signal is first subjected to Fourier transform to obtain its spectral representation, then the spectrum is interpolated to adapt it to the target sampling frequency, and finally the spectrum is converted back to the time domain signal through inverse Fourier transform.

[0010] S1.3 ECG signal annotation and preprocessing: The acquired ECG data is read using WFDB and annotated according to the AAMI standard;

[0011] S1.4 Data Partitioning: The processed ECG signal dataset is randomly divided into a training set and a test set;

[0012] S2: Constructing an ECG signal feature extraction and classification network

[0013] Construct a comprehensive model consisting of a convolutional neural network and a gated recurrent unit; this model uses the convolutional neural network to extract features and the gated recurrent unit to perform classification.

[0014] S2.1 Feature Extraction Convolutional Neural Network: The feature extraction network consists of a one-dimensional convolutional layer, a batch normalization layer, and a max pooling layer. Through local connectivity and weight sharing mechanisms, it processes the input data step by step and automatically extracts high-level features.

[0015] Convolutional layer: Utilizing local connectivity and weight sharing, it performs convolution operations on the input signal to extract local features; the formula for the convolution operation is as follows:

[0016]

[0017] Where x is the input signal, w is the convolution kernel, y is the output signal, k is the kernel size, m is the position index of the output signal during the convolution operation, and n is the position index within the kernel; Batch normalization layer: Normalizes the output of the convolution layer. The formula for batch normalization is:

[0018]

[0019] in, The output is the normalized value, where μ and σ are the mean and standard deviation of the batch data, respectively, and ∈ is a small constant.

[0020] Max pooling layer: This layer performs pooling operations on the normalized features. The formula for max pooling is:

[0021] y[i] = max(x[m:m+p])

[0022] Where p is the size of the pooling window;

[0023] S2.2 Arrhythmia Classification Network: The Gated Recurrent Unit (GRU) model is used for feature classification, and an attention mechanism module is introduced to capture the correlation between signals, thereby completing the classification of arrhythmia signals;

[0024] The gated recurrent unit model updates the gates and resets the long-term dependencies in the gated time series, as shown in the following formula:

[0025] z t =σ(W (z) x t +U (z) h t-1 )

[0026] r t =σ(W (r) x t +U (r) h t-1 )

[0027]

[0028] Among them, z t To update the gate, r t To reset the door, h t In hidden state, For the candidate hidden state, x t Let W be the input at time step t, and let W be the weight matrix input to the update gate. (z) W is the weight matrix input to the reset gate. (r) Let U be the weight matrix of the candidate hidden state, and U be the weight matrix from the hidden state to the update gate. (z) U is the weight matrix from the hidden state to the reset gate. (r) The weight matrix from the hidden state to the candidate hidden state. σ is the element-wise pointwise product, σ is the sigmoid activation function, and tanh is the hyperbolic tangent activation function;

[0029] Attention mechanism: The attention mechanism calculates the degree of correlation between each element in the sequence and the current time step, and then weights the sequence elements according to the degree of correlation.

[0030] Calculate attention weights: The outputs of the GRU hidden layers in the gated recurrent unit model are weighted and summed to calculate the attention score at each time step; the calculation formula is:

[0031] e ij =tanh(W h h i +W s s j )

[0032] Among them, e ij H represents the hidden state. i With the current input s j The relevance score, h i s is the output of the GRU hidden layer at time step i. j W is the value of the current input at time step j. h and W s It is the weight matrix used to calculate the attention score;

[0033] Normalized weights: The attention scores are normalized using the softmax function to obtain the attention weight distribution.

[0034]

[0035] Where, α ij This represents the attention weight at time j to time i;

[0036] Calculate the context vector: Apply the attention weights to the hidden layer output of the GRU to obtain the context vector.

[0037]

[0038] Fully connected layer and output layer: The output of the attention mechanism is passed through a fully connected layer and an output layer for classification; the output layer uses a softmax function to calculate the final classification probability.

[0039] y = softmax(W o c+b o )

[0040] Among them, W o It is the weight matrix of the fully connected layer, b o It is the bias vector of the fully connected layer;

[0041] Through the above structure, the model extracts and classifies features in ECG signals, thereby identifying different types of arrhythmias;

[0042] S3. Training the ECG classification model

[0043] The cross-entropy loss function is used to measure the difference between the model output and the true label; for a given sample, the cross-entropy loss function is defined as:

[0044]

[0045] Where, q i It is the probability of the true label, p i It is the probability output by the model;

[0046] The RMSprop optimization algorithm adaptively adjusts the learning rate based on the exponentially weighted moving average of the squared gradient; its parameter update rule is as follows:

[0047]

[0048] Where, θ t It is the parameter of the t-th iteration. It is the gradient of the loss function with respect to the parameters, η is the learning rate, β is the decay rate, and v is the gradient of the loss function with respect to the parameters. t It is the exponentially weighted moving average of the square of the gradient, where δ is a small constant used to prevent division by zero.

[0049] The model parameters are updated by calculating the cross-entropy loss function and using the RMSprop optimization algorithm for backpropagation. The training is iterated until the maximum number of training iterations is reached. During the training process, the model with the highest classification accuracy is saved as the optimal network model.

[0050] Furthermore, in step S1, the databases are the MIT-BIH arrhythmia database, the MIT-BIH ST variation database, the EU ST-T ECG database, and the dynamic ECG database for sudden cardiac death.

[0051] Furthermore, in step S1.2, during resampling, the sliding window is 10 seconds, and the sampling frequency is set to 360Hz during Fourier transform; after resampling, the ECG signal is normalized into a signal segment with a length of 10 seconds and a sampling frequency of 360Hz.

[0052] Furthermore, in step S1.3, the classification of data annotation includes N-normal, L-left bundle branch block, R-right bundle branch block, V-ventricular premature beats, and A-atrial premature beats.

[0053] The beneficial effects of this invention are as follows: First, the method collects ECG signals and performs resampling, preprocessing, and annotation to obtain an ECG signal dataset, which is then divided into training and testing sets. A CNN network is used to build an ECG signal feature extraction network, and a GRU network and attention mechanism module are used to build an ECG signal classification network. The training set data is input into the CNN-GRU model for training, and the model with the highest classification accuracy is saved. The test set data is input into the saved model to complete the test, obtaining the final classification accuracy and achieving ECG signal classification. The CNN-GRU ECG classification method based on the attention mechanism proposed in this invention improves the accuracy of ECG classification. Multiple dataset processing: This method uses multiple datasets for training and testing, while other methods typically use a single dataset, ensuring that the model has better generalization ability and robustness. Multi-class classification: This method achieves a five-class classification task: N-normal, L-left bundle branch block, R-right bundle branch block, V-ventricular premature beats, and A-atrial premature beats, while other methods are usually limited to two-class classification, which increases the complexity and practicality of classification.

[0054] Attention Mechanism Introduced: This method introduces an attention mechanism module, which significantly improves the accuracy of ECG signal classification by capturing the correlation between signals. The attention mechanism can dynamically adjust the weights at each time step, enhancing the model's focus on important features and improving classification performance. Attached Figure Description

[0055] Figure 1 It is a flowchart of the invention implementation process.

[0056] Figure 2 This is a schematic diagram of a CNN structure.

[0057] Figure 3 This is a diagram illustrating the attention mechanism.

[0058] Figure 4 This is a schematic diagram of the CNN-GRU model based on the attention mechanism.

[0059] Figure 5 This is a distribution map of ECG signal categories after processing.

[0060] Figure 6 It is a confusion matrix diagram.

[0061] Figure 7 It refers to the loss and accuracy changes during the training process. Detailed Implementation

[0062] Combination Figures 1 to 5 A CNN-GRU-based ECG signal classification method based on an attention mechanism includes the following steps:

[0063] Step 1: Collect ECG signals and perform resampling and preprocessing

[0064] 1.1 ECG Signal Acquisition: To ensure sufficient data and improve the model's generalization ability, ECG signal data were selected from the following four databases:

[0065] MIT-BIH Arrhythmia Database, MIT-BIH ST Variation Database, EU ST-T ECG Database, and Dynamic ECG Database for Sudden Cardiac Death.

[0066] 1.2 ECG Signal Resampling: To facilitate subsequent processing and address inconsistencies in data length and sampling frequency between different databases, we employ a 10-second sliding window to cover all segments, dividing the original ECG signal data. During resampling, Fourier transform is used, setting the sampling frequency to 360Hz. First, a Fourier transform is performed on the signal to obtain its spectral representation. Then, the spectrum is interpolated to adapt to the target sampling frequency. Finally, an inverse Fourier transform is used to convert the spectrum back to the time domain signal. In this way, we can standardize ECG signals of different lengths and sampling frequencies into 10-second segments with a sampling frequency of 360Hz, facilitating subsequent data processing and analysis.

[0067] 1.3 ECG Signal Annotation and Preprocessing: The acquired ECG data were read using WFDB and annotated according to the AAMI standard, categorized as N (normal), L (left bundle branch block), R (right bundle branch block), V (ventricular premature beats), and A (atrial premature beats). After deduplication and removal of outlier labels, an ECG dataset containing 53,787 N signals, 1,896 L signals, 1,951 R signals, 27,455 V signals, and 1,079 A signals was obtained.

[0068] 1.4 Data partitioning: The processed ECG signal dataset is randomly divided into training and test sets in a 9:1 ratio.

[0069] Step 2: Constructing an ECG signal feature extraction and classification network

[0070] To extract representative features from input ECG signal data and classify them to identify arrhythmias, we constructed a comprehensive model consisting of a convolutional neural network (CNN) and a gated recurrent unit (GRU). This model utilizes the CNN to extract features and the GRU for classification. An attention mechanism was also introduced to enhance the model's classification ability.

[0071] 2.1 Feature Extraction Convolutional Neural Network

[0072] The feature extraction network consists of one-dimensional convolutional layers, batch normalization layers, and max pooling layers. Through local connectivity and weight sharing mechanisms, it processes the input data step by step and automatically extracts high-level features.

[0073] 2.1.1 Convolutional Layer: Utilizing local connectivity and weight sharing, convolution operations are performed on the input signal to extract local features. The formula for the convolution operation is as follows:

[0074]

[0075] Where x is the input signal, w is the convolution kernel, y is the output signal, k is the convolution kernel size, m is the position index of the output signal in the convolution operation, and n is the position index in the convolution kernel;

[0076] 2.1.2 Batch Normalization Layer: Normalizes the output of the convolutional layer to accelerate the training process and improve model stability.

[0077]

[0078] Where x is the input signal, The output is the normalized value, where μ and σ are the mean and standard deviation of the batch data, respectively, and ∈ is a small constant.

[0079] 2.1.3 Max Pooling Layer: This layer performs pooling operations on the normalized features to reduce feature dimensionality and computational complexity while preserving important features. The formula for max pooling is:

[0080] y[i] = max(x[m:m+p])

[0081] Where p is the size of the pooling window;

[0082] This internal structure, composed of convolutional layers, pooling layers, and fully connected layers, effectively reduces the number of parameters that need to be learned, thus lowering the model's complexity. Through convolutional and pooling layers, the model can effectively capture important information from the input data and automatically extract feature vectors, thereby simplifying the feature extraction and data reconstruction process and improving the quality of feature representation.

[0083] 2.2 Arrhythmia Classification Network

[0084] The classification network uses a GRU model for feature classification and introduces an attention mechanism module to capture the correlation between signals, thereby completing the classification of arrhythmia signals.

[0085] 2.2.1 GRU (Gated Recurrent Unit): The GRU model captures long-term dependencies in time series data through a simplified gate structure (update gate and reset gate), while reducing training parameters and improving training efficiency. The formula for GRU is as follows:

[0086] z t =σ(W (z) x t +U (z) h t-1 )

[0087] r t =σ(W (r) x t +U (r) h t-1 )

[0088]

[0089] Among them, z t To update the gate, r t To reset the door, h t In hidden state, For the candidate hidden state, x t For the input of time step t, W, W (z) W (r) Let U be the weight matrix input to each gate (update gate, reset gate, candidate hidden state). (z) U (r) This is the weight matrix from the hidden state to each gate (update gate, reset gate, candidate hidden state). σ is the element-wise pointwise product (Hadamard product), σ is the sigmoid activation function, and tanh is the hyperbolic tangent activation function. 2.2.2 Attention Mechanism: The attention mechanism calculates the correlation between each element in the sequence and the current time step, and weights the sequence elements according to these correlations, enabling the model to focus on the parts relevant to the current task, thereby improving the model's accuracy.

[0090] In ECG signal classification, attention mechanisms help models identify and emphasize key ECG signal segments. For example, when detecting abnormal rhythms, the morphological and temporal characteristics of certain waveforms (such as P waves, QRS complexes, and T waves) may have particularly important diagnostic significance. By introducing attention mechanisms, models can dynamically assign higher weights to these key features, thereby more accurately identifying different types of arrhythmias.

[0091] The basic process of attention mechanism is as follows:

[0092] Calculate attention weights: The outputs of the GRU hidden layers are weighted and summed to calculate the attention score at each time step. The calculation formula is:

[0093] e ij =tanh(W h h i +Ws s j )

[0094] Among them, e ij H represents the hidden state. i With the current input s j The relevance score, h i s is the output of the GRU hidden layer at time step i. j W is the value of the current input at time step j. h and W s It is the weight matrix used to calculate the attention score;

[0095] Normalized weights: The attention scores are normalized using the softmax function to obtain the attention weight distribution.

[0096]

[0097] Where, α ij This represents the attention weight at time j to time i.

[0098] Calculate the context vector: Apply the attention weights to the hidden layer output of the GRU to obtain the context vector.

[0099]

[0100] In this way, the attention mechanism can focus on the most important part of the ECG signal, improving classification accuracy.

[0101] 2.2.3 Fully Connected Layer and Output Layer: The output of the attention mechanism is passed through a fully connected layer and an output layer for classification. The output layer uses the softmax function to calculate the final classification probability.

[0102] y = softmax(W o c+b o )

[0103] Among them, W o It is the weight matrix of the fully connected layer, b o It is the bias vector of the fully connected layer;

[0104] With the above structure, the model can effectively extract and classify features in ECG signals, thereby identifying different types of arrhythmias.

[0105] Step 3: Train the ECG classification model

[0106] During the training of the ECG classification model, we input the ECG signal training set into the ECG classification model, which consists of a feature extraction and classification network. By comparing it with the correct labels, we calculate the accuracy of the detection model in classifying arrhythmias.

[0107] We use the cross-entropy loss function to measure the difference between the model output and the true label. For a given sample, let the probability distribution of the model output be p, and the probability distribution of the true label be q, then the cross-entropy loss function is defined as:

[0108]

[0109] Where i represents the index of the category, q i It is the probability of the true label, p i This represents the probability output by the model. During the optimization process, we used the RMSprop (Root Mean Square Propagation) optimization algorithm. RMSprop is a common variant of the stochastic gradient descent (SGD) optimization algorithm that adaptively adjusts the learning rate based on the exponentially weighted moving average of the squared gradient. Its parameter update rules are as follows:

[0110]

[0111] Where, θ t It is the parameter of the t-th iteration. It is the gradient of the loss function with respect to the parameters, η is the learning rate, β is the decay rate, and v is the gradient of the loss function with respect to the parameters. t It is the exponentially weighted moving average of the square of the gradient, and ∈ is a small constant added for numerical stability.

[0112] We iterate through training by calculating the cross-entropy loss function and using the RMSprop optimization algorithm for backpropagation to update the model parameters until we reach the set maximum number of training iterations. During training, we save the classification model with the highest accuracy during training as the optimal network model to ensure good performance on the test set.

[0113] Step 4: Test the ECG classification model

[0114] The ECG signal test set is input into the trained optimal network model to classify the test set data, and the classification results are compared with the corresponding labels on the test set. This completes the testing of the ECG classification model and yields the final classification accuracy.

Claims

1. A CNN-GRU-based ECG signal classification method based on an attention mechanism, characterized in that, Includes the following steps: S1: Collect ECG signals and perform resampling and preprocessing. S1.1 ECG signal acquisition: Select ECG signal data from the database; S1.2 ECG signal resampling: The original ECG signal data is segmented by using a sliding window to cover all segments; during the resampling process, the signal is first subjected to Fourier transform to obtain its spectral representation, then the spectrum is interpolated to adapt it to the target sampling frequency, and finally the spectrum is converted back to the time domain signal through inverse Fourier transform. S1.3 ECG signal annotation and preprocessing: The acquired ECG data is read using WFDB and annotated according to the AAMI standard; S1.4 Data Partitioning: The processed ECG signal dataset is randomly divided into a training set and a test set; S2: Constructing an ECG signal feature extraction and classification network Construct a comprehensive model consisting of a convolutional neural network and a gated recurrent unit; this model uses the convolutional neural network to extract features and the gated recurrent unit to perform classification. S2.1 Feature Extraction Convolutional Neural Network: The feature extraction network consists of a one-dimensional convolutional layer, a batch normalization layer, and a max pooling layer. Through local connectivity and weight sharing mechanisms, it processes the input data step by step and automatically extracts high-level features. Convolutional layer: Utilizing local connectivity and weight sharing, it performs convolution operations on the input signal to extract local features; the formula for the convolution operation is as follows: Where x is the input signal, w is the convolution kernel, y is the output signal, k is the kernel size, m is the position index of the output signal during the convolution operation, and n is the position index within the kernel; Batch normalization layer: Normalizes the output of the convolution layer. The formula for batch normalization is: in, The output is the normalized value, where μ and σ are the mean and standard deviation of the batch data, respectively, and ∈ is a small constant. Max pooling layer: This layer performs pooling operations on the normalized features. The formula for max pooling is: y[i] = max(x[m:m+p]) Where p is the size of the pooling window; S2.2 Arrhythmia Classification Network: A gated recurrent unit model is used for feature classification, and an attention mechanism module is introduced to capture the correlation between signals, thereby completing the classification of arrhythmia signals; The gated recurrent unit model updates the gates and resets the long-term dependencies in the gated time series, as shown in the following formula: z t =σ(W (z) x t +U (z) h t-1 ) r t =σ(W (r) x t +U (r) h t-1 ) Among them, z t To update the gate, r t To reset the door, h t In hidden state, For the candidate hidden state, x t Let W be the input at time step t, and let W be the weight matrix input to the update gate. (z) W is the weight matrix input to the reset gate. ( r ) Let U be the weight matrix of the candidate hidden state, and U be the weight matrix from the hidden state to the update gate. ( z ) U is the weight matrix from the hidden state to the reset gate. ( r ) Let be the weight matrix from the hidden state to the candidate hidden state, ° be the element-wise pointwise product, σ be the sigmoid activation function, and tanh be the hyperbolic tangent activation function. Attention mechanism: The attention mechanism calculates the degree of correlation between each element in the sequence and the current time step, and then weights the sequence elements according to the degree of correlation. Calculate attention weights: The outputs of the GRU hidden layers in the gated recurrent unit model are weighted and summed to calculate the attention score at each time step; the calculation formula is: e ij = tanh(W h h i +W s S j ) Among them, e ij H represents the hidden state. i With the current input s j The relevance score, h i For the output of the GRU hidden layer at time step i, s j W is the value of the current input at time step j. h and W s It is the weight matrix used to calculate the attention score; Normalized weights: The attention scores are normalized using the softmax function to obtain the attention weight distribution. Where, α ij This represents the attention weight at time j to time i; Calculate the context vector: Apply the attention weights to the hidden layer output of the GRU to obtain the context vector. Fully connected layer and output layer: The output of the attention mechanism is passed through a fully connected layer and an output layer for classification; the output layer uses a softmax function to calculate the final classification probability. y =softmax(W o c+b o ) Among them, W o It is the weight matrix of the fully connected layer, b o It is the bias vector of the fully connected layer; Through the above structure, the model extracts and classifies features in ECG signals, thereby identifying different types of arrhythmias; S3. Training the ECG classification model The cross-entropy loss function is used to measure the difference between the model output and the true label; for a given sample, the cross-entropy loss function is defined as: Where, q i It is the probability of the true label, p i It is the probability output by the model; The RMSprop optimization algorithm adaptively adjusts the learning rate based on the exponentially weighted moving average of the squared gradient; its parameter update rule is as follows: Where, θ t It is the parameter of the t-th iteration. It is the gradient of the loss function with respect to the parameters, η is the learning rate, β is the decay rate, and v is the gradient of the loss function with respect to the parameters. t It is the exponentially weighted moving average of the square of the gradient, where δ is a small constant used to prevent division by zero. The model parameters are updated by calculating the cross-entropy loss function and using the RMSprop optimization algorithm for backpropagation. The training is iterated until the maximum number of training iterations is reached. During the training process, the model with the highest classification accuracy is saved as the optimal network model.

2. The ECG signal classification method based on attention mechanism CNN-GRU according to claim 1, characterized in that, The databases in step S1 are the MIT-BIH arrhythmia database, the MIT-BIH ST variation database, the EU ST-T ECG database, and the dynamic ECG database for sudden cardiac death.

3. The ECG signal classification method based on attention mechanism CNN-GRU according to claim 1, characterized in that: In step S1.2, during resampling, the sliding window is 10 seconds, and the sampling frequency is set to 360Hz during Fourier transform; after resampling, the ECG signal is normalized into a signal segment with a length of 10 seconds and a sampling frequency of 360Hz.

4. The ECG signal classification method based on attention mechanism CNN-GRU according to claim 1, characterized in that, In step S1.3, the classification of data annotation includes N-normal, L-left bundle branch block, R-right bundle branch block, V-ventricular premature beats, and A-atrial premature beats.

Citation Information

Patent Citations

  • Multi-class arrhythmia detection method based on lead attention mechanism

    CN110890155A

  • Multi-feature fusion electrocardiosignal classification model modeling method based on attention mechanism

    CN113288163A