Method for identifying QRS waves in electrocardiosignals based on multi-task GRU network

Through the multi-task GRU network, QRS waves are divided into three subtasks and shared their features, which solves the problem of low recognition accuracy under the influence of signal quality and environmental interference in traditional methods, and realizes high-precision QRS wave recognition in complex scenarios.

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

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, when identifying QRS waves through traditional methods such as amplitude, slope, and threshold, they are easily affected by signal quality and environmental interference, resulting in low recognition accuracy.

Method used

Using the QRS wave recognition method based on multi-task GRU network, QRS waves are divided into three sub-tasks, corresponding to the recognition of R wave, Q wave and S wave, and features are extracted through the GRU feature sharing layer and shared with the three recognition sub-networks. Reduce the impact of signal quality and environmental interference on recognition accuracy.

Benefits of technology

Improve the recognition accuracy of QRS waves in complex scenarios, enhance robustness, and ensure efficient recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119074010A_ABST
    Figure CN119074010A_ABST
Patent Text Reader

Abstract

The invention discloses a method for recognizing QRS waves in electrocardiosignals based on a multi-task GRU network, relates to the technical field of electrocardiosignal recognition, and solves the technical problem that in the prior art, when the QRS waves are recognized through amplitude, slope, threshold and other traditional methods, the recognition precision is prone to being affected by signal quality and environment interference, and consequently the recognition precision of the QRS waves is low. A first recognition model sequentially comprises a GRU feature sharing layer and three recognition sub-networks, and each recognition sub-network sequentially comprises a full connection layer FC1, an activation layer, a full connection layer FC2 and a Softmax layer. The GRU feature sharing layer is used for extracting features of the electrocardiosignals and sharing the features to the three identification sub-networks; the three identification sub-networks are respectively used for identifying a Q wave, an R wave and an S wave; according to the technical scheme disclosed by the invention, the recognition precision of the QRS waves can be ensured under the complex conditions of low signal quality and relatively large environmental interference influence, and meanwhile, the robustness is better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The process of the generation, propagation and disappearance of cardiac excitement is accompanied by a series of potential changes, which are reflected to the body surface through the conductive tissues and body fluids around the heart. The waveform curve changes in each cardiac cycle on a normal electrocardiogram are regular, and the most important section is called the QRS wave. The steps of ECG signal waveform recognition often start with QRS waveform recognition.

[0003] The electrocardiogram (ECG) records the electrophysiological signals of the heart beat. Each beat can be divided into P wave, QRS complex, T wave, etc., which correspond to atrial depolarization activity, ventricular depolarization atrial repolarization activity, and ventricular repolarization activity, respectively. Among them, the QRS complex is the most obvious characteristic band of the electrophysiological signal of the heart beat. It reflects the myocardial activity during ventricular contraction and ejection, which is also the most important step in the heart pumping blood. The first downward wave in the QRS wave is the Q wave, the upward wave is the R wave, and the next downward wave is the S wave. In the prior art, it is generally identified through traditional methods such as amplitude, slope, and threshold. However, when the signal quality is low and the environmental interference is large, the accuracy of the traditional method of detecting the QRS wave is low.

[0004] The present application provides a QRS wave recognition method in an electrocardiogram signal based on a multi-task GRU network to solve the above technical problems. Summary of the invention

[0005] 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 QRS wave recognition method in an electrocardiogram signal based on a multi-task GRU network, which is used to solve the technical problem that when the prior art uses traditional methods such as amplitude, slope, threshold, etc. to recognize QRS waves, the recognition accuracy is easily affected by signal quality and environmental interference, resulting in low recognition accuracy of QRS waves. The present application divides the recognition of QRS waves into three subtasks, corresponding to R wave recognition, Q wave recognition, and S wave recognition, respectively. These three sub-networks share the characteristics of the cyclic network layer, and have high recognition accuracy and good robustness of QRS waves in complex scenarios.

[0006] To achieve the above objectives, the first aspect of the present application provides a QRS wave recognition method in an electrocardiogram signal based on a multi-task GRU network, comprising:

[0007] Acquire an electrocardiogram signal and mark it as an original signal; process the original signal through a bandpass filter to obtain a filtered signal;

[0008] Randomly intercept the filtered signal to obtain a number of samples; feature mark the positions in the number of samples as labels of the samples; divide the number of sample groups into a test set and a training set 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;

