Heart rate detection method and device based on electrocardiosignal and readable storage medium

By pre-processing, segmenting, flipping and convolution processing of the original ECG signal, combined with peak detection, the problem of insufficient accuracy and stability of the central rate detection in the prior art is solved, and more efficient heart rate detection is achieved.

CN119908693AActive Publication Date: 2025-05-02SHENZHEN FENDA SMART TECH LTD +1

Patent Information

Application Number
CN202510408893.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-02
Publication Date
2025-05-02
Estimated Expiration
2045-04-02

AI Technical Summary

Technical Problem

The existing heart rate detection methods are insufficient in the accuracy and stability of the heart rate in the face of noise and interference, making it difficult to effectively identify R waves and calculate the heart rate.

Method used

By acquiring the original ECG signal, pre-processing and segmenting, the signal is flipped in the time domain, convolutional processing is performed to extract the frequency and phase information of the signal, and the heart rate is calculated based on peak detection.

Benefits of technology

It significantly improves the accuracy and anti-interference ability of heart rate detection, and can more effectively extract the frequency and phase information of the ECG signal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119908693A_ABST
    Figure CN119908693A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a heart rate detection method and device based on electrocardiosignals and a readable storage medium. The method comprises the steps that original electrocardiosignals are preprocessed, the preprocessed electrocardiosignals are segmented, the multiple segments of preprocessed electrocardiosignals are turned over in a time domain, and multiple segments of reference signals are obtained; convolution is carried out on each segment of the preprocessed electrocardiosignal and the corresponding segment of the reference signal to obtain a to-be-detected signal; carrying out peak detection to obtain a plurality of peak data; and calculating heart rate information based on the peak data. On the basis of the method, by comparing the similarity between the original signal and the reference signal, the reference signal obtained after overturning keeps the original frequency information, and the noise is eliminated, so that the frequency and phase information of the original signal can be effectively extracted, and the accuracy and the anti-interference capability of heart rate detection are remarkably improved. The invention further provides heart rate detection equipment and a readable storage medium, and the heart rate detection equipment and the readable storage medium have the same beneficial effects as the method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of diagnosis, and in particular, relates to a heart rate detection method based on electrocardiogram signals. Background Art

[0002] As a common and indispensable means of monitoring heart health, the electrocardiogram (ECG) has a complex waveform structure, which mainly includes key components such as P wave, QRS complex and T wave. These waveforms each reflect the activity state of the heart at different physiological stages, among which the QRS complex is particularly significant, and the R wave, as the peak of the QRS complex, is the top priority in ECG signal analysis. The R wave not only has distinct characteristics, but also carries key information for calculating the time difference between two adjacent R peaks (i.e., the RR interval value). The accurate calculation of this time difference is the basis for realizing heart rate estimation, which is of great significance for evaluating the heart rate and rhythm.

[0003] In terms of the technology of ECG signal heart rate detection, most of the current mainstream methods rely on filter technology to extract effective ECG signals. Filters, such as low-pass, high-pass or band-pass filters, can effectively filter out noise and interference components in ECG signals by precisely adjusting the frequency range. This step is crucial for subsequent ECG signal analysis because it is directly related to the accuracy and reliability of subsequent peak detection or R-wave recognition.

[0004] After filtering, researchers usually use two methods to identify R waves and calculate heart rate. One is to set a reasonable threshold for peak detection, and locate the position of the R wave by comparing the amplitude of the ECG signal with the preset threshold. The other method uses more complex algorithms, such as the Pan-Tompkins algorithm and wavelet transform, which can more accurately identify R waves and effectively deal with noise and variation in ECG signals. However, although these methods can achieve good detection results in most cases, they still face many challenges in practical applications. Due to the interference of various factors such as skin color differences, movement status, ambient light, and poor electrode contact, the collected ECG signals are often accompanied by a certain degree of noise and interference. These noise and interference components not only increase the complexity of heart rate detection, but also pose a severe challenge to the accuracy of heart rate detection. Therefore, how to further improve the filtering algorithm, improve the accuracy and stability of R wave recognition, and develop a more robust heart rate detection method are still important issues that need to be solved in the current field of ECG signal processing. Summary of the invention

[0005] The purpose of the present invention is to provide a heart rate detection method based on an electrocardiogram signal, aiming to solve the problem of insufficient accuracy and stability of existing heart rate detection. The heart rate detection of the electrocardiogram signal provided by the present application includes: A first aspect of an embodiment of the present application provides a heart rate detection method based on an electrocardiogram signal, comprising: Get the original ECG signal; Preprocessing the original ECG signal to obtain a preprocessed ECG signal; Segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; Respectively flipping the multiple segments of preprocessed ECG signals in the time domain to obtain multiple segments of reference signals; Convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain a signal to be detected; Perform peak detection based on the signal to be detected to obtain multiple peak data; The heart rate information is calculated based on the peak data.

[0006] Based on the heart rate detection method based on electrocardiogram signals provided in the first aspect of the embodiment of the present application, optionally, the preprocessing process includes: Performing bandpass filtering on the original electrocardiogram signal to obtain a first intermediate signal; Performing secondary differential filtering on the first intermediate signal to obtain a second intermediate signal; performing an absolute value operation on the second intermediate signal to obtain a third intermediate signal; Set the sliding integration window length; Perform sliding integration on the third intermediate signal to obtain a preprocessed electrocardiogram signal.

[0007] Based on the heart rate detection method based on the electrocardiogram signal provided in the first aspect of the embodiment of the present application, optionally, segmenting the preprocessed electrocardiogram signal includes: Set the reference signal window duration; The preprocessed ECG signal is segmented based on the reference signal window duration.

