Method for detecting R peak in ECG signal under high-intensity motion condition

By combining LSTM and CNN to process ECG signals, and performing Fourier transform and wavelet transform, the problem of degradation of R peak detection accuracy under high-intensity motion conditions is solved, achieving higher detection accuracy and stability.

CN119632574AInactive Publication Date: 2025-03-18BEIJING SPORT UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411681756.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Under high-intensity motion conditions, the noise and motion artifacts in the ECG signal significantly increase, which greatly reduces the accuracy and robustness of the traditional R-peak detection method.

Method used

The ECG signal is processed by combining long and short-term memory network (LSTM) and convolutional neural network (CNN). The training set is constructed by simulating multiple noise types and performing Fourier transform and wavelet transform, and the detection results are corrected through adaptive post-processing.

Benefits of technology

It significantly improves the accuracy and stability of R peak position detection, improves the robustness of the model to noise, and can achieve more accurate and stable signal processing in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119632574A_ABST
    Figure CN119632574A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of signal processing, in particular to a method for detecting an R peak in an ECG signal under a high-intensity motion condition, which comprises the following steps of: simulating a plurality of noise types, and randomly adding the noise types into a motion ECG signal to obtain an ECG signal containing a plurality of noises; fourier transform and wavelet transform are carried out on the ECG signals containing the noise to obtain time-frequency representation of the signals, and a training set is constructed based on the time-frequency representation of the signals; constructing an R peak detection model based on the BILSTM network and the CNN network, and training the R peak detection model by using the training set; carrying out R peak detection on a to-be-detected ECG signal based on the trained R peak detection model; and the detected R peak is corrected through self-adaptive post-processing. According to the invention, the accuracy of R peak position detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of signal processing, and more particularly to a method for detecting R peaks in ECG signals under high-intensity exercise conditions. Background Art

[0002] In the field of electrocardiogram (ECG) processing, R-peak detection is a key step in ECG analysis. The R-peak, which is the apex of the R wave of the QRS complex in the ECG, is a sign of electrical activity for each heartbeat. Accurate detection of the R-peak is critical for heart rate monitoring, arrhythmia diagnosis, and other heart health assessments. Traditional R-peak detection methods usually rely on threshold determination, template matching, or other signal processing techniques, which perform well in static or low-intensity exercise states. However, under high-intensity exercise conditions, the noise and motion artifacts in the ECG signal increase significantly, which greatly reduces the accuracy and robustness of traditional methods.

[0003] In recent years, the rapid development of deep learning technology has brought new opportunities to areas that are difficult to solve with traditional methods. In particular, long short-term memory networks (LSTM) and convolutional neural networks (CNN) have performed well in processing complex time series data and extracting high-dimensional features. LSTM can capture long-term dependencies in time series, while CNN is good at extracting local features. However, a single signal processing technology is often difficult to fully cope with the complex signal characteristics under high-intensity exercise.

[0004] Therefore, how to combine the two technologies of long short-term memory network and convolutional neural network to detect R peak and improve the detection accuracy has become a problem that technical personnel in this field need to solve urgently. Summary of the invention

[0005] In view of this, the present invention provides a method for detecting R peaks in ECG signals under high-intensity exercise conditions, thereby improving the accuracy of R peak position detection.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] A method for detecting R peaks in ECG signals under high-intensity exercise conditions, characterized in that it comprises the following steps:

[0008] Simulate various noise types and randomly add them to the sports ECG signal to obtain an ECG signal containing various noises;

[0009] Perform Fourier transform and wavelet transform on the ECG signal containing noise to obtain the time-frequency representation of the signal, and construct a training set based on the time-frequency representation of the signal;

[0010] An R-peak detection model is constructed based on the BILSTM network and the CNN network, and the R-peak detection model is trained using the training set;

[0011] Perform R peak detection on the ECG signal to be detected based on the trained R peak detection model;

[0012] The detected R peak is corrected by adaptive post-processing.

[0013] Further, various noise types can be simulated by:

[0014] Simulate baseline drift noise, whose amplitude varies randomly in the range of 0 to 10;

[0015] simulated muscle artifact noise, whose amplitude varies in a random range from 0 to 5;

[0016] Simulate power disturbances, whose amplitude varies randomly in the range of 0 to 5;

[0017] The above three noise types are randomly mixed and added to the sports ECG signal.

[0018] Further, the ECG signal containing noise is subjected to Fourier transform and wavelet transform to obtain a time-frequency representation of the signal, including:

[0019] The ECG signal containing noise is converted from the time domain to the frequency domain through Fourier transform to identify the periodic components and frequency patterns in the signal;

[0020] The ECG signal containing noise is analyzed locally at different time scales and locations through wavelet transform, the changes of the signal in different frequency ranges are captured, and the transient characteristics and change patterns in the signal are identified;

[0021] The signals after Fourier transform and wavelet transform are fused to obtain the time-frequency representation of the signal.

[0022] Furthermore, the R peak detection model is trained using the training set, including:

[0023] Extract complex time series features and dynamic changes in training sample signals through BILSTM network;

[0024] Extract local waveform features and potential abnormal patterns in training sample signals through CNN network;

[0025] The features extracted by the BILSTM network and the CNN network are fused to obtain the fused feature representation;

[0026] Perform R peak detection on the fusion feature representation to obtain the prediction result;

[0027] The difference between the predicted result and the true label is measured by the cross entropy loss function;

[0028] The network parameters are updated through the back propagation algorithm to optimize the network parameters of the R-peak detection model until the R-peak prediction results meet the preset requirements.

[0029] Furthermore, the detected R peak is corrected by an adaptive R peak filter.

[0030] Furthermore, when multiple R peaks are detected, the adaptive R peak filter eliminates false peaks by retaining the R peak with the highest detection probability.

[0031] Furthermore, when the adaptive R peak filter dynamically adjusts the cardiac cycle, based on the initial 1000 steps of R peak detection data, k=1 is initialized, the step length step(1)=250, corresponding to the step length of the normal cardiac cycle, and the following steps are repeatedly performed:

[0032] (1) Within a window of 1000 steps, all R peak suspected points R are detected by the proposed R peak detection model. 1 ,R 2 ,...,R l ;

[0033] (2) When multiple R peaks are detected within the sliding window, the R peak with the highest probability is selected as the true R peak, denoted as R 1 * ;

[0034] (3) The next sliding window starts from the detected R peak R 1 * Start, and the size of the sliding window remains at step(k);

[0035] (4) Repeat steps (2) and (3) until all suspected R peaks within the first 1000 steps are filtered out and the real R peak R is obtained. 1 * ,R 2 * , ..., R t * , where t≤l;

[0036] (5) Update the size of the sliding window and calculate the new step size step(k+1) using the following formula:

[0037]

[0038] in, and They represent the positions of the two real R peaks before and after, and t represents the number of real R peaks that appear within 1000 steps.

[0039] It can be seen from the above technical solutions that, compared with the prior art, the present invention has the following beneficial effects:

[0040] The present invention improves the robustness of the model to noise by introducing multiple noises into the training data set. At the same time, Fourier transform and wavelet transform techniques are introduced to extract the time-frequency domain features of ECG signals respectively, enrich the feature representation, and improve the accuracy of R-peak position detection. Then, the signal is feature extracted and fused by combining the bidirectional long short-term memory network (BILSTM) and the one-dimensional convolutional neural network (1DCNN), fully considering the model's processing capabilities for local features and long-term memory to enhance detection accuracy. Finally, the R-peak that is misdetected due to noise and motion interference is corrected by an adaptive R-peak corrector. Through this multi-level, multi-technique fusion processing method, the R-peak detection of ECG signals under high-intensity exercise conditions can achieve more accurate and stable performance, significantly improving the signal processing capability in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0042] Figure 1 A flow chart of a method for detecting R peaks in ECG signals under high-intensity exercise conditions provided by the present invention;

[0043] Figure 2 A schematic diagram of the structure of a noise generator provided by the present invention;

[0044] Figure 3 A schematic diagram of the performance comparison between the present invention and the traditional algorithm under noise-free conditions provided by the present invention;

[0045] Figure 4 A schematic diagram of the performance comparison between the present invention and the traditional algorithm under noisy conditions provided by the present invention;

[0046] Figure 5 The figure is a schematic diagram of the performance comparison between the present invention and the traditional algorithm under different motions provided by the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] like Figure 1 As shown, the embodiment of the present invention discloses a method for detecting R peaks in ECG signals under high-intensity exercise conditions, characterized in that it includes the following steps:

[0049] S1, simulating multiple noise types and randomly adding them to the sports ECG signal to obtain an ECG signal containing multiple noises;

[0050] S2, performing Fourier transform and wavelet transform on the ECG signal containing noise to obtain the time-frequency representation of the signal, and constructing a training set based on the time-frequency representation of the signal;