[0009] Constructing a first recognition model; training the first recognition model through a training set to obtain a target recognition model; wherein the first recognition model includes a GRU feature sharing layer and three recognition sub-networks, and the three recognition sub-networks are used for the recognition of Q waves, R waves and S waves respectively;

[0010] The recognition result of the target recognition model is evaluated for accuracy through a test set; after the accuracy evaluation is qualified, the target recognition model is saved for use in identifying the QRS wave in the electrocardiogram signal.

[0011] The first recognition model constructed in the present application includes a GRU feature sharing layer and three recognition sub-networks. The GRU feature sharing layer is constructed based on the GRU network, which is used to extract the features of the ECG signal. These features can be shared by the three recognition sub-networks; and the three recognition sub-networks respectively identify the Q wave, R wave and S wave in the ECG signal, and divide the QRS wave in the ECG signal into three sub-tasks, which can reduce the impact of signal quality and environmental interference on the recognition accuracy, that is, improve the recognition accuracy of the QRS wave in complex scenarios.

[0012] Preferably, the frequency range of the bandpass filter is [0.5 Hz-40 Hz].

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

[0014] Preferably, the three identification subnetworks include a Q wave identification subnetwork, an R wave identification subnetwork and an S wave identification subnetwork;

[0015] The output data of the GRU feature sharing layer is used as the input of the Q wave recognition sub-network for Q wave recognition in the QRS wave;

[0016] The output data of the GRU feature sharing layer is used as the input of the R wave recognition sub-network for R wave recognition in the QRS wave;

[0017] The output data of the GRU feature sharing layer is used as the input of the S wave recognition subnetwork for S wave recognition in the QRS wave.

[0018] The present application divides the QRS wave into three subtasks: Q wave, R wave and S wave, and sets three recognition subnetworks for these three subtasks, namely Q wave recognition subnetwork, R wave recognition subnetwork and S wave recognition subnetwork. The three recognition subnetworks share the features extracted by the GRU feature sharing layer, which are used to recognize Q wave, R wave and S wave respectively. Compared with the traditional method, the present application recognizes Q wave, R wave and S wave respectively by sharing features, which can effectively reduce the influence of signal quality or environmental interference on recognition accuracy.

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

[0020] Set standard parameters, including capture duration and sampling rate.

[0021] The filtered signal is randomly intercepted based on the standard parameters to obtain a number of samples, wherein the size of the samples is determined by the standard parameters.

[0022] Preferably, the setting of standard parameters includes:

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

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

[0025] The position of the characteristic wave in the sample is marked as Z1, and the other positions except the characteristic wave are marked as Z2; wherein Z1 and Z2 are both integers, and the characteristic wave includes a Q wave, an R wave or an S wave;

[0026] The characteristic wave and the position marks of other positions are used as labels of the sample; wherein each sample corresponds to three labels, and the size of the label is consistent with the corresponding sample.

[0027] Preferably, the parameters of the GRU feature sharing layer are set as follows: 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.

[0028] Preferably, the identification sub-network includes a fully connected layer FC1, an activation layer, a fully connected layer FC2 and a Softmax layer in sequence;

[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 feature sharing layer is modified before being input into 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] Softmax layer: The classification threshold is set to 0.7; when it is greater than 0.7, the output is 1, otherwise the output is 0.

[0033] Preferably, training the first recognition model using a training set includes:

[0034] The training set is input into the first recognition model for training, and during the training process, a binary cross entropy loss function is used to calculate a Q wave detection loss function, an R wave detection loss function, and an S wave detection loss function for each sample; the total loss function is the sum of the Q wave detection loss function, the R wave detection loss function, and the S wave detection loss function;

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

[0036] Preferably, the accuracy of the recognition result of the target recognition model is evaluated by using a test set, including:

[0037] Inputting the test set into the target recognition model, and running the target recognition model to obtain an output vector corresponding to the Q wave, R wave or S wave in the sample of the test set;

[0038] The output vector is compared with the label corresponding to the characteristic wave in the sample, and the accuracy is calculated; when the accuracy is greater than the set threshold, the accuracy evaluation is qualified.

[0039] Compared with the prior art, the beneficial effects of the present application are: the first recognition model of the present application includes a GRU feature sharing layer and three recognition sub-networks in sequence, and each recognition sub-network includes a fully connected layer FC1, an activation layer, a fully connected layer FC2 and a Softmax layer in sequence; the GRU feature sharing layer is used to extract the features of the electrocardiogram signal and share it with the three recognition sub-networks; the three recognition sub-networks are used to identify Q waves, R waves and S waves, respectively; the technical solution disclosed in the present application can ensure the recognition accuracy of the QRS wave even in complex situations where the signal quality is low and the environmental interference is large, and at the same time it has better robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] 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.

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