[0008] Based on the heart rate detection method based on ECG signals provided in the first aspect of the embodiment of the present application, optionally, the multiple segments of pre-processed ECG signals are flipped in the time domain to obtain multiple segments of reference signals, including: The multiple segments of preprocessed ECG signals are normalized, and each segment of the reference signal is flipped in the time domain to obtain multiple segments of reference signals.

[0009] Based on the heart rate detection method based on ECG signals provided in the first aspect of the embodiment of the present application, optionally, convolving the preprocessed ECG signals of each segment with the reference signals of the corresponding segment to obtain the signals to be detected includes: Convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment based on Fourier transform to obtain the preprocessed ECG signal of each segment in the frequency domain and the reference signal of the corresponding segment in the frequency domain; Multiplying each segment of the frequency domain preprocessed ECG signal with the corresponding segment of the frequency domain reference signal to obtain the frequency domain signal to be detected; The frequency domain signal to be detected is processed based on inverse fast Fourier transform to obtain the signal to be detected.

[0010] Based on the heart rate detection method based on the ECG signal provided in the first aspect of the embodiment of the present application, optionally, after the step of convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain the signal to be detected, before performing peak detection based on the signal to be detected to obtain multiple peak data, the method further includes: The signal to be detected is used as the preprocessed signal, and the preprocessed ECG signal is segmented again to obtain multiple segments of preprocessed ECG signals, and the multiple segments of preprocessed ECG signals are flipped in the time domain to obtain multiple segments of reference signals, and each segment of the preprocessed ECG signal is convolved with the corresponding segment of the reference signal to obtain the step of the signal to be detected.

[0011] Based on the heart rate detection method based on the electrocardiogram signal provided in the first aspect of the embodiment of the present application, optionally, performing peak detection based on the signal to be detected to obtain multiple peak data includes: Set the duration of the peak detection sliding window; Calculating the mean and standard deviation of the signal to be detected within the peak detection sliding window; Calculating an adaptive threshold based on the mean and standard deviation; Extracting a plurality of candidate regions whose detection signals are greater than the adaptive threshold; The maximum values ​​in the multiple candidate areas are respectively determined as peak data to obtain multiple peak data.

[0012] A second aspect of an embodiment of the present application provides a heart rate detection device based on an electrocardiogram signal, comprising: An acquisition unit, used for acquiring original ECG signals; A preprocessing unit, used for preprocessing the original ECG signal to obtain a preprocessed ECG signal; A segmentation unit, used for segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; A flip unit, used for flipping the multiple segments of pre-processed ECG signals in the time domain to obtain multiple segments of reference signals; A convolution unit, used for convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain a signal to be detected; A detection unit, used for performing peak detection based on the signal to be detected to obtain a plurality of peak data; A calculation unit is used to calculate the heart rate information based on the peak data.

[0013] Based on a heart rate detection device based on an electrocardiogram signal provided in the second aspect of an embodiment of the present application, optionally, the preprocessing unit is specifically used for: Performing bandpass filtering on the original electrocardiogram signal to obtain a first intermediate signal; Performing secondary differential filtering on the first intermediate signal to obtain a second intermediate signal; performing an absolute value operation on the second intermediate signal to obtain a third intermediate signal; Set the sliding integration window length; Perform sliding integration on the third intermediate signal to obtain a preprocessed electrocardiogram signal.

[0014] Based on a heart rate detection device based on an electrocardiogram signal provided in the second aspect of an embodiment of the present application, optionally, the segmentation unit is specifically used for: Set the reference signal window duration; The preprocessed ECG signal is segmented based on the reference signal window duration.

[0015] Based on a heart rate detection device based on an electrocardiogram signal provided in the second aspect of an embodiment of the present application, optionally, the flip unit is specifically used for: The multiple segments of preprocessed ECG signals are normalized, and each segment of the reference signal is flipped in the time domain to obtain multiple segments of reference signals.

[0016] According to a heart rate detection device based on an electrocardiogram signal provided in the second aspect of an embodiment of the present application, optionally, the convolution unit is specifically used for: Convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment based on Fourier transform to obtain the preprocessed ECG signal of each segment in the frequency domain and the reference signal of the corresponding segment in the frequency domain; Multiplying each segment of the frequency domain preprocessed ECG signal with the corresponding segment of the frequency domain reference signal to obtain the frequency domain signal to be detected; The frequency domain signal to be detected is processed based on inverse fast Fourier transform to obtain the signal to be detected.

[0017] According to a second aspect of an embodiment of the present application, a heart rate detection device based on an electrocardiogram signal is provided, optionally, the device further includes: An iterative unit, used to: convert the signal to be detected into a reference signal; Retrigger the convolution unit.

[0018] According to a heart rate detection device based on an electrocardiogram signal provided in the second aspect of the embodiment of the present application, optionally, The detection unit is specifically used for: Set the duration of the peak detection sliding window; Calculating the mean and standard deviation of the signal to be detected within the peak detection sliding window; Calculating an adaptive threshold based on the mean and standard deviation; Extracting a plurality of candidate regions whose detection signals are greater than the adaptive threshold; The maximum values ​​in the multiple candidate areas are respectively determined as peak data to obtain multiple peak data.

[0019] A third aspect of the embodiments of the present application provides a heart rate detection device based on an electrocardiogram signal, comprising: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instruction operations in the memory on the device to perform the method described in any one of the first aspects of the embodiments of the present application.

