Heart rate detection method capable of resisting motion interference
By using acceleration sensor data to filter and differential processing of the ECG signal, combined with convolutional calculation, the error problem of heart rate detection during exercise is solved, and more accurate heart rate detection is achieved.
Patent Information
- Application Number
- CN202411234691.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-19
AI Technical Summary
The existing heart rate detection device is susceptible to motion interference during movement, resulting in the submerged electrocardiogram signal, thereby increasing the error and difficulty of heart rate detection, especially the difficulty of positioning the R-wave position.
Acceleration sensor data is used to filter the ECG signal, motion interference is removed through NLMS adaptive filter, first-order difference and Shannon energy calculation are performed to enhance R waves, and combined with convolutional calculation and normalization processing to find the real R waves, calculate Heart rate.
It effectively removes motion interference, improves the accuracy of heart rate detection, reduces errors, and enhances the reliability of R-wave positioning.
Smart Images

Figure CN118975788A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of instrument detection, and in particular to a heart rate detection method capable of resisting motion interference. Background Art
[0002] In the prior art, when a user wears a heart rate detection device to exercise, the ECG signal collected by the heart rate detection device is often accompanied by severe motion interference. Since the ECG signal is a very weak physiological low-frequency electrical signal, these motion interferences may drown out the original ECG signal. The weak and low-frequency characteristics of the human body's ECG signal are often easily interfered by the outside world during the ECG collection process.
[0003] The heart rate is calculated by finding the RR interval time in the ECG signal, so motion interference often makes the detection of heart rate more difficult; at the same time, it is not easy to accurately locate the R wave position of certain abnormal ECG signals using traditional methods, which leads to large errors in the calculated heart rate. Summary of the invention
[0004] In view of the technical problem in the prior art that heart rate detection is easily disturbed by external motion, resulting in large detection errors, the present invention proposes a heart rate detection method that is resistant to motion interference.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] A heart rate detection method capable of resisting motion interference specifically comprises the following steps:
[0007] S1: Read ECG signal and acceleration sensor data from the memory;
[0008] S2: Using the acceleration sensor data to filter the ECG signal to obtain a pure ECG signal;
[0009] S3: Perform R wave enhancement operation on the pure ECG signal to output convolution energy;
[0010] S4: normalize the convolution energy and find the preparatory R wave;
[0011] S5: Find the real R wave based on the prepared R wave;
[0012] S6: Calculate heart rate using true R waves.
[0013] Preferably, S2 includes:
[0014] S21: Perform electromyographic noise filtering on the electrocardiogram signal to obtain a first result;
[0015] S22: Perform power frequency noise filtering on the first result to obtain a second result;
[0016] S23: performing baseline drift filtering on the second result to obtain a third result;
[0017] S24: Perform motion interference filtering on the third result to obtain a fourth result, ie, a pure ECG signal.
[0018] Preferably, in S24, the method of motion interference filtering is:
[0019] S24-1: Calculate the total acceleration data acc(n) from the acceleration sensor data obtained in S1:
[0020]
[0021] In formula (1), X(n) represents the acceleration sensor data of the X axis; Y(n) represents the acceleration sensor data of the Y axis; Z(n) represents the acceleration sensor data of the Z axis;
[0022] S24-2: The ECG signal d(n) with motion interference is composed of the pure ECG signal z(n) and the motion interference data noise(n):
[0023] d(n)=z(n)+noise(n) (2)
[0024] S24-3: Minimize the root mean square of the error e(n) by using the NLMS algorithm to obtain the NLMS adaptive filter weight ω(n);
[0025]
[0026] In formula (3), y(n) represents the intermediate signal output by the NLMS adaptive filter; ω(n) represents the weight of the NLMS-like adaptive filter; acc(n) represents the combined acceleration data; d(n) represents the ECG signal with motion interference; e(n) represents the error; e i represents the i-th error value;
[0027] S24-4: Finally, the intermediate signal y(n) is made infinitely close to the motion interference data noise(n), and a pure ECG signal is calculated:
[0028] z(n)=d(n)-y(n) (4)
[0029] In formula (4), z(n) represents a pure ECG signal.
[0030] Preferably, in S24-3, the NLMS adaptive filter weight ω(n) is updated as follows:
[0031]
[0032] In formula (5), ω(i+1) represents the i+1th weight value, ω(i) represents the i-th weight value, and each weight value corresponds to each combined acceleration data; λ is the convergence step factor; acc(i) represents the i-th combined acceleration data; i∈1:n; n represents the sample size.
[0033] Preferably, S3 includes:
[0034] S3-1: Perform first-order difference calculation on the pure ECG signal to obtain the first-order difference value:
[0035] x(i)=z(i+1)-z(i-1) (6)
[0036] In formula (6), x(i) represents the first-order difference value of the i-th value in z(n); all first-order difference values are uniformly recorded as x(n); z(i+1) represents the i+1-th value of the pure ECG signal; z(i-1) represents the i-1-th value of the pure ECG signal; 2≤i≤n;
[0037] S3-2: Perform Shannon energy calculation on the first-order difference value to obtain the Shannon result:
[0038] Sn(n)=|-(x(n)) 2 ×log(x(n)) 2 | (7)
[0039] In formula (7), Sn(n) represents the Shannon result; x(n) represents the first-order difference value;
[0040] S3-3: Convolution calculation of Shannon result outputs convolution energy:
[0041]
[0042] In formula (8), conv(n) represents convolution energy; Sn(n) represents Shannon result; * represents convolution multiplication.
[0043] Preferably, the S4 includes:
[0044] S4-1: Normalize the convolution energy and output the normalized convolution energy:
[0045]
[0046] In formula (9), α represents the scaling factor; conv(n) represents the convolution energy; norconv(n) represents the normalized convolution energy; max represents the maximum function; min represents the minimum function; i∈(1,…,n);
[0047] S4-2: Search for the preparatory R wave based on the normalized convolution energy.
[0048] Preferably, in S4-2, the method for searching the preparatory R wave is:
[0049] The normalized convolution energy data is segmented by sliding every 2 seconds, and the 50 largest and 50 smallest data of each segment are taken for weighted averaging to obtain the maximum and minimum mean values of each segment; the preparatory R wave threshold thr of the current segment is calculated by the maximum and minimum mean values, and the peak in each segment that is greater than the preparatory R wave threshold thr is taken as the preparatory R wave;
[0050] The specific calculation formula of the preparatory R wave threshold thr is as follows:
[0051] thr=(maxthr-minthr)×α thr1 (10)
[0052] In formula (10), thr represents the preparatory R wave threshold; maxthr represents the maximum mean value of each segment; minthr represents the minimum mean value of each segment; α thr1 Represents the preparatory R wave threshold coefficient.
[0053] Preferably, in S5, the method for finding the real R wave is:
[0054] By finding R waves with more than 10 similar points in the prepared R wave, marking them as abnormal R waves, eliminating the abnormal R waves in the prepared R wave, and obtaining the real R wave.
[0055] Preferably, in S6, the calculation formula of the heart rate is:
[0056]
[0057] In formula (11), Hr is the heart rate; T n is the time when the nth real R wave appears; T 1 is the time when the first real R wave appears, N R The deadline is T n The total number of true R waves.
[0058] In summary, due to the adoption of the above technical solution, compared with the prior art, the present invention has at least the following beneficial effects:
[0059] The present invention introduces acceleration sensor data to filter the ECG signal, which can effectively filter out motion interference and enhance the accuracy of heart rate calculation. At the same time, for some abnormal ECG signals, it is not easy to locate the R wave position using traditional calculation methods. The convolution calculation method is introduced to locate the R wave, which effectively solves the problem of difficult R wave positioning, thereby reducing the error of heart rate detection and improving the accuracy of heart rate detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Schematic diagram of a heart rate detection method capable of resisting motion interference according to an exemplary embodiment of the present invention.
[0061] Figure 2 FIG. 4 is a schematic diagram of a filtering process according to an exemplary embodiment of the present invention.
[0062] Figure 3 FIG. 4 is a schematic diagram of the effect of filtering out motion interference according to an exemplary embodiment of the present invention.
[0063] Figure 4 Schematic diagram of a real R wave according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0064] The present invention is further described in detail below in conjunction with the examples and specific implementation methods. However, this should not be understood as the scope of the above subject matter of the present invention being limited to the following examples, and all technologies realized based on the content of the present invention belong to the scope of the present invention.
[0065] In the description of the present invention, it is necessary to understand that the terms "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0066] like Figure 1 As shown, the present invention also provides a heart rate detection method that can resist motion interference, which specifically includes the following steps:
[0067] S1: Read ECG signal and acceleration sensor data from the memory.
[0068] In this embodiment, the collected ECG signals and acceleration sensor data are stored in the memory, and the signals are not directly collected from the human body.
[0069] S2: Using the acceleration sensor data to filter the ECG signal to obtain a pure ECG signal;
[0070] In this embodiment, Figure 2 As shown, the filtering processing operations include myoelectric noise filtering processing, power frequency noise filtering processing, baseline drift filtering processing, and motion interference filtering processing, which can be performed in sequence.
[0071] S21: performing myoelectric noise filtering on the ECG signal to obtain a first result: selecting a Butterworth filter with a passband frequency of 0.5 Hz and a stopband frequency of 35 Hz to filter out the myoelectric noise mixed in the ECG signal;
[0072] S22: Perform power frequency noise filtering on the first result to obtain a second result: select a 50 Hz IIR single notch filter with a bandwidth of ±0.01 to filter out power frequency noise mixed in the ECG signal;
[0073] S23: performing baseline drift filtering processing on the second result to obtain a third result: passing the signal through a high-pass filter with a cutoff frequency of 2 Hz to filter out the baseline drift in the ECG signal;
[0074] S24: Perform motion interference filtering on the third result to obtain a fourth result (ie, a pure ECG signal): introduce the combined acceleration data, and use an NLMS (Normalized Least Mean Square) adaptive filter to filter out motion interference in the ECG signal.
[0075] S24-1: Calculate the total acceleration data acc(n) from the acceleration sensor data obtained in S1:
[0076]
[0077] In formula (1), X(n) represents the acceleration sensor data of the X axis; Y(n) represents the acceleration sensor data of the Y axis; and Z(n) represents the acceleration sensor data of the Z axis.
[0078] S24-2: The ECG signal d(n) with motion interference is composed of the pure ECG signal z(n) and the motion interference data noise(n). d(n) is composed of the following formula:
[0079] d(n)=z(n)+noise(n) (2)
[0080] S24-3: Minimize the root mean square of the error e(n) by using the NLMS algorithm to obtain a set of fixed NLMS adaptive filter weights ω(n);
[0081]
[0082] In formula (3), y(n) represents the intermediate signal output by the NLMS adaptive filter; ω(n) represents the weight of the NLMS-like adaptive filter; acc(n) represents the combined acceleration data; d(n) represents the ECG signal with motion interference; e(n) represents the error; e i represents the i-th error value;
[0083] In this embodiment, the NLMS adaptive filter weight ω(n) is calculated as follows:
[0084]
[0085] In formula (4), i∈(1,…,n); λ is the convergence step factor, which is set to 0.001 here.
[0086] S24-4: Finally, the intermediate signal y(n) is made to be infinitely close to the motion interference data noise(n), and a pure ECG signal z(n) is calculated to achieve the purpose of filtering out motion interference. The filtering formula is as follows:
[0087]
[0088] In formula (5), y(n) represents the intermediate signal that is infinitely close to noise(n); ω(n) represents the weight of the NLMS adaptive filter; acc(n) represents the combined acceleration data; d(n) represents the ECG signal with motion interference; and z(n) represents the pure ECG signal.
[0089] In this embodiment, the ECG signal is filtered to remove motion interference in the ECG signal to obtain a pure ECG signal. Figure 3 shown.
[0090] S3: Perform R-wave enhancement operation on the pure ECG signal to output convolution energy.
[0091] In this embodiment, the R wave enhancement operation includes the following processes: first-order difference calculation, Shannon energy calculation, and convolution calculation.
[0092] S3-1: Perform first-order difference calculation on the pure ECG signal to obtain a first-order difference value.
[0093] The first-order difference calculation of the pure ECG signal z(n) can enhance the R wave and suppress part of the P wave and T wave. The first-order difference calculation formula is as follows:
[0094] x(i)=z(i+1)-z(i-1) (6)
[0095] In formula (6), x(i) represents the first-order difference value of the i-th value in z(n); all first-order difference values are uniformly recorded as x(n); z(i+1) represents the i+1-th value of the pure ECG signal; z(i-1) represents the i-1-th value of the pure ECG signal; here 2≤i≤n.
[0096] S3-2: Perform Shannon energy calculation on the first-order difference value to obtain the Shannon result: Performing Shannon energy calculation on the difference value x(n) can further enhance the R wave and eliminate some tall T waves. The Shannon result calculation formula is as follows:
[0097] Sn(n)=|-(x(n)) 2 ×log(x(n)) 2 | (7)
[0098] In formula (7), Sn(n) represents the Shannon result; x(n) represents the first-order difference value calculated from the pure ECG signal z(n);
[0099] S3-3: Perform convolution calculation on Shannon's result and output convolution energy: Through forward and reverse convolution calculation, the R wave is completely distinguished from some interferences that are difficult to filter out. The specific convolution calculation formula is as follows:
[0100]
[0101] In formula (8), conv(n) represents convolution energy; Sn(n) represents Shannon result; * represents convolution multiplication.
[0102] S4: Normalize the convolution energy and search for the preparatory R wave.
[0103] S4-1: Normalize the convolution energy and output the normalized convolution energy.
[0104] In order to facilitate the subsequent preliminary R wave search, the calculated convolution energy is first normalized; the specific implementation method can refer to the following formula:
[0105]
[0106] In formula (9), α represents the scaling factor; conv(n) represents the convolution energy; norconv(n) represents the normalized convolution energy; max represents the maximum function; and min represents the minimum function.
[0107] S4-2: Search for the preparatory R wave based on the normalized convolution energy.
[0108] In this embodiment, the normalized convolution energy data is segmented by sliding every 2 seconds, and the 50 largest data and the 50 smallest data of each segment are taken and weighted averaged to obtain the maximum and minimum means of each segment; the preparatory R wave threshold thr of the current segment is calculated by the maximum and minimum means, and the peak in each segment that is greater than the preparatory R wave threshold thr is taken as the preparatory R wave.
[0109] The specific calculation formula of the preparatory R wave threshold thr is as follows:
[0110] thr=(maxthr-minthr)×α thr1 (10)
[0111] In formula (10), thr represents the preparatory R wave threshold; maxthr represents the maximum mean value of each segment; minthr represents the minimum mean value of each segment; α thr1 It represents the preparatory R wave threshold coefficient, and its value is 0.12.
[0112] S5: Searching for the real R wave based on the preliminary R wave.
[0113] In this embodiment, some tall T waves or strong motion artifacts in the preparatory R wave may cause misdetection or missed detection of the R wave. Therefore, the present invention searches for R waves with more than 10 similar points in the preparatory R wave, marks them as abnormal R waves, removes the abnormal R waves in the preparatory R wave, and obtains the real R wave. Figure 4 As shown, the points marked with * correspond to the real R waves.
[0114] S6: Calculate heart rate using true R waves.
[0115] In this embodiment, the heart rate is calculated by calculating the RR interval, and the specific calculation formula is as follows:
[0116]
[0117] In formula (11), Hr is the heart rate; T n is the time when the nth real R wave appears; T 1 is the time when the first real R wave appears, N R The deadline is T n The total number of true R waves.
[0118] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.
Claims
1. A heart rate detection method that can resist motion interference, characterized in that: The specific steps include: S1: Read ECG signal and acceleration sensor data from the memory; S2: Using the acceleration sensor data to filter the ECG signal to obtain a pure ECG signal; S3: Perform R wave enhancement operation on the pure ECG signal to output convolution energy; S4: normalize the convolution energy and find the preparatory R wave; S5: Find the real R wave based on the prepared R wave; S6: Calculate heart rate using true R waves.
2. A heart rate detection method capable of resisting motion interference as claimed in claim 1, characterized in that: The S2 includes: S21: Perform electromyographic noise filtering on the electrocardiogram signal to obtain a first result; S22: Perform power frequency noise filtering on the first result to obtain a second result; S23: performing baseline drift filtering on the second result to obtain a third result; S24: Perform motion interference filtering on the third result to obtain a fourth result, ie, a pure ECG signal.
3. A heart rate detection method capable of resisting motion interference as claimed in claim 2, characterized in that: In S24, the method of motion interference filtering is: S24-1: Calculate the total acceleration data acc(n) from the acceleration sensor data obtained in S1: In formula (1), X(n) represents the acceleration sensor data of the X axis; Y(n) represents the acceleration sensor data of the Y axis; Z(n) represents the acceleration sensor data of the Z axis; S24-2: The ECG signal d(n) with motion interference is composed of the pure ECG signal z(n) and the motion interference data noise(n): d(n)=z(n)+noise(n)(2) S24-3: Minimize the root mean square of the error e(n) by using the NLMS algorithm to obtain the NLMS adaptive filter weight ω(n); In formula (3), y(n) represents the intermediate signal output by the NLMS adaptive filter; ω(n) represents the weight of the NLMS-like adaptive filter; acc(n) represents the combined acceleration data; d(n) represents the ECG signal with motion interference; e(n) represents the error; e i represents the i-th error value; S24-4: Finally, the intermediate signal y(n) is made infinitely close to the motion interference data noise(n), and a pure ECG signal is calculated: z(n)=d(n)-y(n)(4) In formula (4), z(n) represents a pure ECG signal.
4. A heart rate detection method capable of resisting motion interference as claimed in claim 3, characterized in that: In S24-3, the NLMS adaptive filter weight ω(n) is updated as follows: In formula (5), ω(i+1) represents the i+1th weight value, ω(i) represents the ith weight value, and each weight value corresponds to each combined acceleration data; λ is the convergence step factor; acc(i) represents the i-th combined acceleration data; i∈1:n; n represents the sample size.
5. A heart rate detection method capable of resisting motion interference as claimed in claim 1, characterized in that: The S3 includes: S3-1: Perform first-order difference calculation on the pure ECG signal to obtain the first-order difference value: x(i)=z(i+1)-z(i-1)(6) In formula (6), x(i) represents the first-order difference value of the i-th value in z(n); all first-order difference values are uniformly recorded as x(n); z(i+1) represents the i+1-th value of the pure ECG signal; z(i-1) represents the i-1-th value of the pure ECG signal; 2≤i≤n; S3-2: Perform Shannon energy calculation on the first-order difference value to obtain the Shannon result: Sn(n)=|-(x(n)) 2 ×log(x(n)) 2 | (7) In formula (7), Sn(n) represents the Shannon result; x(n) represents the first-order difference value; S3-3: Convolution calculation of Shannon result outputs convolution energy: In formula (8), conv(n) represents convolution energy; Sn(n) represents Shannon result; * represents convolution multiplication.
6. A heart rate detection method capable of resisting motion interference as claimed in claim 1, characterized in that: The S4 includes: S4-1: Normalize the convolution energy and output the normalized convolution energy: In formula (9), α represents the scaling factor; conv(n) represents the convolution energy; norconv(n) represents the normalized convolution energy; max represents the maximum function; min represents the minimum function; i∈(1,…,n); S4-2: Search for the preparatory R wave based on the normalized convolution energy.
7. A method for detecting heart rate that is resistant to motion interference as claimed in claim 6, characterized in that: In S4-2, the method for searching the preparatory R wave is: The normalized convolution energy data is segmented by sliding every 2 seconds, and the 50 largest and 50 smallest data of each segment are taken for weighted averaging to obtain the maximum and minimum mean values of each segment; the preparatory R wave threshold thr of the current segment is calculated by the maximum and minimum mean values, and the peak in each segment that is greater than the preparatory R wave threshold thr is taken as the preparatory R wave; The specific calculation formula of the preparatory R wave threshold thr is as follows: thr=(maxthr-minthr)×α thr1 (10) In formula (10), thr represents the preparatory R wave threshold; maxthr represents the maximum mean value of each segment; minthr represents the minimum mean value of each segment; α thr1 Represents the preparatory R wave threshold coefficient.
8. A heart rate detection method capable of resisting motion interference as claimed in claim 1, characterized in that: In S5, the method for finding the real R wave is: By finding R waves with more than 10 similar points in the prepared R wave, marking them as abnormal R waves, eliminating the abnormal R waves in the prepared R wave, and obtaining the real R wave.
9. A heart rate detection method capable of resisting motion interference as claimed in claim 1, characterized in that: In S6, the calculation formula of the heart rate is: In formula (11), Hr is the heart rate; T n is the time when the nth real R wave appears; T1 is the time when the first real R wave appears, N R The deadline is T n The total number of true R waves.
Citation Information
Cited By
Identity authentication method based on mixed physiological state electrocardiosignal
CN119807774A
Heart rate detection method and device based on electrocardiosignal and readable storage medium
CN119908693A
A heart rate detection method, device and readable storage medium based on electrocardiogram signal
CN119908693B