[0042] Figure 2 A schematic diagram of the network structure of the identification sub-network according to an embodiment of the present application. DETAILED DESCRIPTION

[0043] 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.

[0044] See also Figure 1-Figure 2 The first embodiment of the present application provides a QRS wave recognition method in an electrocardiogram signal based on a multi-task GRU network, comprising:

[0045] Obtaining the ECG signal and marking it as the original signal; processing the original signal through a bandpass filter to obtain a filtered signal;

[0046] 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;

[0047] Constructing a first recognition model; training the first recognition model through a training set to obtain a target recognition model; wherein the first recognition model includes a GRU feature sharing layer and three recognition sub-networks, and the three recognition sub-networks are used for the recognition of Q waves, R waves and S waves respectively;

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

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

[0050] 1) Obtain an ECG signal and mark it as an original signal; input the original signal into a designed bandpass filter for filtering to remove baseline drift and noise interference, and obtain a filtered signal. In this embodiment, the frequency range of the bandpass filter is [0.5 Hz-40 Hz].

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

[0052] 2) The interception time is set to 3s, and the sampling frequency of the ECG signal is set to 2000Hz; the filtered signal is randomly intercepted according to the set interception time and sampling frequency to obtain a number of samples; the size of each sample is 6000 (3×2000=6000).

[0053] 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.

[0054] 3) In this embodiment, the Q wave, R wave and S wave in the QRS wave are identified separately, and they need to be marked separately, so the same sample will correspond to three labels. Specifically:

[0055] First, the Q wave is used as the characteristic wave, the position of the Q wave in the sample is marked as 1, and the positions of other positions (including R wave and S wave) are marked as 0, and each position mark is used as a set of labels for the sample;

[0056] Then, the R wave is used as the characteristic wave, the position of the R wave in the sample is marked as 1, and the positions of other positions (including Q wave and S wave) are marked as 0, and each position mark is used as a set of labels for the sample;

[0057] Finally, the S wave is used as the characteristic wave, the position of the S wave in the sample is marked as 1, and the positions of other positions (including Q wave and R wave) are marked as 0, and the position marks are used as a set of labels for the sample;

[0058] In this embodiment, the other positions refer to the positions in the sample except the characteristic wave. In this way, three labels corresponding to one sample can be obtained, and the size of each label is consistent with the sample size. In this embodiment, the sample size is 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) The first recognition model is constructed according to the structure of GRU feature sharing layer → three recognition sub-networks. The recognition sub-network is constructed in series according to the fully connected layer FC1 → activation layer → fully connected layer FC2 → Softmax layer. The specific parameter settings include:

[0061] The parameters of the GRU feature sharing layer are set as follows: 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; the dimension of the input data of this layer is [8, 6000, 1]; the dimension of the output data is [8, 6000, 4], and the dimension of the output hidden layer data is [1, 8, 4];

[0062] Fully connected layer FC1: the number of input features is set to 24000, and the number of output features is set to 12000;

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

[0064] Fully connected layer FC2: the number of input features is set to 12000, and the number of output features is set to 6000;

[0065] Softmax layer: The classification threshold is set to 0.7; when it is greater than 0.7, the output is 1, otherwise the output is 0.

[0066] The output data of the GRU feature sharing layer is used as the input data of the recognition subnetwork. The input data dimension is [8,6000,4], and the data dimension is modified to [8,24000]; after passing through the fully connected layer FC1, the data dimension becomes [8,12000]; after passing through the activation layer, the data dimension remains unchanged; after passing through the fully connected layer FC2, the data dimension becomes [8,6000]; after passing through the Softmax layer, the data dimension remains unchanged, and the classification threshold is set to 0.7, that is, the output greater than 0.7 is 1; otherwise the output is 0.

[0067] The first downward wave in the QRS wave is the Q wave, the upward wave is the R wave, and the downward wave is the S wave. According to these features, the Q wave, R wave, and S wave can be identified respectively. In this embodiment, a feature sharing layer is constructed based on GRU, and three recognition sub-networks are constructed at the same time. These three recognition sub-networks are used to identify Q waves, R waves, and S waves, respectively, and these three recognition sub-networks share the features extracted by the GRU feature sharing layer. The first recognition model can achieve good end-to-end training. At the same time, compared with traditional recognition methods such as thresholds, slopes, amplitudes, etc., the target recognition model obtained by training the first recognition model in this embodiment realizes high-precision recognition of QRS waves when the signal quality is low and the environmental interference is large.