[0051] S3. Build an R-peak detection model based on the BILSTM network and the CNN network, and use the training set to train the R-peak detection model;

[0052] S4, performing R peak detection on the ECG signal to be detected based on the trained R peak detection model;

[0053] S5. Correct the detected R peak through adaptive post-processing.

[0054] The above steps are further described below.

[0055] S1. Data enhancement: The present invention constructs a noise generator, such as Figure 2 As shown in Figure 2. The noise generator simulates multiple noise types and adds them to the motion ECG signal to enhance the noise processing ability of the model. Specifically, these noise samples are selected from the MIT dataset and include the following types:

[0056] Baseline Wander (BW): simulates baseline drift noise, whose amplitude varies randomly in the range of 0 to 10;

[0057] Muscle Artifact (MA): simulates muscle artifact noise, whose amplitude varies in a random range from 0 to 5;

[0058] Sine Function: simulates power disturbances whose amplitude varies randomly in the range of 0 to 5;

[0059] The three types of noise mentioned above are randomly mixed and added to the sports ECG signal to form a data set containing multiple noises. Through this data augmentation method, the model can be trained under different noise interference conditions, thereby improving its adaptability to the actual noise environment. This strategy significantly improves the stability and accuracy of the model under high-intensity exercise conditions.

[0060] S2. Data mining: In the data mining stage, Fourier transform and wavelet transform techniques are applied to fully enrich the time-frequency representation of ECG signals. Specifically, the Fourier transform formula is expressed as:

[0061]

[0062] The noisy ECG signal is converted from the time domain to the frequency domain through Fourier transform to identify the periodic components and frequency patterns in the signal; Fourier transform can accurately extract the frequency domain characteristics of the signal, allowing us to identify and analyze the components of different frequencies in the signal, which is crucial to understanding the periodic characteristics and spectral characteristics of the signal.

[0063] The wavelet transform formula is expressed as:

[0064]

[0065] Wavelet transform provides the time-frequency analysis capability of the signal, performs localized analysis on the ECG signal containing noise at different time scales (controlled by the scale factor a) and positions (controlled by the translation factor b), captures the changes of the signal within different frequency ranges, and identifies the transient features and change patterns in the signal; this multi-scale analysis capability can accurately identify the transient features and change patterns in the signal.

[0066] The signals after Fourier transform and wavelet transform are fused to obtain the time-frequency representation of the signal.

[0067] By combining Fourier transform and wavelet transform, the present invention can deeply analyze ECG signals from different angles and reveal its complex frequency domain and time domain characteristics. This comprehensive time-frequency analysis not only enhances the understanding of ECG signals, but also provides rich, multi-dimensional input data for subsequent feature extraction and fusion, and improves the performance of the R peak detection model under high-intensity exercise conditions.

[0068] S3. Construction and training of R-peak detection model.

[0069] S31, model construction and feature extraction:

[0070] The present invention uses BILSTM and CNN to process and extract features of motion ECG signals, respectively.

[0071] BILSTM is an improved recurrent neural network (RNN) specifically designed to capture long-term dependencies in time series data. By combining forward and backward LSTM layers, BILSTM is able to leverage both past and future information to enhance the modeling capabilities of time series. Unlike traditional RNNs, BILSTM effectively retains and updates long-term information by introducing memory cells and gating mechanisms (such as input gates, forget gates, and output gates), which makes BILSTM particularly effective in processing ECG signals with long-term dependencies. The BILSTM network is able to capture the complex time series features and dynamic changes in ECG signals, which helps to identify the timing patterns and pulsation patterns of R peaks. The memory cell update formula of BILSTM is:

[0072]

[0073] Among them, C t is the memory cell state at the current time step; f t is the output of the forget gate, used to control the previous state C t-1 Which information will be forgotten? t-1 is the memory cell state of the previous time step; i t Control the input information of the current moment for the input gate; For candidate memory units, a new candidate memory unit value is generated based on the current input and the hidden state at the previous moment.

[0074] At the same time, the CNN network is used to extract the spatial features of the ECG signal. Through structures such as convolutional layers, pooling layers, and activation functions, CNN can effectively identify local patterns and important features in the signal. By applying convolution kernels, CNN can extract local features at different spatial locations and reduce the dimension of features through pooling layers while retaining important spatial information. When processing ECG signals, CNN can extract local waveform features and potential abnormal patterns in the signal, which is crucial for identifying the morphological characteristics of the R peak and abnormality detection.