[0020] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute a method as described in any one of the first aspects of the embodiment of the present application.

[0021] A fifth aspect of the embodiments of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute a method as described in any one of the first aspects of the embodiments of the present application.

[0022] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: The present application provides a heart rate detection method based on an ECG signal, comprising: obtaining an original ECG signal; preprocessing the original ECG signal to obtain a preprocessed ECG signal; segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; flipping the multiple segments of preprocessed ECG signals in the time domain to obtain multiple segments of reference signals; convolving each segment of the preprocessed ECG signal with the corresponding segment of the reference signal to obtain a signal to be detected; performing peak detection based on the signal to be detected to obtain multiple peak data; and calculating the heart rate information based on the peak data. Based on the above method, by comparing the similarity between the original signal and the reference signal, the reference signal obtained after flipping retains the original frequency information, while the noise is eliminated, so that the frequency and phase information of the original signal can be effectively extracted, significantly improving the accuracy and anti-interference ability of heart rate detection. The present application also provides a heart rate detection device and a readable storage medium, which have the same beneficial effects as the above method. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work. It is understood that the drawings provided in this section are only used to better understand the present solution and do not constitute a limitation of the present application.

[0024] Figure 1 A flowchart of an embodiment of a heart rate detection method based on an electrocardiogram signal provided in the present application.

[0025] Figure 2 A schematic diagram of the processing flow of the raw ECG signal preprocessing stage provided in this application.

[0026] Figure 3 A schematic diagram of the original ECG signal provided in this application.

[0027] Figure 4 A schematic diagram of the preprocessed signal provided in this application.

[0028] Figure 5 A schematic diagram of the convolution processing process based on the reference signal provided in this application.

[0029] Figure 6 A schematic diagram of a signal to be detected provided in this application.

[0030] Figure 7A schematic diagram of heart rate detection based on the signal to be detected provided in this application.

[0031] Figure 8 A structural schematic diagram of a heart rate detection device based on electrocardiogram signals provided in this application; Fig. 9 This is another structural schematic diagram of the heart rate detection device based on electrocardiogram signals provided in this application. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application are clearly and completely described below. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should belong to the scope of protection of the present application. At the same time, for the sake of clarity and simplicity, the description of well-known functions and structures is omitted in the following description.

[0033] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] As a common and indispensable means of monitoring heart health, the electrocardiogram (ECG) has a complex waveform structure, which mainly includes key components such as P wave, QRS complex and T wave. These waveforms each reflect the activity state of the heart at different physiological stages, among which the QRS complex is particularly significant, and the R wave, as the peak of the QRS complex, is the top priority in ECG signal analysis. The R wave not only has distinct characteristics, but also carries key information for calculating the time difference between two adjacent R peaks (i.e., the RR interval value). The accurate calculation of this time difference is the basis for realizing heart rate estimation, which is of great significance for evaluating the heart rate and rhythm.

[0035] In terms of the technology of ECG signal heart rate detection, most of the current mainstream methods rely on filter technology to extract effective ECG signals. Filters, such as low-pass, high-pass or band-pass filters, can effectively filter out noise and interference components in ECG signals, such as myoelectric interference, baseline drift, and power frequency interference, by precisely adjusting the frequency range. This step is crucial for subsequent ECG signal analysis because it is directly related to the accuracy and reliability of subsequent peak detection or R-wave recognition.

[0036] After filtering, researchers usually use two methods to identify R waves and calculate heart rate. One is to set a reasonable threshold for peak detection, and locate the position of the R wave by comparing the amplitude of the ECG signal with the preset threshold. The other method uses more complex algorithms, such as the Pan-Tompkins algorithm and wavelet transform, which can more accurately identify R waves and effectively deal with noise and variation in ECG signals. However, although these methods can achieve good detection results in most cases, they still face many challenges in practical applications. Due to the interference of various factors such as skin color differences, movement status, ambient light, and poor electrode contact, the collected ECG signals are often accompanied by a certain degree of noise and interference. These noise and interference components not only increase the complexity of heart rate detection, but also pose a severe challenge to the accuracy of heart rate detection. Therefore, how to further improve the filtering algorithm, improve the accuracy and stability of R wave recognition, and develop a more robust heart rate detection method are still important issues that need to be solved in the current field of ECG signal processing.

[0037] To solve the above problems, this application provides a heart rate detection method based on ECG signal, please refer to Figure 1 An embodiment of a heart rate detection method based on an electrocardiogram signal provided in the present application includes: steps 101 to 107.

[0038] 101. Obtain original ECG signal.

[0039] Usually, ECG signals are collected from the human body surface through electrocardiogram (ECG) devices. These devices usually contain multiple electrodes, which are placed at specific locations on the human body (such as the chest, limbs, etc.) to capture the electrophysiological activity of the heart. The collected ECG signals are analog signals and may contain noise, interference and other factors. In this solution, the use of wrist ECG watch devices to collect raw ECG signals is used as an example. As one of the daily wearable devices, wrist ECG watch devices can easily collect the user's raw ECG signals.

[0040] 102. Preprocess the original ECG signal to obtain a preprocessed ECG signal.

[0041] Specifically, the original ECG signal is preprocessed to obtain a preprocessed ECG signal. The preprocessing step is to improve the quality of the ECG signal to make it more suitable for subsequent analysis. Preprocessing generally includes operations such as filtering and denoising. In the actual implementation process, it may include preprocessing methods such as bandpass filtering and differential filtering. The specific preprocessing method may be determined according to the actual situation and is not limited here.

[0042] 103. Segment the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals.

