Method for identifying QRS waves in electrocardiosignals based on GRU network

The GRU network with a fully connected layer and signal preprocessing improves QRS wave recognition accuracy in ECG signals by ensuring all features are utilized, addressing gradient vanishing and enhancing long-term dependency capture.

CN119097323APending Publication Date: 2024-12-10SHANGHAI SHINEYO MEDICAL (GRP) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411108811.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Existing methods for identifying QRS waves in ECG signals suffer from reduced accuracy due to insufficient feature recognition during data compression and small input feature numbers, which affects the analysis of electrocardiographic signals.

Method used

A method using a GRU network with a fully connected layer between the GRU layer and activation layer to process ECG signals, combined with preprocessing through high-pass and low-pass filters to enhance signal quality, ensuring all features are utilized for training, thereby improving recognition accuracy.

Benefits of technology

The proposed method enhances QRS wave recognition accuracy by addressing gradient vanishing issues and capturing long-term dependencies, resulting in improved feature recognition and cleaner signal processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119097323A_ABST
    Figure CN119097323A_ABST
Patent Text Reader

Abstract

The invention discloses a method for recognizing QRS waves in electrocardiosignals based on a GRU network, relates to the technical field of electrocardiosignal recognition, and solves the problems that in the prior art, in the ECG data set compression and transformation process, the accuracy of feature recognition is insufficient when an ECG data set of a time sequence is processed, the number of features input into a recurrent neural network after compression is small, and the recognition accuracy is poor. The accuracy of electrocardiosignal analysis is influenced. A basic recognition model constructed by the method sequentially comprises a GRU layer, a full connection layer FC1, an activation layer and a full connection layer FC2; the GUR layer is constructed by using the GRU network, so that the gradient disappearance problem can be solved, the long-term dependency relationship in the sequence data can be captured, and the recognition accuracy and the recognition efficiency are improved; the full connection layer FC1 is arranged in the GRU layer and the activation layer, so that the size of an input sample can be increased, compression of input data is avoided, and the recognition accuracy of the QRS waves is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electrocardiogram signal recognition, and specifically to a method for recognizing QRS waves in electrocardiogram signals based on a GRU network. Background Art

[0002] ECG signals are signals that record the electrophysiological activity of the heart over a period of time, which can reflect the physiological information of the heart. ECG signals are usually presented in the form of waveforms (i.e., electrocardiograms). During cardiac electrophysiological surgery, it is necessary to monitor the surface ECG signals in real time and accurately display the QRS waves. Cardiac electrophysiological activity is a complex process, and some states are sporadic. ECG signals are easily interfered with by the external environment during the detection process. For example, slight body movements of the patient will affect the electrodes, which will cause baseline drift, electromyographic interference, power frequency interference, large motion artifacts, and other problems, which will seriously reduce the recognition accuracy of the QRS wave.

[0003] Common QSR wave detection algorithms are mainly divided into two categories: based on traditional algorithms and based on deep neural network algorithms. Based on the principle, traditional algorithms can be divided into threshold detection-based methods, template matching-based methods, and wavelet transform-based methods. Based on the network structure, deep neural network algorithms can be divided into detection algorithms based on convolutional neural networks and detection algorithms based on recurrent neural networks. ECG signals are a typical time series, so detection algorithms based on recurrent neural networks are more suitable.

[0004] The invention patent application with publication number CN113197583A discloses an electrocardiogram waveform segmentation method based on time-frequency analysis and recurrent neural network. The method processes the ECG data set through Fourier synchronous compression transform, shuffles each group of data in the processed ECG data set and divides it into training set and test set according to a preset ratio, and trains the recurrent neural network through the training set and the test set. In the process of compressing and transforming the ECG data set, the application fails to accurately identify the features when processing the ECG data set of the time series, because the Fourier synchronous compression transform is a global transformation, and the number of features input to the recurrent neural network after compression is small, which affects the accuracy of the ECG signal analysis.

[0005] The present application provides a method for identifying QRS waves in electrocardiogram signals based on a GRU network to solve the above technical problems. Summary of the invention

[0006] The present application aims to solve at least one of the technical problems existing in the prior art; to this end, the present application proposes a method for identifying QRS waves in electrocardiographic signals based on a GRU network, which is used to solve the technical problems that the prior art, in the process of compressing and transforming the ECG data set, will lead to insufficient accuracy of feature recognition when processing the ECG data set of the time series, and the number of features input to the recurrent neural network after compression is small, which affects the accuracy of the electrocardiographic signal analysis. The present application redesigns the structure of the basic recognition model, that is, sets a fully connected layer between the GRU layer and the activation layer, and avoids the compression of the number of features through the fully connected layer, thereby improving the accuracy of the QRS wave; at the same time, the basic recognition model is more prominent than the recurrent neural network in capturing the long-term dependency in the sequence data, which can improve the accuracy of feature recognition.

