An adaptive threshold R-wave detection method, device, equipment and storage medium
By using an adaptive threshold detection method, the problem of threshold adjustment when the amplitude of ECG signals changes rapidly is solved, which improves the accuracy and efficiency of R-wave detection and reduces noise interference and computational load.
Patent Information
- Application Number
- CN202310258394.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-03-14
AI Technical Summary
Existing technologies for detecting the R-wave peak of electrical signals have difficulty adjusting the threshold quickly when the amplitude level changes rapidly, leading to missed and false detections of the R-wave.
An adaptive threshold detection method is adopted. By preprocessing the original electrocardiogram signal, the position and amplitude of the upper peak point are determined, the noisy upper peak point is eliminated, the missed detection backtracking position is set, the adaptive threshold is attenuated according to the length of the missed detection backtracking segment, and the threshold is updated to detect the R wave.
It improves the accuracy of R-wave detection, reduces the risk of missed and false R-wave detections, reduces computational load, and avoids noise interference.
Smart Images

Figure CN116350238B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrocardiogram signal detection technology, and in particular to an adaptive threshold R-wave detection method, apparatus, device, and storage medium. Background Technology
[0002] An electrocardiogram (ECG) is an objective indicator of the occurrence, propagation, and recovery of cardiac excitation. As a comprehensive representation of cardiac activity on the body surface, the ECG signal contains rich physiological and pathological information reflecting cardiac rhythm and electrical conduction. To a certain extent, it can objectively reflect the physiological condition of various parts of the heart and is one of the important bases for diagnosing cardiac diseases and evaluating cardiac function. It is particularly valuable for the diagnosis and analysis of various arrhythmias and conduction disorders, and is currently the most accurate method for analyzing and differentiating arrhythmia diseases.
[0003] Currently, there are numerous algorithms for R-wave peak detection in electrocardiogram (ECG) signals, such as differential thresholding, wavelet transform, template matching, length and energy transformation, and neural networks. Given the characteristics of non-invasive ECG signals—high noise interference, weak signal strength, and high variability—each method has its advantages and disadvantages. Traditional differential thresholding is simple, easy to implement, and relatively fast; wavelet transform has good time-frequency localization characteristics and high detection accuracy, but its computational load is large, making it unsuitable for real-time processing; template matching is simple in principle, but it is extremely sensitive to high-frequency noise and baseline drift; neural network methods have good discrimination performance, but their training time is long and their real-time performance is poor.
[0004] Existing ECG signal R-wave peak detection methods have difficulty adjusting the threshold quickly for signals with rapidly changing amplitude levels, which can easily lead to missed detections. Furthermore, during the process of missed detections, the threshold adjustment is limited, making it difficult to quickly adjust the threshold for different missed detections, thus causing false detections of ECG signal R-wave peaks. Summary of the Invention
[0005] In view of this, it is necessary to provide an adaptive threshold R-wave detection method, apparatus, device and storage medium to solve the problem that when the amplitude level of the central electrical signal changes rapidly in the prior art, it is difficult to adjust the threshold according to the missed detection situation, thus causing R-wave missed detection and false detection.
[0006] To achieve the above-mentioned technical objectives, the present invention adopts the following technical solution:
[0007] In a first aspect, the present invention provides an adaptive threshold R-wave detection method, comprising:
[0008] The raw electrocardiogram (ECG) signal is preprocessed to determine the position and amplitude of the upper peak of the preprocessed ECG signal.
[0009] Noise peaks are eliminated based on their location and amplitude, and the length of the missed detection backtracking segment is determined by setting the missed detection backtracking position.
[0010] Based on the preset missed detection backtracking rules, the adaptive threshold is attenuated according to the length of the missed detection backtracking segment.
[0011] The R wave in the missed segment of the ECG signal is detected based on the attenuated adaptive threshold and the amplitude of the upper convex peak, and the adaptive threshold is updated accordingly.
[0012] The system detects whether the current peak is an R-wave based on the updated adaptive threshold and then updates the adaptive threshold again.
[0013] In some possible implementations, the raw ECG signal is preprocessed to determine the location and amplitude of the upper peak of the preprocessed ECG signal, including:
[0014] The original electrocardiogram (ECG) signal was bandpass filtered to obtain a bandpass filtered ECG signal.
[0015] The bandpass filtered ECG signal is differentiated and the absolute value is taken to obtain the differentiated ECG signal;
[0016] The differentiated ECG signal is squared, and the squared differentiated ECG signal is integrated by moving window integration to obtain the integrated ECG signal.
[0017] Determine the location and amplitude of the upper convex peak of the differentiated ECG signal and the integrated ECG signal, respectively.
[0018] In some possible implementations, noisy peaks are excluded based on their location and amplitude, and the length of the missed detection backtracking segment is determined by setting the missed detection backtracking position, including:
[0019] Determine whether the upper peak of the differentiated ECG signal is noise based on the amplitude of the upper peak, and adjust the position of the backtracking starting point accordingly.
[0020] Determine whether the upper peak of the integrated ECG signal is noise based on the amplitude of the upper peak, and adjust the position of the backtracking starting point accordingly.
[0021] Determine whether the peak of the integrated electrocardiogram signal is a peaked T wave and whether the most recently detected R wave is a peaked P wave based on the location of the peak of the integrated electrocardiogram signal and the location of the most recently detected R wave.
[0022] The length of the missed detection backtracking segment is determined based on the adjusted backtracking starting point position.
[0023] In some possible implementations, determining whether the peak of the integrated ECG signal is a peaked T wave and whether the most recently detected R wave is a peaked P wave is based on the position of the peak and the most recently detected R wave. This includes:
[0024] When the distance between the position of the upper peak of the integrated ECG signal and the most recently detected R wave is less than a preset distance threshold, the wavelength corresponding to the current upper peak and the wavelength corresponding to the most recently detected R wave are calculated.
[0025] Based on the wavelength corresponding to the current upper peak, the wavelength corresponding to the most recently detected R wave, and the preset wavelength threshold, determine whether the current upper peak is a high-peak T wave and whether the most recently detected R wave is a high-peak P wave.
[0026] If the peak of the current integrated ECG signal is a tall, peaked T wave, then ignore the peak of the current integrated ECG signal and adjust the position of the backtracking starting point.
[0027] If the most recently detected R wave is a peaked P wave, then delete the most recently detected R wave.
[0028] In some possible implementations, based on preset missed detection backtracking rules, the adaptive threshold is attenuated according to the length of the missed detection backtracking segment, including:
[0029] Calculate the average distance between the most recently detected preset number of R waves to obtain the average RR interval;
[0030] The first and second missed detection backtracking trigger conditions are determined based on the average RR interval;
[0031] When the integrated ECG signal has a first missed detection backtracking, if the backtracking segment length of the integrated ECG signal meets the first missed detection backtracking triggering condition, the adaptive threshold will be attenuated according to the attenuation factor of the first missed detection backtracking threshold.
[0032] When the integrated ECG signal has a second missed detection backtracking, if the backtracking segment length of the integrated ECG signal meets the triggering condition for the second missed detection backtracking, the attenuation factor of the second missed detection backtracking threshold is determined based on the backtracking segment length and the average RR interval of the integrated ECG signal, and the adaptive threshold is attenuated according to the attenuation factor of the second missed detection backtracking threshold.
[0033] In some possible implementations, the adaptive threshold includes a signal threshold for the integrated ECG signal and a signal threshold for the derivative ECG signal; the R wave in the missed segment of the ECG signal is detected based on the attenuated adaptive threshold and the amplitude of the upper convex peak, and the adaptive threshold is updated, including:
[0034] When the amplitude of the upper peak of the integrated ECG signal is greater than the signal threshold of the integrated ECG signal, and the amplitude of the upper peak of the corresponding derivative ECG signal is greater than the signal threshold of the derivative ECG signal, the current upper peak is an R wave, and the position of the backtracking starting point is adjusted.
[0035] The signal thresholds of the integral ECG signal and the derivative ECG signal are updated using preset update rules.
[0036] In some possible implementations, the signal thresholds of the integral ECG signal and the derivative ECG signal are updated using preset update rules, including:
[0037] The signal level and noise level are updated based on the adaptive threshold and the amplitude of the upper convex peak.
[0038] The adaptive threshold is updated based on preset update rules, signal level, and noise level.
[0039] Secondly, the present invention also provides an adaptive threshold R-wave detection device, characterized in that it comprises:
[0040] The preprocessing module is used to preprocess the raw ECG signal and determine the position and amplitude of the upper peak of the preprocessed ECG signal.
[0041] The exclusion module is used to exclude noisy peaks based on their position and amplitude, and to set the missed detection backtracking position to determine the length of the missed detection backtracking segment.
[0042] The threshold decay module is used to decay the adaptive threshold based on the length of the missed detection backtracking segment according to the preset missed detection backtracking rules.
[0043] The missed detection backtracking module is used to detect the R wave in the missed segment of the ECG signal based on the attenuated adaptive threshold and the amplitude of the upper convex peak, and update the adaptive threshold.
[0044] The R-wave detection module is used to detect whether the current peak is an R-wave based on the updated adaptive threshold, and then update the adaptive threshold again.
[0045] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein,
[0046] Memory, used to store programs;
[0047] The processor, coupled to the memory, executes the program stored in the memory to implement the steps in the adaptive threshold R-wave detection method in any of the above implementations.
[0048] Fourthly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps in the adaptive threshold R-wave detection method described in any of the above implementations.
[0049] The beneficial effects of the above embodiments are as follows: The present invention relates to an adaptive threshold R-wave detection method, apparatus, device, and storage medium. The method includes: preprocessing the original electrocardiogram (ECG) signal to determine the position and amplitude of the upper peak of the preprocessed ECG signal; excluding noisy upper peaks based on the position and amplitude of the upper peak, and setting a missed detection backtracking position to determine the length of the missed detection backtracking segment; attenuating the adaptive threshold based on a preset missed detection backtracking rule and the length of the missed detection backtracking segment; detecting the R-wave in the missed segment of the ECG signal based on the attenuated adaptive threshold and the amplitude of the upper peak, and updating the adaptive threshold; detecting whether the current peak is an R-wave based on the updated adaptive threshold, and updating the adaptive threshold again. This invention relates to an adaptive threshold R-wave detection method, apparatus, device, and storage medium. First, the raw electrocardiogram signal is processed to avoid noise or other interference affecting detection accuracy, noise peaks are eliminated, and a missed detection backtracking position is set to avoid backtracking through noise segments. This avoids noise interference and reduces computational load. Then, the adaptive threshold is adjusted through missed detection backtracking, and R-wave detection is performed based on the adjusted adaptive threshold. The adaptive threshold is then updated, and R-wave detection is repeated. This reduces the risk of missed and false R-wave detection and improves the accuracy of R-wave detection. Attached Figure Description
[0050] Figure 1 This is a flowchart illustrating an embodiment of the adaptive threshold R-wave detection method provided by the present invention;
[0051] Figure 2 for Figure 1 A schematic flowchart of an embodiment of step S101;
[0052] Figure 3 for Figure 1 A schematic flowchart of an embodiment of step S102;
[0053] Figure 4 for Figure 3 A schematic flowchart of an embodiment of step S303;
[0054] Figure 5 for Figure 1 A schematic flowchart of an embodiment of step S103;
[0055] Figure 6 A schematic diagram of an embodiment of the adaptive threshold R-wave detection device provided by the present invention;
[0056] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0057] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0058] In the description of this application, "multiple" means two or more, unless otherwise expressly and specifically defined.
[0059] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0060] This invention provides an adaptive threshold R-wave detection method, apparatus, device, and storage medium, which are described below.
[0061] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the adaptive threshold R-wave detection method provided by the present invention. A specific embodiment of the present invention discloses an adaptive threshold R-wave detection method, comprising:
[0062] S101. Preprocess the original electrocardiogram signal to determine the position and amplitude of the upper peak of the preprocessed electrocardiogram signal.
[0063] S102. Eliminate noisy peaks based on their position and amplitude, and set the missed detection backtracking position to determine the length of the missed detection backtracking segment.
[0064] S103. Based on the preset missed detection backtracking rules, the adaptive threshold is attenuated according to the length of the missed detection backtracking segment.
[0065] S104. Detect the R wave in the missed segment of the ECG signal based on the attenuated adaptive threshold and the amplitude of the upper convex peak, and update the adaptive threshold.
[0066] S105. Detect whether the current peak is an R-wave based on the updated adaptive threshold, and update the adaptive threshold again.
[0067] In the above embodiments, the original electrocardiogram (ECG) signal of the present invention is a QRS ECG signal. The QRS ECG signal reflects the changes in the depolarization potential and time of the left and right ventricles. The first downward wave is the Q wave, the upward wave is the R wave, and the following downward wave is the S wave. The QRS ECG signal can be used to detect health status.
[0068] The raw electrocardiogram (ECG) signal may contain some interference during its generation, which needs to be processed to prevent it from affecting the detection of the R wave. The R wave is always accompanied by an upward convex point in the ECG signal. The location and amplitude of the upward convex point are important criteria for identifying the R wave. It is necessary to determine the location and amplitude of the upward convex point in order to make accurate judgments about the R wave.
[0069] The upper peak may be an R wave or interference noise. Further judgment is needed to rule out noise upper peaks. In order to prevent missed or false detections, the missed detection backtracking location, i.e., the backtracking point, is determined from the ECG signal, and the length of the missed detection backtracking segment is determined to accurately determine the missed detection of the upper peak.
[0070] When performing backtracking for missed detections, the attenuation factor of the adaptive threshold is first determined based on the location and length of the backtracking segment. Different attenuation factors need to be set for backtracking under different circumstances, so as to adjust the appropriate adaptive threshold for R-wave detection and improve the accuracy of R-wave detection.
[0071] R-wave detection requires a combination of an adaptive threshold after attenuation and the amplitude of the upper peak. During the R-wave detection process, the adaptive threshold is continuously adjusted according to the specific situation to accurately detect the R-wave in the missed segments of the ECG signal for different situations.
[0072] Compared with existing technologies, this embodiment provides an adaptive threshold R-wave detection method, which includes: preprocessing the original electrocardiogram (ECG) signal to determine the position and amplitude of the upper peak of the preprocessed ECG signal; excluding noisy upper peaks based on the position and amplitude of the upper peak, and setting a missed detection backtracking position to determine the length of the missed detection backtracking segment; attenuating the adaptive threshold based on a preset missed detection backtracking rule and the length of the missed detection backtracking segment; detecting the R-wave in the ECG signal based on the attenuated adaptive threshold and the amplitude of the upper peak, and updating the adaptive threshold. This invention relates to an adaptive threshold R-wave detection method, apparatus, device, and storage medium. First, the raw electrocardiogram signal is processed to avoid noise or other interference affecting detection accuracy, noise peaks are eliminated, and a missed detection backtracking position is set to avoid backtracking through noise segments. This avoids noise interference and reduces computational load. Then, the adaptive threshold is adjusted through missed detection backtracking, and R-wave detection is performed based on the adjusted adaptive threshold. The adaptive threshold is then updated, and R-wave detection is repeated. This reduces the risk of missed and false R-wave detection and improves the accuracy of R-wave detection.
[0073] Please see Figure 2 , Figure 2 for Figure 1 A flowchart illustrating an embodiment of step S101. In some embodiments of the present invention, the original electrocardiogram (ECG) signal is preprocessed to determine the position and amplitude of the upper peak of the preprocessed ECG signal, including:
[0074] S201. Perform bandpass filtering on the original ECG signal to obtain a bandpass filtered ECG signal;
[0075] S202. Differentiate and filter the bandpass filtered ECG signal and take its absolute value to obtain the differentiated ECG signal;
[0076] S203. Squaring the differentiated ECG signal and then performing moving window integration on the squared differentiated ECG signal to obtain the integrated ECG signal.
[0077] S204. Determine the position and amplitude of the upper convex peak of the differentiated ECG signal and the integrated ECG signal, respectively.
[0078] In the above embodiments, by performing bandpass filtering on the original electrocardiogram (ECG) signal, ECG signals within a specific frequency range are selected from the original signal, i.e., bandpass-filtered ECG signals, thereby narrowing the range of R-wave detection and improving the speed of R-wave detection.
[0079] The derivative of the ECG signal is denoted as signal D. The bandpass filtered ECG signal is directly differentiated and filtered, and then the absolute value is taken to obtain the derivative ECG signal. Then, signal D is squared, and the squared derivative ECG signal is integrated by moving window to obtain the integrated ECG signal, denoted as signal M.
[0080] In a preferred embodiment, the average integration process of the moving window (window width is 130ms, assuming the number of sampling points is k) is as follows:
[0081] M(i)=[S(i-k+1)+S(i-k+2)+…+S(i)] / k;
[0082] The upward convex peaks in signal M are detected, and the interval between peaks should be greater than 200 milliseconds (the ventricular refractory period is 200 milliseconds), resulting in n peaks. The positions of these upward convex peaks in signal M are denoted as peaks. M (i)(i=1,2,…,n-1,n), and measure the amplitude corresponding to the upper convex peak in signal M.
[0083] From the process of averaging integration using a moving window, we can see that: M (i) The average value of the first 130 milliseconds of the signal D. Therefore: In signal D, from the peaks M (i) The point with the largest amplitude within a backward 130 milliseconds (the window width of the average integral of the moving window) is the peak. D (i), amplitude is amp D (i).
[0084] Please see Figure 3 , Figure 3 for Figure 1 A flowchart illustrating one embodiment of step S102. In some embodiments of the present invention, noise peaks are eliminated based on their position and amplitude, and the length of the missed detection backtracking segment is determined by setting the missed detection backtracking position. This includes:
[0085] S301. Determine whether the upper peak of the differentiated ECG signal is noise based on the amplitude of the upper peak, and adjust the position of the backtracking starting point.
[0086] S302. Determine whether the upper peak of the integrated ECG signal is noise based on the amplitude of the upper peak of the integrated ECG signal, and adjust the position of the backtracking starting point.
[0087] S303. Determine whether the peak of the integrated electrocardiogram signal is a tall peak T wave and whether the most recently detected R wave is a tall peak P wave based on the position of the peak of the integrated electrocardiogram signal and the most recently detected R wave.
[0088] S304. Determine the length of the missed detection backtracking segment based on the adjusted backtracking starting point position.
[0089] In the above embodiments, for signal D, the main determination is whether it is noise with rapidly changing amplitude. If amp D (i) If the peak value is greater than 30 times the average of the five most recent R-wave amplitudes detected in the past, then this peak is noise and should be skipped. The starting point for backtracking missed detections, `searchbegin`, should be adjusted to `peaks`. M (i)+50 milliseconds.
[0090] For signal M, the main determination is whether it is continuously changing noise. If amp M (i) If the peak value is greater than 30 times the average of the five most recent detected R-wave amplitudes, then this peak is noise and should be skipped. The starting point for backtracking missed detections, `searchbegin`, should be adjusted to `peaks`. M (i)+50 milliseconds.
[0091] Tall peaked T waves generally refer to T waves with a height exceeding 1.5 mV on an electrocardiogram (ECG). Tall peaked T waves are usually considered abnormal. Normal P waves do not exceed 2.5 mm in height and are the sum of the excitation of the left and right atria. Right atrial excitation precedes left atrial excitation. When the right atrium enlarges, the right atrial wave enlarges and overlaps with the left atrial wave, producing a tall peaked P wave exceeding 2.5 mm in height.
[0092] Further analysis is needed to identify peaked T waves and peaked P waves in the electrocardiogram signal, and to avoid misinterpreting peaked T waves and peaked P waves as R waves.
[0093] Please see Figure 4 , Figure 4 for Figure 3 A flowchart illustrating an embodiment of step S303. In some embodiments of the present invention, determining whether the upper peak of the integrated electrocardiogram signal is a peaked T wave and whether the most recently detected R wave is a peaked P wave based on the position of the upper peak of the integrated electrocardiogram signal and the most recently detected R wave includes:
[0094] S401. When the distance between the position of the upper peak of the integrated electrocardiogram signal and the most recently detected R wave is less than a preset distance threshold, calculate the wavelength corresponding to the current upper peak and the wavelength corresponding to the most recently detected R wave.
[0095] S402. Based on the wavelength corresponding to the current upper peak, the wavelength corresponding to the most recently detected R wave, and the preset wavelength threshold, determine whether the current upper peak is a high-peak T wave and whether the most recently detected R wave is a high-peak P wave.
[0096] S403. If the peak of the current integrated ECG signal is a tall T wave, then ignore the peak of the current integrated ECG signal and adjust the position of the backtracking starting point.
[0097] S404. If the most recently detected R wave is a peaked P wave, then delete the most recently detected R wave.
[0098] In the above embodiments, the preset wavelength threshold (denoted as a) can be adjusted according to actual needs, and the present invention does not impose further restrictions on it. If the wavelength of the current upper convex peak is a times the wavelength of the most recently detected R wave, then the current upper convex peak is considered to be a high-peak T wave; if the wavelength of the most recently detected R wave is a times the wavelength of the current upper convex peak, then the most recently detected R wave is considered to be a high-peak P wave.
[0099] If the current upper peak is a high-peak T-wave, skip it directly, and adjust the starting point of the missed detection backtracking searchbegin to peaks. M (i) +50 milliseconds; if the most recently detected R wave is a high-peaked P wave, then delete this R wave.
[0100] Please see Figure 5 , Figure 5 for Figure 1 A flowchart illustrating an embodiment of step S103. In some embodiments of the present invention, based on a preset missed detection backtracking rule, the adaptive threshold is attenuated according to the length of the missed detection backtracking segment, including:
[0101] S501. Calculate the average distance between the most recently detected preset number of R waves to obtain the average RR interval;
[0102] S502. Determine the first and second missed detection backtracking trigger conditions based on the average RR interval;
[0103] S503. When the integrated ECG signal has a first missed detection backtracking, if the backtracking segment length of the integrated ECG signal meets the first missed detection backtracking triggering condition, the adaptive threshold will be attenuated according to the attenuation multiple of the first missed detection backtracking threshold.
[0104] S504. When the integrated ECG signal has a second missed detection backtracking, if the backtracking segment length of the integrated ECG signal meets the triggering condition for the second missed detection backtracking, the attenuation factor of the second missed detection backtracking threshold is determined according to the backtracking segment length and the average RR interval of the integrated ECG signal, and the adaptive threshold is attenuated according to the attenuation factor of the second missed detection backtracking threshold.
[0105] In the above embodiment, the preset number is 6. The average of the 6 most recent RR intervals is calculated to obtain the average RR interval. It should be noted that the preset number can also be set according to actual needs, and the present invention does not impose further restrictions on this.
[0106] The first missed detection backtracking is a single missed detection backtracking, and the second missed detection backtracking is a multiple missed detection backtracking. The trigger condition for a single missed detection backtracking is 1.4*meanRR < peaks. M (i) -searchbegin < 2.66 * mean RR, multiple missed detections trigger backtracking conditions are peaks M (i)-searchbegin≥2.66*meanRR.
[0107] The missed detection backtracking segment for signal M is: [searchbegin, peaks] of signal M. M (i) When a single missed detection backtracking trigger condition is met, the adaptive threshold is attenuated to 0.5 times its original value. When multiple missed detection backtracking trigger conditions are met, the attenuation factor of the second missed detection backtracking threshold is determined based on the backtracking segment length and the average RR interval of the integrated ECG signal, as follows:
[0108] If the current backtracking segment length is greater than 4 times the average RR interval, the threshold is reduced to 0.05 times the original threshold.
[0109] If the current backtracking segment length is greater than 3 times the average RR interval, the threshold is reduced to 0.1 times the original threshold;
[0110] If the current backtracking segment length is greater than 2.66 times the average RR interval, the threshold is reduced to 0.3 times the original threshold.
[0111] The adaptive threshold is attenuated based on the second missed detection backtracking threshold mentioned above.
[0112] It should be noted that the specific values mentioned above can also be adjusted according to actual needs, and this invention does not impose further restrictions in this regard.
[0113] In some embodiments of the present invention, the adaptive threshold includes a signal threshold for the integrated ECG signal and a signal threshold for the derivative ECG signal; detecting the R wave in the missed segment of the ECG signal based on the attenuated adaptive threshold and the amplitude of the upper convex peak, and updating the adaptive threshold, includes:
[0114] When the amplitude of the upper peak of the integrated ECG signal is greater than the signal threshold of the integrated ECG signal, and the amplitude of the upper peak of the corresponding derivative ECG signal is greater than the signal threshold of the derivative ECG signal, the current upper peak is an R wave, and the position of the backtracking starting point is adjusted.
[0115] The signal thresholds of the integral ECG signal and the derivative ECG signal are updated using preset update rules.
[0116] In the above embodiments, for an upper convex peak, it is necessary to make a judgment based on both the integrated ECG signal and the derivative ECG signal. The adaptive thresholds for signal M are the signal threshold thrmsig and the noise threshold thrmnoise. The adaptive thresholds for signal D are the signal threshold thrdsig and the noise threshold thrdnoise. However, when judging the R wave, it is only necessary to make a judgment based on the signal threshold, and the noise threshold is not required.
[0117] When the amplitude of a certain upper peak of signal M is amp M (i)≥thrmsig, and the amplitude of the corresponding upper peak of signal D is amp D When (i)≥thrdsig, the upper convex peak is an R-wave.
[0118] Each time an R-wave is detected, the position of the backtracking starting point needs to be adjusted, as described above, and will not be repeated here. Then, the signal thresholds for the integrated ECG signal and the derivative ECG signal need to be updated according to preset update rules.
[0119] In some embodiments of the present invention, the signal thresholds of the integral electrocardiogram (ECG) signal and the derivative ECG signal are updated using preset update rules, including:
[0120] The signal level and noise level are updated based on the adaptive threshold and the amplitude of the upper convex peak.
[0121] The adaptive threshold is updated based on preset update rules, signal level, and noise level.
[0122] In the above embodiments, the adaptive threshold update of signal M is used as an example for illustration, as follows:
[0123] The corresponding signal level levelmsig and noise level levelmnoise are determined based on the signal threshold thrmsig and the noise threshold thrmnoise. The signal level levelmsig and noise level levelmnoise can be used to update the thresholds.
[0124] If amp M If (i) >= thrmsig, then update levelmsig:
[0125] levelmsig = 0.125 * amp M (i)+0.875*levelmsig;
[0126] If the triggering condition for missed detection backtracking is met during the missed detection backtracking process, then the updated levelmsig formula is:
[0127] levelmsig = 0.25 * ampM (i) + 0.75 * levelmsig;
[0128] If amp M (i) < thrmsig, it may be noise, then update levelmnoise:
[0129] levelmnoise = 0.125 * amp M (i) + 0.875 * levelmnpise;
[0130] After the threshold process for a peak point is completed, update the threshold:
[0131] thrmnoise = levemnoise + 0.25 * |levelmsig - levelmnoise|;
[0132] thrmnoise = 0.5 * thrmsig.
[0133] Both signal D and signal M belong to electrocardiogram signals, but only different transformations are performed. Therefore, the adaptive threshold update method of signal D is exactly the same as that of signal M, so the adaptive threshold update of signal D will not be elaborated.
[0134] To better implement the adaptive threshold R-wave detection method in the embodiments of the present invention, based on the adaptive threshold R-wave detection method, correspondingly, please refer to Figure 6 , Figure 6 is a schematic structural diagram of an embodiment of the adaptive threshold R-wave detection device provided by the present invention. The embodiments of the present invention provide an adaptive threshold R-wave detection device 600, including:
[0135] A preprocessing module 610, configured to preprocess the original electrocardiogram signal and determine the positions and amplitudes of the upward convex peak points of the preprocessed electrocardiogram signal;
[0136] An exclusion module 620, configured to exclude the noise upward convex peak points according to the positions and amplitudes of the upward convex peak points, and set the missed detection backtracking position to determine the length of the missed detection backtracking segment;
[0137] A threshold attenuation module 630, configured to attenuate the adaptive threshold according to the length of the missed detection backtracking segment based on a preset missed detection backtracking rule;
[0138] A missed detection backtracking module 640, configured to detect the R waves in the missed detection segment of the electrocardiogram signal according to the attenuated adaptive threshold and the amplitude of the upward convex peak point, and update the adaptive threshold;
[0139] An R-wave detection module 650, configured to detect whether the current peak is an R wave according to the updated adaptive threshold and update the adaptive threshold again.
[0140] It should be noted that the device 600 provided in the above embodiments can implement the technical solutions described in the above method embodiments. The specific implementation principles of the above modules or units can be found in the corresponding content in the above method embodiments, and will not be repeated here.
[0141] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Based on the above-described adaptive threshold R-wave detection method, the present invention also provides an electronic device for implementing adaptive threshold R-wave detection. The electronic device can be a mobile terminal, desktop computer, laptop, handheld computer, server, or other computing device. The adaptive threshold R-wave detection device includes a processor 710, a memory 720, and a display 730. Figure 7 Only some components of the electronic device are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0142] In some embodiments, memory 720 may be an internal storage unit of an electronic device, such as a hard disk or memory. In other embodiments, memory 720 may be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Furthermore, memory 720 may include both internal and external storage units. Memory 720 is used to store application software and various types of data installed on the electronic device, such as program code installed on the electronic device. Memory 720 may also be used to temporarily store data that has been output or will be output. In one embodiment, memory 720 stores an adaptive threshold R-wave detection program 740, which can be executed by processor 710 to implement the adaptive threshold R-wave detection method of the embodiments of this application.
[0143] In some embodiments, processor 710 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 720 or process data, such as performing an adaptive threshold R-wave detection method.
[0144] In some embodiments, display 730 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 730 is used to display information from the adaptive threshold R-wave detection device and to display a user interface for visualization. Components 710-730 of the adaptive threshold R-wave detection device communicate with each other via a system bus.
[0145] In one embodiment, the steps of the adaptive threshold R-wave detection method described above are implemented when the processor 710 executes the adaptive threshold R-wave detection program 740 in the memory 720.
[0146] This embodiment also provides a computer-readable storage medium storing an adaptive threshold R-wave detection program, which, when executed by a processor, performs the following steps:
[0147] The raw electrocardiogram (ECG) signal is preprocessed to determine the position and amplitude of the upper peak of the preprocessed ECG signal.
[0148] Noise peaks are eliminated based on their location and amplitude, and the length of the missed detection backtracking segment is determined by setting the missed detection backtracking position.
[0149] Based on the preset missed detection backtracking rules, the adaptive threshold is attenuated according to the length of the missed detection backtracking segment.
[0150] The R wave in the missed segment of the ECG signal is detected based on the attenuated adaptive threshold and the amplitude of the upper convex peak, and the adaptive threshold is updated accordingly.
[0151] The system detects whether the current peak is an R-wave based on the updated adaptive threshold and then updates the adaptive threshold again.
[0152] In summary, this embodiment provides an adaptive threshold R-wave detection method, apparatus, device, and storage medium. The method includes: preprocessing the original electrocardiogram (ECG) signal to determine the position and amplitude of the upper peak of the preprocessed ECG signal; excluding noisy upper peaks based on the upper peak position and amplitude, and setting a missed detection backtracking position to determine the length of the missed detection backtracking segment; attenuating the adaptive threshold based on a preset missed detection backtracking rule and the length of the missed detection backtracking segment; detecting the R-wave in the missed detection segment of the ECG signal based on the attenuated adaptive threshold and the upper peak amplitude, and updating the adaptive threshold; detecting whether the current peak is an R-wave based on the updated adaptive threshold, and updating the adaptive threshold again. This invention relates to an adaptive threshold R-wave detection method, apparatus, device, and storage medium. First, the raw electrocardiogram signal is processed to avoid noise or other interference affecting detection accuracy, noise peaks are eliminated, and a missed detection backtracking position is set to avoid backtracking through noise segments. This avoids noise interference and reduces computational load. Then, the adaptive threshold is adjusted through missed detection backtracking, and R-wave detection is performed based on the adjusted adaptive threshold. The adaptive threshold is then updated, and R-wave detection is repeated. This reduces the risk of missed and false R-wave detection and improves the accuracy of R-wave detection.
[0153] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A self-adapting threshold R-wave detection method, characterized in that, The method comprises the following steps: preprocessing the original electrocardio signal, determining the position of the upper convex peak point and the amplitude of the upper convex peak point of the preprocessed electrocardio signal; excluding the noise upper convex peak point according to the position of the upper convex peak point and the amplitude of the upper convex peak point, and setting the missed detection backtracking position to determine the length of the missed detection backtracking segment; based on a preset missed detection backtracking rule, attenuating the adaptive threshold according to the length of the missed detection backtracking segment; detecting the R wave in the missed detection segment electrocardio signal according to the attenuated adaptive threshold and the amplitude of the upper convex peak point, and updating the adaptive threshold; detecting whether the current peak is the R wave according to the updated adaptive threshold, and updating the adaptive threshold again; preprocessing the original electrocardio signal to obtain the derivative electrocardio signal and the integral electrocardio signal; the step of excluding the noise upper convex peak point according to the position of the upper convex peak point and the amplitude of the upper convex peak point, and setting the missed detection backtracking position to determine the length of the missed detection backtracking segment comprises the following steps: judging whether the upper convex peak point of the derivative electrocardio signal is noise according to the amplitude of the upper convex peak point of the derivative electrocardio signal, and adjusting the position of the backtracking starting point; judging whether the upper convex peak point of the integral electrocardio signal is noise according to the amplitude of the upper convex peak point of the integral electrocardio signal, and adjusting the position of the backtracking starting point; judging whether the upper convex peak point of the integral electrocardio signal is high sharp T wave and whether the detected R wave is high sharp P wave according to the position of the upper convex peak point of the integral electrocardio signal and the detected R wave; determining the length of the missed detection backtracking segment according to the position of the adjusted backtracking starting point; the step of judging whether the upper convex peak point of the integral electrocardio signal is high sharp T wave and whether the detected R wave is high sharp P wave according to the position of the upper convex peak point of the integral electrocardio signal and the detected R wave comprises the following steps: when the distance between the position of the upper convex peak point of the integral electrocardio signal and the detected R wave is less than a preset distance threshold, calculating the wavelength corresponding to the current upper convex peak point and the wavelength corresponding to the detected R wave; judging whether the current upper convex peak point is high sharp T wave and whether the detected R wave is high sharp P wave according to the wavelength corresponding to the current upper convex peak point, the wavelength corresponding to the detected R wave and a preset wavelength threshold; if the current upper convex peak point of the integral electrocardio signal is high sharp T wave, ignoring the current upper convex peak point of the integral electrocardio signal and adjusting the position of the backtracking starting point; if the detected R wave is high sharp P wave, deleting the detected R wave.
2. The self-adapting threshold R-wave detection method according to claim 1, characterized in that, the step of preprocessing the original electrocardio signal, determining the position of the upper convex peak point and the amplitude of the upper convex peak point of the preprocessed electrocardio signal comprises the following steps: performing band-pass filtering on the original electrocardio signal to obtain a band-pass filtered electrocardio signal; deriving the band-pass filtered electrocardio signal and taking the absolute value to obtain a derivative electrocardio signal; squaring the derivative electrocardio signal, and integrating the squared derivative electrocardio signal in a moving window to obtain an integral electrocardio signal; determining the position of the upper convex peak point and the amplitude of the upper convex peak point of the derivative electrocardio signal and the integral electrocardio signal respectively.
3. The self-adapting threshold R-wave detection method of claim 1, wherein, The adaptive threshold value is attenuated according to the length of the missed detection backtracking segment based on a preset missed detection backtracking rule, and the adaptive threshold value attenuation method comprises the following steps: an average RR interval is calculated by calculating the average distance between a preset number of recently detected R waves; a first missed detection backtracking trigger condition and a second missed detection backtracking trigger condition are determined according to the average RR interval; when the integral electrocardio signal has a first missed detection backtracking, if the length of the backtracking segment of the integral electrocardio signal meets the first missed detection backtracking trigger condition, the adaptive threshold value is attenuated by a first missed detection backtracking threshold value attenuation multiple; when the integral electrocardio signal has a second missed detection backtracking, if the length of the backtracking segment of the integral electrocardio signal meets the second missed detection backtracking trigger condition, a second missed detection backtracking threshold value attenuation multiple is determined according to the length of the backtracking segment of the integral electrocardio signal and the average RR interval, and the adaptive threshold value is attenuated by the second missed detection backtracking threshold value attenuation multiple.
4. The self-adapting threshold R-wave detection method according to claim 3, characterized in that, The adaptive threshold value comprises a signal threshold value of an integral electrocardio signal and a signal threshold value of a derivative electrocardio signal; and the R wave in the missed detection segment electrocardio signal is detected according to the attenuated adaptive threshold value and the amplitude of the upper convex peak point, and the adaptive threshold value is updated, which comprises the following steps: when the amplitude of the upper convex peak point of the integral electrocardio signal is greater than the signal threshold value of the integral electrocardio signal, and the amplitude of the corresponding upper convex peak point of the derivative electrocardio signal is greater than the signal threshold value of the derivative electrocardio signal, the current upper convex peak point is an R wave, and the position of the backtracking starting point is adjusted; the signal threshold value of the integral electrocardio signal and the signal threshold value of the derivative electrocardio signal are updated through a preset updating rule.
5. The self-adapting threshold R-wave detection method according to claim 4, characterized in that, The signal threshold value of the integral electrocardio signal and the signal threshold value of the derivative electrocardio signal are updated through a preset updating rule, which comprises the following steps: a signal level and a noise level are updated according to the adaptive threshold value and the amplitude of the upper convex peak point; the adaptive threshold value is updated based on a preset updating rule, the signal level and the noise level.
6. An adaptive threshold R-wave detection apparatus characterized by, Steps for implementing the adaptive threshold R wave detection method in any one of claims 1 to 5, comprising: a preprocessing module for preprocessing an original electrocardio signal, determining the position of an upper convex peak point and the amplitude of the upper convex peak point of the preprocessed electrocardio signal; an exclusion module for excluding a noise upper convex peak point according to the position of the upper convex peak point and the amplitude of the upper convex peak point, and setting a missed detection backtracking position to determine the length of a missed detection backtracking segment; a threshold value attenuation module for attenuating an adaptive threshold value according to the length of the missed detection backtracking segment based on a preset missed detection backtracking rule; a missed detection backtracking module for detecting an R wave in a missed detection segment electrocardio signal according to the attenuated adaptive threshold value and the amplitude of the upper convex peak point, and updating the adaptive threshold value; an R wave detection module for detecting whether a current peak is an R wave according to the updated adaptive threshold value, and updating the adaptive threshold value again.
7. An electronic device, comprising: comprises a memory and a processor, wherein the memory is used for storing a program; the processor is coupled with the memory and is used for executing the program stored in the memory to implement the steps of the adaptive threshold R wave detection method in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, A computer readable storage medium storing a program which, when executed by a processor, enables the steps of the adaptive threshold R-wave detection method according to any one of claims 1 to 5.
Citation Information
Patent Citations
R wave rapid detection method adaptive to electrocardiogram waveform pathological change
CN105286857A
Electrocardiogram data R-wave detection method and electrocardiogram data R-wave detection device
CN107361763A
Programmable logic platform FPGA based QRS wave detection system
CN107693010A