[0043] Specifically, the ECG signal is usually a continuous signal. In order to reduce the data processing pressure and facilitate analysis and processing, it needs to be divided into multiple shorter segments. The length of the segment depends on the actual equipment situation and application analysis requirements. It should be noted that the pre-processed ECG signal after segmentation needs to be used for heart rate analysis, and the heart rate determination requires the analysis of the peak interval in the signal. Therefore, the segmented ECG signal should include at least two peak values, that is, the duration after segmentation should be at least not less than the interval between the two peaks. There is no specific limitation here.

[0044] 104. Respectively flip the multiple segments of preprocessed ECG signals in the time domain to obtain multiple segments of reference signals.

[0045] Specifically, each of the multiple pre-processed ECG signals is flipped in the time domain to obtain multiple reference signals.

[0046] The flipping operation means reversing the time axis of the signal, that is, the signal point that was originally in front is now in the back, and vice versa. The flipped signal is used as a reference signal for convolution with the original signal. Here, the input signal itself is defined as the reference signal after flipping. By comparing the similarity between the received signal and the pre-set reference signal, the frequency and phase information of the signal can be effectively extracted to achieve the purpose of signal enhancement, which helps to detect the heart rate more accurately and quickly. The specific reasons are as follows: 1) Temporal symmetry: The flipped signal can better capture the temporal characteristics of the signal. If the input signal is symmetric in time, the comparison between the flipped signal and itself can effectively identify similar parts of the signal. 2) Improve correlation: Flipping the signal helps improve the correlation of the signal, so that the corresponding part of the signal can still be accurately found in the case of time delay. This is especially important when dealing with time-varying signals.

[0047] 3) Simplified calculation: By using a flipped signal, the problem can be transformed into finding the correlation between the signal and the reference, which can then be efficiently calculated through operations such as convolution. This method is particularly effective in the frequency domain.

[0048] 4) Reduce the impact of noise: Flipping the signal helps reduce the impact of noise on signal similarity calculation, thereby improving the accuracy of signal detection. 105. Convolve the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain a signal to be detected.

[0049] Specifically, the preprocessed ECG signal of each segment is convolved with the reference signal of the corresponding segment to obtain the signal to be detected. The convolution operation is a mathematical operation that multiplies and sums two signals (here, the preprocessed ECG signal and the flipped reference signal) one by one in time order. The result of the convolution is a new signal that reflects the similarity between the two signals. The convolution operation is used to detect specific features or patterns in the ECG signal to effectively extract the frequency and phase information of the signal to achieve the purpose of signal enhancement.

[0050] 106. Perform peak detection based on the signal to be detected to obtain multiple peak data.

[0051] Specifically, peak detection is performed based on the signal to be detected to obtain multiple peak data; peak detection is the process of identifying the local maximum value in the signal. In ECG signal processing, the peak value usually corresponds to the position of the R wave (ventricular depolarization wave). By detecting these peaks, we can obtain information about the heartbeat. After the processing of steps 101 to 104 as described above, the peak position of the signal to be detected has changed, but the frequency information is still retained and amplified, so the peak data obtained based on the identification of the signal to be detected is more accurate. In the actual implementation process, the peak detection can use threshold setting, window sliding and other technologies to ensure accurate identification of the peak and eliminate noise interference. The specific means can be determined according to the actual situation and are not limited here.

[0052] 107. Calculate heart rate information based on the peak data.

[0053] Specifically, the heart rate information is calculated based on the peak data. The peak data carries time information, and the corresponding heart rate information is calculated based on the time intervals of multiple peak data to obtain information about the heart activity rate. In addition, parameters such as heart rate variability can be further analyzed to assess the health of the heart.

[0054] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: The present application provides a heart rate detection method based on an ECG signal, comprising: obtaining an original ECG signal; preprocessing the original ECG signal to obtain a preprocessed ECG signal; segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; flipping the multiple segments of preprocessed ECG signals in the time domain to obtain multiple segments of reference signals; convolving each segment of the preprocessed ECG signal with the corresponding segment of the reference signal to obtain a signal to be detected; performing peak detection based on the signal to be detected to obtain multiple peak data; and calculating the heart rate information based on the peak data. Based on the above method, by comparing the similarity between the original signal and the reference signal, the reference signal obtained after flipping retains the original frequency information, while the noise is eliminated, so that the frequency and phase information of the original signal can be effectively extracted, significantly improving the accuracy and anti-interference ability of heart rate detection. The present application also provides a heart rate detection device and a readable storage medium, which have the same beneficial effects as the above method.

[0055] In order to facilitate the use of this method in actual processes, the present application also provides a more detailed embodiment that can be optionally implemented. The embodiment includes three stages: preprocessing stage, convolution processing stage and heart rate data calculation stage. For details, please refer to Figure 2 , Figure 5 and Figure 7 , which are described one by one below.

[0056] Figure 2 The schematic diagram of the processing flow of the preprocessing stage provided in this application includes: step 201 to step 206.

[0057] 201. Obtain original electrocardiogram signal.

[0058] Specifically, the process of obtaining the original ECG signal is similar to Figure 1 The corresponding embodiment is similar to step 101, and the details can be referred to the above content, which will not be repeated here. Figure 3 , Figure 3 This is a schematic diagram of the original ECG signal provided in this application.

[0059] 202. Perform bandpass filtering on the original electrocardiogram signal to obtain a first intermediate signal.