[0075] By combining BILSTM and CNN, the present invention can comprehensively analyze the time-frequency representation of ECG signals from different perspectives. BILSTM captures the time dependency and dynamic characteristics of the signal, while CNN extracts the local spatial pattern of the signal. The feature fusion of the two can provide a more comprehensive signal representation, thereby significantly improving the accuracy and stability of R peak detection.

[0076] S32, Feature Fusion:

[0077] In the feature fusion stage, the features extracted by the network in S31 are fused to combine the advantages of both and form a more expressive fusion feature representation, thereby improving the accuracy and stability of R-peak detection.

[0078] S33. Calculate loss: In the loss calculation stage, first perform R-peak detection on the fused feature representation to obtain the prediction result, and then use the binary cross-entropy loss function to evaluate the prediction performance of the model. The cross-entropy loss function can effectively measure the difference between the probability distribution predicted by the model and the true label, and is particularly suitable for dealing with binary classification problems. By calculating the loss, the performance of the model in the R-peak prediction task can be quantified, providing a basis for subsequent optimization steps.

[0079] S34. Update gradients through back propagation algorithm: The total loss is calculated and the back propagation algorithm is used to calculate the gradient and update the network parameters. During the back propagation process, the gradient of the loss function is used to update the weights and biases in the network to optimize the performance of the model. This process is iterated continuously, and the network parameters are gradually adjusted to reduce the prediction error and improve the accuracy of the model.

[0080] S35, continue to optimize and learn network parameters until the R-peak prediction results meet the preset requirements: In the model training stage, the present invention emphasizes continuous optimization and learning of network parameters. The model is continuously improved by repeated training and adjustment of its R-peak prediction ability. Hyperparameters (such as learning rate, batch size, etc.) during the training process may also be dynamically adjusted to achieve optimal model performance. When the model's prediction results achieve the expected accuracy and stability, the training process is completed.

[0081] S4. Perform R peak detection on the ECG signal to be detected based on the trained R peak detection model. After the model is trained, use the test set to verify the monitoring results of the model.

[0082] S5. Post-processing of correcting the detected R peak:

[0083] In the post-processing stage, the present invention introduces an adaptive R-peak filter to correct the detected R-peak to cope with the interference of noise and high-intensity exercise on the ECG waveform.

[0084] When multiple R peaks are detected, the filter eliminates false peaks by retaining the R peak with the highest detection probability. Since high-intensity exercise can cause significant changes in the cardiac cycle, the present invention can dynamically adjust the cardiac cycle. Specifically, based on the initial 1000 steps (equivalent to 4 seconds) of R peak detection data, initialize k=1, step length step(1)=250, corresponding to the step length of the normal cardiac cycle (at a sampling frequency of 250Hz, 1 second equals 250 steps), and repeat the following steps:

[0085] (1) Within a window of 1000 steps, all R peak suspected points R are detected by the proposed R peak detection model. 1 ,R2 ,...,R l , here 0.95 is selected as the user-defined probability threshold.

[0086] (2) When multiple R peaks are detected within the sliding window, the R peak with the highest probability is selected as the true R peak, denoted as R 1 * .

[0087] (3) The next sliding window starts from the detected R peak R 1 * Start, and the size of the sliding window remains at step(k).

[0088] (4) Repeat steps (2) and (3) until all suspected R peaks within the first 1000 steps are filtered out and the real R peak R is obtained. 1 * ,R 2 * , ..., R t * (where t≤l).

[0089] (5) Update the size of the sliding window and calculate the new step size step(k+1) using the following formula:

[0090]

[0091] in, and They represent the positions of the two real R peaks before and after, and t represents the number of real R peaks that appear within 1000 steps.

[0092] Next, the detection performance of the method of the present invention is further verified.

[0093] The detection of R peaks by the present invention and the traditional algorithm are compared under noise-free conditions, noise conditions and different motions. Figure 3-Figure 5 shown.

[0094] The method of the present invention has demonstrated excellent performance for a wide range of sports scenarios from low intensity to high intensity (including Seg1, Seg2, Seg3, Seg4 and Seg5). Under the EPFL dataset, experimental data clearly show that in the low-intensity exercise stage (Seg1, Seg2, Seg5), the F1 score of the R-peak detection method proposed in the present invention is as high as 0.99, which demonstrates extremely high accuracy. Even under high-intensity exercise conditions, when the F1 score of the traditional method drops significantly, the present invention can still stably maintain a high level of above 0.98, such as Figure 3The results fully demonstrate the superior adaptability and stability of the proposed method.