[0007] To achieve the above objectives, the first aspect of the present application provides a method for identifying QRS waves in an electrocardiogram signal based on a GRU network, comprising:

[0008] Acquire a body surface ECG signal and mark it as an original signal; preprocess the original signal to obtain a filtered signal; wherein the preprocessing is achieved by connecting a high-pass filter and a low-pass filter in series;

[0009] Randomly intercept the filtered signal to obtain a number of samples; feature mark the positions in the samples as labels of the samples; divide the sample groups into test sets and training sets according to a set ratio; wherein the size of the sample is determined by the sampling duration and the sampling rate, and the sample group includes the sample and the label corresponding to the sample;

[0010] Constructing a basic recognition model, and training the basic recognition model through a training set to obtain a QRS recognition model; wherein the basic recognition model includes a GRU layer, a fully connected layer FC1, an activation layer, and a fully connected layer FC2 in sequence;

[0011] The QRS recognition model is evaluated using a test set, and the QRS recognition model is saved after passing the evaluation.

[0012] Preferably, preprocessing the original signal includes:

[0013] The original signal is input into a high-pass filter for high-pass filtering to obtain an intermediate signal; wherein the high-pass filter is an IIR type with a cutoff frequency of 0.5 Hz;

[0014] The intermediate signal is input into a low-pass filter for low-pass filtering to obtain a filtered signal; wherein the low-pass filter is of IIR type and has a cut-off frequency of 30 Hz.

[0015] The typical spectrum of the QRS complex wave is centered at about 10-25Hz, and its components are lower than 40Hz, and the frequency of P wave and T wave is even lower, with P wave components lower than 20Hz and T wave components lower than 10Hz. The baseline drift caused by the patient's respiratory movement is a low-frequency (<0.5Hz) oscillation, which is independent of the heartbeat morphology and does not provide meaningful information for QRS wave identification. Therefore, the pre-processing of the present application is realized by the series connection of a high-pass filter and a low-pass filter. The high-pass filter is an IIR type with a cut-off frequency of 0.5Hz, and its function is to resist baseline drift; the low-pass filter is an IIR type with a cut-off frequency of 30Hz, and its function is to resist noise interference, so that the signal is clean, which is conducive to the identification of subsequent QRS waves.

[0016] Preferably, randomly intercepting the filtered signal comprises:

[0017] Set the setting parameters; wherein the setting parameters include the interception time and the sampling rate;

[0018] The filtered signal is randomly intercepted based on the set parameters to obtain a number of samples; wherein the size of the samples is determined by the set parameters.

[0019] Preferably, the setting parameters include:

[0020] Set the capture duration to 3s and the sampling frequency to 2000Hz.

[0021] The sample size is determined by the set parameters. If the capture time is 3s and the sampling frequency is 2000H, the sample size is 3×2000=6000.

[0022] Preferably, the step of marking the positions in the plurality of samples includes:

[0023] The positions of the Q wave, R wave and S wave in the sample are marked as W1, W2 and W3 respectively, and the positions other than the Q wave, R wave and S wave are marked as W4; wherein W1, W2, W3 and W4 are all integers;

[0024] The position marks of the Q wave, R wave, S wave and other positions in the sample are used as labels of the sample; wherein the label is consistent with the size of the corresponding sample.

[0025] The purpose of this application is to identify the QRS wave in the ECG signal. Therefore, each sample needs to be marked, that is, the QRS wave in the ECG signal is distinguished from other signals, and the mark is used as the sample label of the corresponding sample and as the training data of the basic recognition model.

[0026] Preferably, the set ratio includes 4:1 or 3:2.

[0027] Preferably, setting the network parameters of the basic recognition model includes:

[0028] GRU layer: The signal length of the input signal is 6000, the batch size is set to 8, the number of hidden layer features is set to 4, and the nonlinear function is set to tanh; the GRU function in PyTorch is used, and batch_first is set to True;

[0029] Fully connected layer FC1: The number of input features is set to 24000, and the number of output features is set to 12000. The output data of the GRU layer is modified before being input to the fully connected layer FC1.

[0030] Activation layer: Use ReLU activation function, the dimensions of input data and output data remain unchanged;

[0031] Fully connected layer FC2: The number of input features is set to 12000 and the number of output features is set to 6000.