[0060] Specifically, the original ECG signal is bandpass filtered to obtain a first intermediate signal. The design of the filter and the selection of parameters need to comprehensively consider factors such as signal characteristics, filter performance and actual application needs, and make reasonable selections and adjustments. At the same time, the frequency range of resting heart rate will also be affected by individual differences, age, physical condition and other factors. Therefore, personalized adjustment and optimization are required in practical applications. The heart rate detection range of normal adults is usually 30bpm to 180bpm, and the frequency range of the QRS waveform representing the heart rate signal contained in the ECG signal is usually between 5 Hz and 15 Hz. Therefore, the passband range of the bandpass filter can be set to 0.5Hz, The filter parameters are set to 15 Hz to retain most of the energy required for heart rate detection in the R wave band and remove noise.

[0061] 203. Perform secondary differential filtering on the first intermediate signal to obtain a second intermediate signal.

[0062] Specifically, after the original signal is bandpass filtered, the first intermediate signal is subjected to secondary differential filtering to obtain the second intermediate signal. Differential filtering calculates the derivative by slightly offsetting the signal and taking the difference, so as to better remove the low-frequency components in the signal and highlight the high-frequency components in the signal, thereby ensuring the stability of the baseline. In this solution, by performing secondary differential filtering on the signal after the heart rate bandpass filtering in the ECG resting scene, the slope of the R wave is enhanced while the P wave and T wave are suppressed. In the actual processing process, a secondary differential operation is performed from the 3rd data to the Lth data point, and the differential formula is as follows:

[0063] In actual implementation, this step may also be processed by using a secondary moving mean filter or a secondary median filter, which is not specifically limited here.

[0064] 204. Perform an absolute value operation on the second intermediate signal to obtain a third intermediate signal.

[0065] Specifically, the absolute value operation is performed on the second intermediate signal to obtain the third intermediate signal. That is, the positive operation is performed on all L data points, so that the output after the secondary differential filtering is nonlinearly amplified, avoiding the peak facing downward and preventing the inverted R peak from appearing. The specific formula is as follows:

[0066] 205. Set the sliding integration window length.

[0067] 206. Perform sliding integration on the third intermediate signal to obtain a preprocessed ECG signal.

[0068] Specifically, the ECG signal after the positive operation of all L data points is integrated with a sliding window to enhance the amplitude of the R wave and obtain the candidate R peak. In this step, the most important thing is to design the sliding window integration window length. Generally speaking, the data length should be long enough to ensure that the filter can accurately capture the candidate R peak. If the integration window length is not long enough, high-frequency noise similar to the R wave morphology is likely to be obtained, making it impossible for the algorithm to distinguish the candidate R peak well, which will directly lead to false detection. The detection range of the heart rate in the ECG signal is usually 30bpm to 180bpm. Therefore, 0.5 to 3 peaks can be detected in a one-second data window, that is, at most 3 heart rate peaks can be generated within 1000ms. The sliding window integration window length can be designed to be about 300ms, approximately The data length.

[0069] The sliding window integral formula can be expressed as:

[0070] Since the subscript of the formula in step 203 starts from 3, the sliding window integral formula needs to start from data points, forward The data length is integrated by sliding window to obtain the preprocessed signal. Specifically, the pattern of the preprocessed signal can be referred to Figure 4 .

[0071] After the preprocessing is completed, the preprocessed signal can be used to generate a reference signal, and convolution is performed based on the reference signal and the preprocessed signal to further extract the frequency and phase information of the signal, thereby extracting more accurate heart rate information. The specific convolution process can be referred to Figure 5 , including: step 501 to step 508.

[0072] 501. Set the reference signal window duration.

[0073] The reference signal window length directly affects the accuracy and robustness of heart rate detection. Usually, the window length should be selected according to the sampling rate of the ECG signal and the range of change of the heart rate. In general, the data length should be long enough to ensure that the reference signal can accurately match the shape of the input signal. However, too long data length will also lead to increased computational complexity and an expansion of the amplitude range after signal enhancement, thereby reducing the real-time performance of ECG signal heart rate detection. In the present invention, the optimal data length of the reference signal is determined through experiments and simulations. The time required for the filter to be used is 5-10s, which can ensure both the accuracy of the filter and the acceptable range of the computational complexity.

[0074] 502. Segment the preprocessed ECG signal based on the reference signal window duration.

[0075] In order to ensure the real-time performance of the filtering and heart rate detection algorithm, it is assumed that L sequences are input and the sampling rate is The original ECG data is divided into The group has small data segments with a data length of t seconds, and each small data segment is represented as , the length of each data segment satisfies:

[0076] 503. Normalize the multiple segments of preprocessed ECG signals, and flip each segment of the reference signal in the time domain to obtain multiple segments of reference signals.

[0077] In each of the steps described in step 502 The data in the data window Perform normalization operation, subscript from 0 to In order to avoid the convolution and amplitude being too large after signal enhancement, the specific formula is as follows:

[0078] in, is the sample index of the integrated signal.

[0079] The periodic signal has the same periodic characteristics as the signal itself, and the optimal sampling time is:

[0080] The signal-to-noise ratio between the instantaneous square power of the signal at the output and the noise power reaches the maximum value, so that when the signal and noise are input at the same time, the signal component will reach a peak at a certain moment, while the noise component will be suppressed, thus achieving the purpose of signal enhancement.

[0081] Therefore, in the operation S24, for each segment described in step 502 In the data window, obtain its reference signal :

[0082] 504. Convolve the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain the frequency domain preprocessed ECG signal of each segment and the frequency domain reference signal of the corresponding segment based on Fourier transform.

[0083] Specifically, in the time domain, the signal enhancement algorithm can be implemented by the convolution and formula of discrete signals. Specifically, given the part Input signal segment and its reference signal The output value of the convolution operation The formula is:

[0084] Represents the input sliding window integral signal at a given The value of the location point, Represents the reference signal at The value of the location point, Represents the input signal position index, Represents the output signal position index. From the above formula, it can be seen that the computational complexity in the time domain is directly affected by the parameter sampling rate The influence of the signal window length leads to high computational complexity, such as When It is obviously unreasonable to perform convolution operation on each data, so it can be calculated from the frequency domain. That is, it is necessary to convolve each segment of the pre-processed ECG signal and the corresponding segment of the reference signal based on Fourier transform to obtain each segment of the frequency domain pre-processed ECG signal and the corresponding segment of the frequency domain reference signal.

[0085] Integrate signal segments separately and its reference signal The Fourier transform of the input signal segment The Fourier transform result of , and its reference signal The Fourier transform result of .

[0086]

[0087] in is the sample index in the frequency domain, is the sample index in the time domain, is the length of the discrete Fourier transform, Represents an imaginary unit.

[0088] 505. Multiply each segment of the frequency domain preprocessed ECG signal by the corresponding segment of the frequency domain reference signal to obtain a frequency domain signal to be detected.

[0089] In the convolution formula of step 504, the time domain convolution operation between the preprocessed signal and the reference signal can be converted into a frequency domain multiplication operation according to the convolution theorem. Specifically, the convolution theorem shows that performing a time domain convolution operation on two signals is equivalent to performing a product operation on the two signals in the frequency domain and then performing an inverse Fourier transform to obtain a time domain result. Therefore, we have:

[0090] in, represents the output signal in step 504 In the frequency domain The complex value corresponding to each discrete frequency.

[0091] 506. Process the frequency domain signal to be detected based on inverse fast Fourier transform to obtain the signal to be detected.

[0092] The inverse fast Fourier transform is the reverse operation of the Fourier transform, which can convert the frequency domain data back to the time domain data. Specifically, the frequency domain signal to be detected is processed based on the inverse fast Fourier transform to obtain the signal to be detected. The formula used is as follows:

[0093] in, Representatives Perform inverse Fourier transform to obtain time domain data.

[0094] Finally get This is the signal to be detected. The signal to be detected diagram obtained after the processing can be referred to Figure 6 , Figure 6 This is a schematic diagram of the signal to be detected provided in this application.

[0095] 507. Convert the signal to be detected into a reference signal and perform iteration.

[0096] It is worth noting that based on step 506 There may still be a certain deviation in accuracy. In this case, the signal to be detected can be converted into a reference signal; the step of convolving the pre-processed ECG signal of each segment with the reference signal of the corresponding segment to obtain the signal to be detected can be re-executed. Specifically, the signal to be detected can be processed based on the method described in steps 502 and 503 to obtain a new reference signal, and the new reference signal and the pre-processed signal are processed as described in steps 504 to 506, that is, the first output result of step 506 does not directly enter the processing process of the subsequent step 508, but is re-iteratively processed, and the final iterative result is used as the signal to be detected and enters step 508 for processing, so as to further refine the estimation of the target result. In the actual implementation process, the number of iterations depends on the actual situation, and can be specifically set to a fixed number of iterations, that is, the number of repeated executions of steps 504 to 506 is set to 3 or 5 times. When the number of repeated executions meets the preset requirements, step 508 is executed to perform heart rate detection based on the results after repeated execution. The output result of step 506 may also be analyzed. If the output result meets specific requirements, the iteration result is determined to be relatively accurate, and step 508 is executed. In actual implementation, the specific settings may be determined according to actual conditions and are not limited here.

[0097] 508. Perform heart rate detection based on the signal to be detected.

[0098] Specifically, the heart rate detection is performed based on the iterated signal to be detected. Specifically, the detection process can refer to Figure 7 The corresponding embodiments are not described in detail here.

[0099] Figure 7 A schematic diagram of a heart rate detection process based on a signal to be detected provided in the present application includes: steps 701 to 706.

[0100] 701. Set the duration of the peak detection sliding window.

[0101] The calculation of heart rate usually depends on the accuracy of R peak detection. In adaptive peak detection, the output value can be compared with the current mean and standard deviation. If the output exceeds a certain multiple of the current mean and standard deviation, it will be considered a peak, and the peak detection threshold will be adjusted adaptively as the data changes. To perform peak detection, the peak detection process first needs to set the duration of the peak detection sliding window. In the actual implementation process, the duration of the peak detection sliding window can be set according to actual needs and is not limited here.

[0102] 702. Calculate the mean and standard deviation of the signal to be detected in the peak detection sliding window.

[0103] In order to dynamically adjust the threshold of adaptive peak detection, it is necessary to calculate the mean and standard deviation of the signal within a sliding window. These two parameters determine the baseline level and fluctuation amplitude of the signal respectively.

[0104]

[0105]

[0106] in is the mean, is the standard deviation, is the signal value, N is the window size used to calculate the mean, and m is the current time.

[0107] 703. Calculate an adaptive threshold based on the mean and the standard deviation; According to the mean and standard deviation of the current signal, set the adaptive detection threshold. The threshold is usually a multiple of the mean and standard deviation, representing the significance of the signal change. The calculation formula of the adaptive threshold is as follows: .

[0108] 704. Extract multiple candidate areas whose detection signals are greater than the adaptive threshold; 705. Determine the maximum value in each of the multiple candidate areas as peak data to obtain multiple peak data.