[0068] 6) Network training; input the training set into the first recognition model for training, and use the binary cross entropy loss function to calculate the Q wave detection loss function, R wave detection loss function and S wave detection loss function for each sample during the training process; the total loss function is the sum of the Q wave detection loss function, the R wave detection loss function and the S wave detection loss function; use the Adam optimizer to optimize the network parameters of the first recognition model until the loss value and accuracy rate stabilize near a certain value, then stop training; save the network parameters and model structure information of the current first recognition model to obtain the target recognition model.

[0069] 7) Network test: Input all the divided test set samples into the saved target recognition model, run the target recognition model to obtain the prediction value vector output y_pred_Q, y_pred_R, y_pred_S corresponding to the test set samples, and compare the QRS wave time point with the label corresponding to the sample to calculate the accuracy. If the average accuracy is 99%, set the threshold to 97%, because 99%>97%, the accuracy is qualified; of course, you can also compare the accuracy of each characteristic wave.

[0070] 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.

[0071] 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 multi-task GRU network, characterized in that: include: The acquired electrocardiogram signal is processed by a bandpass filter to obtain a filtered signal; wherein the frequency range of the bandpass filter is [0.5 Hz-40 Hz]; 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 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; The constructed first recognition model is trained by the training set to obtain a target recognition model; wherein the first recognition model includes a GRU feature sharing layer and three recognition sub-networks, and the three recognition sub-networks are used for the recognition of Q waves, R waves and S waves respectively; The target recognition model is evaluated through a test set, and after passing the evaluation, the target recognition model is saved for use in identifying the QRS wave in the electrocardiogram signal.

2. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: The three identification subnetworks include a Q wave identification subnetwork, an R wave identification subnetwork and an S wave identification subnetwork; The output data of the GRU feature sharing layer is used as the input of the Q wave recognition sub-network for Q wave recognition in the QRS wave; The output data of the GRU feature sharing layer is used as the input of the R wave recognition sub-network for R wave recognition in the QRS wave; The output data of the GRU feature sharing layer is used as the input of the S wave recognition subnetwork for S wave recognition in the QRS wave.

3. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: Randomly intercepting the filtered signal, comprising: Set standard parameters, including capture duration and sampling rate. The filtered signal is randomly intercepted based on the standard parameters to obtain a number of samples, wherein the size of the samples is determined by the standard parameters.

4. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 3 is characterized in that: The setting of standard parameters includes: Set the capture duration to 3s and the sampling frequency to 2000Hz.

5. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: The feature marking of the positions in the samples comprises: The position of the characteristic wave in the sample is marked as Z1, and the other positions except the characteristic wave are marked as Z2; wherein Z1 and Z2 are both integers, and the characteristic wave includes a Q wave, an R wave or an S wave; The characteristic wave and the position marks of other positions are used as labels of the sample; wherein each sample corresponds to three labels, and the size of the label is consistent with the corresponding sample.

6. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: The parameters of the GRU feature sharing layer are set as follows: 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.

7. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: The identification sub-network includes a fully connected layer FC1, an activation layer, a fully connected layer FC2 and a Softmax layer in sequence; 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 feature sharing layer is modified before being input into 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; Softmax layer: The classification threshold is set to 0.

7.

8. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: Training the first recognition model using a training set includes: The training set is input into the first recognition model for training, and during the training process, a binary cross entropy loss function is used to calculate a Q wave detection loss function, an R wave detection loss function, and an S wave detection loss function for each sample; the total loss function is the sum of the Q wave detection loss function, the R wave detection loss function, and the S wave detection loss function; The Adam optimizer is used to optimize the network parameters of the first recognition model until the loss value and accuracy rate tend to be stable, and the training is stopped; the network parameters and model structure information of the current first recognition model are saved to obtain the target recognition model.

9. The QRS wave recognition method in the electrocardiogram signal based on the multi-task GRU network according to claim 1 is characterized in that: The object recognition model is evaluated using a test set, including: Inputting the test set into the target recognition model, and running the target recognition model to obtain an output vector corresponding to the Q wave, R wave or S wave in the sample of the test set; The output vector is compared with the label corresponding to the characteristic wave in the sample, and the accuracy is calculated; when the accuracy is greater than the set threshold, the accuracy evaluation is qualified.