[0032] The GRU network used in this application is a variant of the recurrent neural network. Compared with the traditional recurrent neural network, the GRU network not only solves the gradient vanishing problem, but also performs better in capturing long-term dependencies in sequence data. It is a more efficient and faster training RNN variant.

[0033] The present application sets a fully connected layer FC1 between the GUR layer and the activation layer of the basic recognition model. The fully connected layer FC1 ensures the size of the input signal, avoids the influence of signal compression on the model recognition accuracy, and thus improves the recognition accuracy of the QRS wave in the electrocardiogram signal.

[0034] Preferably, training the basic recognition model through a training set includes:

[0035] Inputting the training set into the basic recognition model for training, and using the L2 loss function to calculate the loss value of each sample during the training process;

[0036] The Adam optimizer is used to optimize the network parameters of the basic recognition model until the loss value and the accuracy rate tend to be stable, and the training is stopped; the network parameters and model structure information of the current basic recognition model are saved to obtain the QRS recognition model.

[0037] Preferably, the QRS recognition model is evaluated by a test set, including:

[0038] Input the test set into the QRS recognition model, and run the QRS recognition model to obtain an output vector corresponding to the sample in the test set;

[0039] The output vector is compared with the QRS wave time point of the sample corresponding label to calculate the accuracy; when the accuracy is greater than the set threshold, the accuracy evaluation is qualified.

[0040] Compared with the prior art, the beneficial effects of this application are:

[0041] 1. The basic recognition model constructed in this application includes a GRU layer, a fully connected layer FC1, an activation layer and a fully connected layer FC2 in sequence; using the GRU network to construct the GRU layer can not only solve the gradient vanishing problem, but also capture the long-term dependencies in the sequence data, thereby improving the recognition accuracy and efficiency; setting the fully connected layer FC1 in the GRU layer and the activation layer can increase the input sample size, avoid compressing the input data, and thus improve the recognition accuracy of the QRS wave.

[0042] 2. This application preprocesses the original signal by connecting a high-pass filter and a low-pass filter in series. The high-pass filter can resist baseline drift, and the low-pass filter can remove noise. After preprocessing, the original signal can be made cleaner, thereby improving the recognition accuracy of the QRS wave by the QRS recognition model. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 This is a schematic diagram of the network structure of the basic recognition model in the embodiment of the present application;

[0045] Figure 2 This is a schematic diagram of the original signal preprocessing process in an embodiment of the present application;

[0046] Figure 3 This is a waveform comparison diagram of the original signal before and after preprocessing in the embodiment of the present application. DETAILED DESCRIPTION

[0047] The technical solution of the present application will be described clearly and completely in conjunction with the embodiments below. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0048] See also Figures 1 to 3The first embodiment of the present application provides a method for identifying QRS waves in an electrocardiogram signal based on a GRU network, comprising:

[0049] Acquire the surface ECG signal and mark it as the original signal; pre-process the original signal to obtain a filtered signal; wherein the pre-processing is achieved by connecting a high-pass filter and a low-pass filter in series;

[0050] Randomly intercept the filtered signal to obtain several samples; feature mark the positions in the several samples as labels of the samples; divide the several sample groups into test sets and training sets according to a set ratio; wherein the size of the sample is determined by the sampling duration and the sampling rate, and the sample group includes the sample and the label corresponding to the sample;

[0051] Construct a basic recognition model, train the basic recognition model through the training set, and obtain a QRS recognition model; wherein the basic recognition model includes a GRU layer, a fully connected layer FC1, an activation layer, and a fully connected layer FC2 in sequence;

[0052] The recognition results of the QRS recognition model are evaluated for accuracy using the test set; after the accuracy evaluation is qualified, the QRS recognition model is saved and used to recognize the QRS wave in the electrocardiogram signal.

[0053] Next, the workflow of the QRS wave recognition method in the electrocardiogram signal based on the GRU network proposed in this application is described in detail.

[0054] 1) Obtain the surface ECG signal and mark it as the original signal Y0; input the original signal Y0 into a high-pass filter with a cutoff frequency of 0.5 Hz for filtering to resist baseline drift, and mark the filtered signal as signal Y1; then input the signal Y1 into a low-pass filter with a cutoff frequency of 30 Hz to resist noise interference, and mark the filtered signal as signal Y2.

[0055] It should be noted that the surface ECG signal can be obtained through an electrocardiograph or a wearable device, and of course the surface ECG signal data stored in an existing database can also be used.

[0056] 2) Set the interception time to 3s and the sampling frequency of the ECG signal to 2000Hz; randomly intercept the signal Y2 according to the set interception time and sampling frequency to obtain several samples Y3; the size of each sample Y3 is 6000.