[0095] In addition, the present invention also shows considerable robustness. When the complex noise environment of the MIT noise library is introduced for R peak detection, compared with the traditional method, the algorithm has significant detection effect and the performance degradation is minimal. Figure 4 shown.

[0096] This further highlights its superiority and reliability in complex and changing environments. Under the GUDB dataset, experimental data clearly show that the present invention outperforms traditional algorithms under various motion conditions, such as Figure 5 shown.

[0097] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0098] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for detecting R peaks in ECG signals under high-intensity exercise conditions, characterized in that: The following steps are involved: Simulate various noise types and randomly add them to the sports ECG signal to obtain an ECG signal containing various noises; Perform Fourier transform and wavelet transform on the ECG signal containing noise to obtain the time-frequency representation of the signal, and construct a training set based on the time-frequency representation of the signal; An R-peak detection model is constructed based on the BILSTM network and the CNN network, and the R-peak detection model is trained using the training set; Perform R peak detection on the ECG signal to be detected based on the trained R peak detection model; The detected R peak is corrected by adaptive post-processing.

2. The method for detecting R peaks in ECG signals under high-intensity exercise conditions according to claim 1, characterized in that: Various noise types can be simulated by: Simulate baseline drift noise, whose amplitude varies randomly in the range of 0 to 10; simulated muscle artifact noise, whose amplitude varies in a random range from 0 to 5; Simulate power disturbances, whose amplitude varies randomly in the range of 0 to 5; The above three noise types are randomly mixed and added to the sports ECG signal.

3. The method for detecting R peaks in ECG signals under high-intensity exercise conditions according to claim 1, characterized in that: The ECG signal containing noise is subjected to Fourier transform and wavelet transform to obtain a time-frequency representation of the signal, including: The ECG signal containing noise is converted from the time domain to the frequency domain through Fourier transform to identify the periodic components and frequency patterns in the signal; The ECG signal containing noise is analyzed locally at different time scales and locations through wavelet transform, the changes of the signal in different frequency ranges are captured, and the transient characteristics and change patterns in the signal are identified; The signals after Fourier transform and wavelet transform are fused to obtain the time-frequency representation of the signal.

4. The method for detecting R peaks in ECG signals under high-intensity exercise conditions according to claim 1, characterized in that: The method of training the R peak detection model using the training set includes: Extract complex time series features and dynamic changes in training sample signals through BILSTM network; Extract local waveform features and potential abnormal patterns in training sample signals through CNN network; The features extracted by the BILSTM network and the CNN network are fused to obtain the fused feature representation; Perform R peak detection on the fusion feature representation to obtain the prediction result; The difference between the predicted result and the true label is measured by the cross entropy loss function; The network parameters are updated through the back propagation algorithm to optimize the network parameters of the R-peak detection model until the R-peak prediction results meet the preset requirements.

5. The method for detecting R peaks in ECG signals under high-intensity exercise conditions according to claim 1, characterized in that: The detected R peak is corrected by an adaptive R peak filter.

6. The method for detecting R peaks in ECG signals under high-intensity exercise conditions according to claim 5, characterized in that: When multiple R peaks are detected, the adaptive R peak filter eliminates false peaks by retaining the R peak with the highest detection probability.

7. The method for detecting R peaks in ECG signals under high-intensity exercise conditions according to claim 6, characterized in that: When the adaptive R peak filter dynamically adjusts the cardiac cycle, based on the initial 1000 steps of R peak detection data, k=1 is initialized, the step length step(1)=250, corresponding to the step length of the normal cardiac cycle, and the following steps are repeatedly performed: (1) Within a window of 1000 steps, all R peak suspected points R1, R2, ..., R are detected by the proposed R peak detection model. l ; (2) When multiple R peaks are detected within the sliding window, the R peak with the highest probability is selected as the true R peak, denoted as R1 * ; (3) The next sliding window starts from the detected R peak R1 * Start, and the size of the sliding window remains at step(k); (4) Repeat steps (2) and (3) until all suspected R peaks within the first 1000 steps are filtered out and the real R peak R1 is obtained. * ,R2 * , ..., R t * , where t≤l; (5) Update the size of the sliding window and calculate the new step size step(k+1) using the following formula: in, and They represent the positions of the two real R peaks before and after, and t represents the number of real R peaks that appear within 1000 steps.