[0109] When the signal value Exceeding the threshold , it can be considered as a potential peak area. However, simply exceeding the threshold is not enough to determine the existence of a peak, because sometimes the signal will fluctuate for a short time. Therefore, the peak maximum value strategy is usually adopted, that is, in the area where the signal exceeds the threshold, the maximum value of the area is selected as the final peak value to ensure that the detected peak is the maximum value of the candidate peak area.

[0110] The specific formula is:

[0111] 706. Calculate heart rate information based on the peak data.

[0112] The RR interval refers to the time interval between two adjacent R peaks in the ECG signal. The change in the RR interval not only reflects the speed of the heart rate, but is also closely related to the activity of the autonomic nervous system, and can provide deeper insights into the health status of the heart. By accurately calculating the RR interval, the real-time heart rate (HR) of the ECG signal can be effectively estimated, thereby providing important data support for heart health monitoring. The specific RR period is the time interval between two adjacent peak data. Based on the multiple peak data obtained in step 705 above, multiple RR periods can be calculated. Specifically, the calculation of the heart rate is usually achieved through the following formula:

[0113] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: Figure 2 , Figure 5 , Figure 7The embodiments together provide a heart rate detection method based on an ECG signal, including: obtaining an original ECG signal; preprocessing the original ECG signal to obtain a preprocessed ECG signal; segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; flipping the multiple segments of preprocessed ECG signals in the time domain to obtain multiple reference signals; convolving each segment of the preprocessed ECG signal with the corresponding segment of the reference signal to obtain a signal to be detected; performing peak detection based on the signal to be detected to obtain multiple peak data; and calculating the heart rate information based on the peak data. Based on the above method, by comparing the similarity between the original signal and the reference signal, the reference signal obtained after flipping retains the original frequency information, while the noise is eliminated, so that the frequency and phase information of the original signal can be effectively extracted, significantly improving the accuracy and anti-interference ability of heart rate detection. The present application also provides a heart rate detection device and a readable storage medium, which have the same beneficial effects as the above method.

[0114] The above content describes the heart rate detection method based on ECG signal provided by the present application. To support the implementation of the above embodiment, the present application also provides a heart rate detection device based on ECG signal. Figure 8 An embodiment of a heart rate detection device based on an electrocardiogram signal provided in the present application includes: A second aspect of an embodiment of the present application provides a heart rate detection device based on an electrocardiogram signal, comprising: An acquisition unit 801 is used to acquire an original ECG signal; The preprocessing unit 802 is used to preprocess the original ECG signal to obtain a preprocessed ECG signal; A segmentation unit 803, used for segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; A flip unit 804 is used to flip the multiple segments of pre-processed ECG signals in the time domain to obtain multiple segments of reference signals; A convolution unit 805, configured to convolve the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain a signal to be detected; A detection unit 806, configured to perform peak detection based on the signal to be detected to obtain a plurality of peak data; The calculation unit 807 is used to calculate the heart rate information based on the peak data.

[0115] Optionally, the preprocessing unit is specifically used for: Performing bandpass filtering on the original electrocardiogram signal to obtain a first intermediate signal; Performing secondary differential filtering on the first intermediate signal to obtain a second intermediate signal; performing an absolute value operation on the second intermediate signal to obtain a third intermediate signal; Set the sliding integration window length; Perform sliding integration on the third intermediate signal to obtain a preprocessed electrocardiogram signal.

[0116] Optionally, the segmentation unit is specifically used for: Set the reference signal window duration; The preprocessed ECG signal is segmented based on the reference signal window duration.

[0117] Optionally, the flip unit is specifically used for: The multiple segments of preprocessed ECG signals are normalized, and each segment of the reference signal is flipped in the time domain to obtain multiple segments of reference signals.

[0118] Optionally, the convolution unit is specifically used for: Convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment based on Fourier transform to obtain the preprocessed ECG signal of each segment in the frequency domain and the reference signal of the corresponding segment in the frequency domain; Multiplying each segment of the frequency domain preprocessed ECG signal with the corresponding segment of the frequency domain reference signal to obtain the frequency domain signal to be detected; The frequency domain signal to be detected is processed based on inverse fast Fourier transform to obtain the signal to be detected.

[0119] Optionally, the device further includes: The iterative unit is used to: use the signal to be detected as the preprocessed signal, re-input it into the segmentation unit, and re-process it by the flip unit and the convolution unit.

[0120] Optionally, The detection unit is specifically used for: Set the duration of the peak detection sliding window; Calculating the mean and standard deviation of the signal to be detected within the peak detection sliding window; Calculating an adaptive threshold based on the mean and standard deviation; Extracting a plurality of candidate regions whose detection signals are greater than the adaptive threshold; The maximum values ​​in the multiple candidate areas are respectively determined as peak data to obtain multiple peak data.

[0121] In this embodiment, the processes performed by each unit in the device are the same as those described above. Figure 1 , Figure 2 , Figure 5 or Figure 7 The method flow described in the corresponding embodiment is similar and will not be repeated here.

[0122] Fig. 9It is a structural diagram of a heart rate detection device based on an electrocardiogram signal provided in an embodiment of the present application. The heart rate detection device 900 may include one or more central processing units (CPU) 901 and a memory 905. The memory 905 stores one or more application programs or data.

[0123] In this embodiment, the specific functional module division in the central processing unit 901 can be the same as the above Figure 8 The functional module division method of each unit described in is similar and will not be repeated here.

[0124] The memory 905 may be a volatile storage or a persistent storage. The program stored in the memory 905 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processor 901 may be configured to communicate with the memory 905 and execute a series of instruction operations in the memory 905 on the heart rate detection device 900.