[0057] It should be noted that the random interception of the signal specifically refers to determining the interception window according to the interception duration, randomly selecting a starting point in the continuous ECG signal, and then determining the signal segment according to the interception window, and then extracting the sampling points in the signal segment according to the sampling rate. Specifically in this embodiment, the interception window is randomly determined in the signal with a length of 3s, and then the sampling points are extracted in the interception window according to the sampling rate of 2000Hz, and a total of 6000 sampling points can be extracted from each interception window.

[0058] 3) Mark the positions of the Q wave, R wave and S wave in each sample Y3 as 1, 2, and 3 respectively, and mark the positions of other non-Q waves, R waves and S waves in sample Y3 as 0, and use these position marks as the label of the sample Y3. Obviously, the label size is the same as the size of sample Y3, both of which are 6000.

[0059] 4) Take each sample and its corresponding label as a sample group, and divide the sample group according to the set ratio to obtain the training set and the test set. The optimal ratio is 4:1, that is, the ratio of the number of sample groups in the training set and the test set is 4:1. Of course, other ratios can also be selected, such as 3:2.

[0060] 5) Construct the basic recognition model according to the structure of GRU layer → fully connected layer FC1 → activation layer → fully connected layer FC2. Specifically:

[0061] GRU layer: The input signal length is set to 6000, the batch size is set to 8, the number of hidden layer features is set to 4, the nonlinear function is set to tanh, and the GRU function in pytorch is used, where batch_first is set to True, the input data Y3 dimension is [8, 6000, 1]; the output data Y4 dimension is [8, 6000, 4], and the output hidden layer data dimension is [1, 8, 4];

[0062] Fully connected layer FC1: Change the data dimension of input data Y4 to [8, 24000], set the number of input features to 24000, and the number of output features to 12000. Then the dimension of the output data Y5 of this layer is [8, 12000].

[0063] Activation layer: Use ReLU activation function, the input data is Y5, after passing the activation function, the output data is Y6, and the dimension remains unchanged;

[0064] Fully connected layer FC2: The input data is Y6, the number of input features is set to 12000, and the number of output features is set to 6000. The dimension of the output data Y7 of this layer is [8, 6000].

[0065] See also Figure 1, the input signal passes through the GRU layer, the fully connected layer FC1, the activation layer, and the fully connected layer FC2 in sequence to obtain the output signal. It can be understood that the input signal here refers to the sample.

[0066] It is worth noting that the basic recognition model built in this embodiment is mainly composed of a GRU layer + two fully connected layers + an activation layer. Compared with the prior art, this application adds a fully connected layer between the GRU layer and the activation layer. Through this fully connected layer, it can be ensured that all the extracted sample features can be used to train the model, and there is no need to compress the features. The more features are trained, the more accurate and reliable the model can be.

[0067] Moreover, ECG signals are a kind of time series. Using recurrent neural network (RNN) to process time series has a natural advantage over convolutional neural network (CNN) models. Gated recurrent unit (GRU) is a variant of RNN, which is used to process sequence data. Compared with traditional RNN, GRU not only solves the problem of gradient disappearance, but also performs better in capturing long-term dependencies in sequence data. GRU model is more lightweight and has faster recognition speed.

[0068] In some other preferred embodiments, in order to improve the recognition effect of the basic recognition model on the QRS wave in the electrocardiogram signal, the activation layer (using the ReLU activation function) and the fully connected layer FC3 can be further connected after the fully connected layer FC2, and the specific parameters are set according to the actual input data and the required output data.

[0069] 6) Network training; input the training set into the basic recognition model for training, and use the L2 loss function to calculate the loss value of each sample during the training process; use the Adam optimizer to optimize the network parameters of the basic recognition model until the loss value and accuracy are stable near a certain value, then stop the training; save the network parameters and model structure information of the current basic recognition model to obtain the QRS recognition model.

[0070] 7) Network test: Input all the divided test set samples into the saved QRS recognition model, run the QRS recognition model to obtain the prediction value vector output y_pred corresponding to the sample in the test set, compare the QRS wave time point with the sample label, and calculate the accuracy. If the accuracy is 99%, set the threshold to 98%, because 99%>98%, so the accuracy is qualified.

[0071] In this embodiment, since the signal sampling rate is 2000Hz, if the predicted value appears in a window with a total length of 600 centered on each of the marked QRS points, it is accurate. This accuracy evaluation method refers to the American national standard formulated by the Association for the Advancement of Medical Devices, that is, if the QRS wave detection point obtained by the algorithm is within 150ms before and after the marked position, it can be determined that the detected QRS wave position is accurate. Specifically, 150ms before and after the QRS wave detection point, that is, the time window length that can be allowed for the detection point to be accurately determined is 150*2=300ms, that is, 0.3s. Since the sampling rate is 2000hz, the number of sampling points corresponding to 0.3s is: 2000*0.3=600, that is, the sampling window length that can be allowed for the detection point to be accurately determined is 600.

[0072] The above embodiments are only used to illustrate the technical method of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical method of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present application.

Claims

1. A QRS wave recognition method in an electrocardiogram signal based on a GRU network, characterized in that: include: Acquire a body surface ECG signal and mark it as an original signal; preprocess the original signal to obtain a filtered signal; wherein the preprocessing is achieved by connecting a high-pass filter and a low-pass filter in series; The filtered signal is randomly intercepted to obtain several samples; the positions in the several samples are marked with features as labels of the samples; the several sample groups are divided into a test set and a training set according to a set ratio; wherein the sample group includes the sample and the label corresponding to the sample, and the set ratio is 4:1 Constructing a basic recognition model, and training the basic recognition model through a training set to obtain a QRS recognition model; wherein the basic recognition model includes a GRU layer, a fully connected layer FC1, an activation layer, and a fully connected layer FC2 in sequence; The QRS recognition model is evaluated using a test set, and the QRS recognition model is saved after passing the evaluation.

2. The method for identifying QRS waves in electrocardiographic signals based on a GRU network according to claim 1, characterized in that: Preprocessing the original signal includes: The original signal is input into a high-pass filter for high-pass filtering to obtain an intermediate signal; wherein the high-pass filter is an IIR type with a cutoff frequency of 0.5 Hz; The intermediate signal is input into a low-pass filter for low-pass filtering to obtain a filtered signal; wherein the low-pass filter is of IIR type and has a cut-off frequency of 30 Hz.

3. The QRS wave recognition method in the electrocardiogram signal based on the GRU network according to claim 1 is characterized in that: Randomly intercepting the filtered signal comprises: Set the setting parameters; wherein the setting parameters include the interception time and the sampling rate; The filtered signal is randomly intercepted based on the set parameters to obtain a number of samples; wherein the size of the samples is determined by the set parameters.

4. The method for identifying QRS waves in electrocardiographic signals based on a GRU network according to claim 3, characterized in that: The setting parameters include: Set the capture duration to 3s and the sampling frequency to 2000Hz.

5. The method for identifying QRS waves in electrocardiographic signals based on a GRU network according to claim 1, characterized in that: The feature marking of the positions in the samples comprises: The positions of the Q wave, R wave and S wave in the sample are marked as W1, W2 and W3 respectively, and the positions other than the Q wave, R wave and S wave are marked as W4; wherein W1, W2, W3 and W4 are all integers; The position marks of the Q wave, R wave, S wave and other positions in the sample are used as labels of the sample; wherein the label is consistent with the size of the corresponding sample.

6. The method for identifying QRS waves in electrocardiographic signals based on a GRU network according to claim 1, characterized in that: Setting the network parameters of the basic recognition model includes: GRU layer: The signal length of the input signal is 6000, the batch size is set to 8, the number of hidden layer features is set to 4, and the nonlinear function is set to tanh; the GRU function in PyTorch is used, and batch_first is set to True; Fully connected layer FC1: The number of input features is set to 24000, and the number of output features is set to 12000. The output data of the GRU layer is modified before being input to the fully connected layer FC1. Activation layer: Use ReLU activation function, the dimensions of input data and output data remain unchanged; Fully connected layer FC2: The number of input features is set to 12000 and the number of output features is set to 6000.

7. The method for identifying QRS waves in electrocardiographic signals based on a GRU network according to claim 1, characterized in that: The basic recognition model is trained by a training set, including: Inputting the training set into the basic recognition model for training, and using the L2 loss function to calculate the loss value of each sample during the training process; The Adam optimizer is used to optimize the network parameters of the basic recognition model until the loss value and the accuracy rate tend to be stable, and the training is stopped; the network parameters and model structure information of the current basic recognition model are saved to obtain the QRS recognition model.

8. The method for identifying QRS waves in electrocardiographic signals based on a GRU network according to claim 1, characterized in that: The QRS recognition model is evaluated using a test set, including: Input the test set into the QRS recognition model, and run the QRS recognition model to obtain an output vector corresponding to the sample in the test set; The output vector is compared with the QRS wave time point of the sample corresponding label to calculate the accuracy; when the accuracy is greater than the set threshold, the accuracy evaluation is qualified.

Citation Information

Patent Citations

  • Electrocardiogram waveform segmentation method based on time-frequency analysis and recurrent neural network

    CN113197583A