[0125] The heart rate detection device 900 may further include one or more power supplies 902 , one or more wired or wireless network interfaces 903 , one or more input and output interfaces 904 , and / or one or more operating systems.

[0126] The CPU 901 can execute the aforementioned Figure 1 , Figure 2 , Figure 5 or Figure 7 The operations performed by the heart rate detection method in the illustrated embodiment will not be described in detail here.

[0127] An embodiment of the present application also provides a computer storage medium for storing computer software instructions used for the above-mentioned heart rate detection method based on electrocardiogram signals, including a program for executing a heart rate detection device.

[0128] The heart rate detection method based on the electrocardiogram signal can be as described above. Figure 1 , Figure 2 , Figure 5 or Figure 7 The heart rate detection method based on ECG signal is described in.

[0129] The present application also provides a computer program product, which includes computer software instructions, which can be loaded by a processor to implement the above Figure 1 , Figure 2 , Figure 5 or Figure 7 The process of any one of the heart rate detection methods based on electrocardiogram signals.

[0130] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the equivalent transformation of the circuit, the division of the unit, is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0133] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent substitution or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A heart rate detection method based on electrocardiogram signal, characterized in that: include: Get the original ECG signal; Preprocessing the original ECG signal to obtain a preprocessed ECG signal; Segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; Respectively flipping the multiple segments of preprocessed ECG signals in the time domain to obtain multiple segments of reference signals; Convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain a signal to be detected; Perform peak detection based on the signal to be detected to obtain multiple peak data; The heart rate information is calculated based on the peak data.

2. The heart rate detection method based on electrocardiogram signal according to claim 1, characterized in that: The preprocessing of the original electrocardiogram signal comprises: Performing bandpass filtering on the original electrocardiogram signal to obtain a first intermediate signal; Performing secondary differential filtering on the first intermediate signal to obtain a second intermediate signal; performing an absolute value operation on the second intermediate signal to obtain a third intermediate signal; Set the sliding integration window length; Perform sliding integration on the third intermediate signal to obtain a preprocessed electrocardiogram signal.

3. The heart rate detection method based on electrocardiogram signal according to claim 1, characterized in that: The segmenting of the preprocessed electrocardiogram signal comprises: Set the reference signal window duration; The preprocessed ECG signal is segmented based on the reference signal window duration.

4. The heart rate detection method based on electrocardiogram signal according to claim 1, characterized in that: The method of flipping the multiple segments of pre-processed ECG signals in the time domain to obtain multiple segments of reference signals includes: The multiple segments of preprocessed ECG signals are normalized, and each segment of the reference signal is flipped in the time domain to obtain multiple segments of reference signals.

5. The heart rate detection method based on electrocardiogram signal according to claim 1, characterized in that: The convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain the signal to be detected includes: Convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment based on Fourier transform to obtain the preprocessed ECG signal of each segment in the frequency domain and the reference signal of the corresponding segment in the frequency domain; Multiplying each segment of the frequency domain preprocessed ECG signal with the corresponding segment of the frequency domain reference signal to obtain the frequency domain signal to be detected; The frequency domain signal to be detected is processed based on inverse fast Fourier transform to obtain the signal to be detected.

6. The heart rate detection method based on electrocardiogram signal according to claim 1, characterized in that: After the step of convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain the signal to be detected, and before performing peak detection based on the signal to be detected to obtain multiple peak data, the method further includes: Converting the signal to be detected into a reference signal; Re-execute the step of convolving each segment of the pre-processed ECG signal with the corresponding segment of the reference signal to obtain the signal to be detected.

7. The heart rate detection method based on electrocardiogram signal according to claim 1, characterized in that: The peak value detection is performed based on the signal to be detected to obtain a plurality of peak value data, including: Set the duration of the peak detection sliding window; Calculating the mean and standard deviation of the signal to be detected within the peak detection sliding window; Calculating an adaptive threshold based on the mean and standard deviation; Extracting a plurality of candidate regions whose detection signals are greater than the adaptive threshold; The maximum values ​​in the multiple candidate areas are respectively determined as peak data to obtain multiple peak data.

8. A heart rate detection device based on electrocardiogram signal, characterized in that: include: An acquisition unit, used for acquiring original ECG signals; A preprocessing unit, used for preprocessing the original ECG signal to obtain a preprocessed ECG signal; A segmentation unit, used for segmenting the preprocessed ECG signal to obtain multiple segments of preprocessed ECG signals; A flip unit, used for flipping the multiple segments of pre-processed ECG signals in the time domain to obtain multiple segments of reference signals; A convolution unit, used for convolving the preprocessed ECG signal of each segment with the reference signal of the corresponding segment to obtain a signal to be detected; A detection unit, used for performing peak detection based on the signal to be detected to obtain a plurality of peak data; A calculation unit is used to calculate the heart rate information based on the peak data.

9. A heart rate detection device based on electrocardiogram signal, characterized in that: include: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a transient memory or a persistent memory; The central processing unit is configured to communicate with the memory, and execute instructions in the memory on the device to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Self-adaptive threshold R peak detection and heart rhythm classification method and device based on histogram

    CN115120248A

  • Radar high-precision heart rate detection method based on fitting matched filtering and Double-CZT

    CN116725507A

  • Electrocardiosignal R-wave monitoring method and wearable device thereof

    CN117481665A

  • Noise processing method and device for electrocardiosignal, electronic equipment and storage medium

    CN118319237A

  • Heart rate detection method capable of resisting motion interference

    CN118975788A

Cited By

  • Exercise heart rate detection method and device and readable storage medium

    CN120227008A