Electrocardiosignal R wave detection method and device, electronic equipment and storage medium

By combining first-order and second-order difference calculations with preset threshold comparisons, the problem of insufficient accuracy and real-time performance of R-wave detection in existing technologies is solved, and efficient and accurate R-wave detection is achieved in low-computing power devices. It is suitable for complex ECG scenarios with multi-lead collaborative processing and dynamic gain changes.

CN120678446AActive Publication Date: 2025-09-23BEIJING ORIENTAL E T MEDICAL EQUIP
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510770473.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-09-23
Estimated Expiration
2045-06-10

AI Technical Summary

Technical Problem

The existing technology lacks effective R-wave detection methods, resulting in insufficient accuracy and real-time performance of ECG signal analysis, especially in scenarios with low-amplitude signals and dynamic gain changes, making it difficult to achieve efficient detection.

Method used

The method of first-order and second-order difference calculation combined with preset threshold comparison is adopted. The ECG signal is processed by second-order IIR notch filter filtering. Combined with dynamic gain adjustment and multi-lead collaborative processing, efficient R wave detection is achieved.

Benefits of technology

Efficient R-wave detection is achieved in low-computing-power devices with a delay of ≤30ms, adapting to complex ECG scenarios, improving detection accuracy and real-time performance, and suitable for multi-lead collaborative processing and dynamic gain changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120678446A_ABST
    Figure CN120678446A_ABST
Patent Text Reader

Abstract

The invention discloses an electrocardiosignal R wave detection method and device, electronic equipment and a storage medium, and belongs to the technical field of biomedical signal processing.The electrocardiosignal R wave detection method includes the steps that first-order difference calculation is conducted on sampling points in electrocardiosignals, and corresponding first-order difference values are obtained; performing second-order difference calculation on the first-order difference value to obtain a corresponding second-order difference value; if the first-order difference value corresponding to the current sampling point is greater than a first-order difference threshold value and the second-order difference value is greater than a second-order difference threshold value, taking a waveform corresponding to the current sampling point as a candidate R wave; the electrocardiosignal within the preset duration after the current sampling point serves as a target electrocardiosignal, and if the first-order difference value of each sampling point in the target electrocardiosignal is larger than the peak value of the electrocardiosignal and the second-order difference value of each sampling point in the target electrocardiosignal is a positive value, it is judged that the candidate R wave is the R wave. The problem that there is no effective R wave detection method in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of biomedical signal processing technology, and in particular to a method, device, electronic equipment and storage medium for detecting R waves of electrocardiogram signals. Background Art

[0002] Electrocardiogram (ECG) is an important physiological signal that reflects the electrophysiological activity of the heart. Its core features (such as P wave, QRS complex, and T wave) are the key basis for clinical diagnosis of arrhythmias, myocardial infarction, and other diseases. Among them, the R wave, as the most significant peak in the QRS complex, is the core reference point for ECG signal analysis. Its accurate detection directly affects the following medical scenarios: (1) Heart rate calculation: Calculating heart rate through the RR interval is the basis for evaluating cardiac function; (2) Arrhythmia identification: such as ventricular premature beats and atrial fibrillation rely on R wave positioning and morphological analysis; (3) ST segment measurement: For the diagnosis of myocardial ischemia or infarction, the R wave is used as the benchmark; (4) Wearable device applications: Smart watches and implantable ECG monitors (such as ICDs) need to detect the R wave in real time to trigger an early warning. Therefore, accurate detection of the R wave is very important, but there is currently no effective method for detecting the R wave. Summary of the Invention

[0003] The present invention provides a method, device, electronic device and storage medium for detecting R waves of electrocardiogram signals, which can solve the problem that there is no effective method for detecting R waves in the prior art.

[0004] In order to solve the above technical problems, an embodiment of the present invention provides a method for detecting R waves of an electrocardiogram signal, comprising:

[0005] Get the ECG signal of the current lead;

[0006] Performing a first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point;

[0007] Performing a second-order difference calculation on each of the first-order difference values ​​to obtain a second-order difference value corresponding to each sampling point;

[0008] Comparing the first-order difference value with a preset first-order difference threshold, and comparing the second-order difference value with a preset second-order difference threshold; if the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, then taking the waveform corresponding to the current sampling point as a candidate R wave;

[0009] The ECG signal within a preset time length after the current sampling point is used as the target ECG signal, the first-order difference value of each sampling point in the target ECG signal is compared with the peak value of the ECG signal, and it is determined whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value and the second-order difference value of each sampling point in the target ECG signal is positive, then the candidate R wave is determined to be an R wave.

[0010] As a preferred solution, before performing first-order difference calculation on each sampling point in the electrocardiogram signal, the method further includes:

[0011] Filtering the ECG signal using a preset second-order IIR notch filter;

[0012] The transfer function of the second-order IIR notch filter is:

[0013]

[0014] Wherein, H(z) is the transfer function of the second-order IIR notch filter; z -1 is the unit delay operator of the second-order IIR notch filter; b0, b1 and b2 are the numerator polynomial coefficients; a1 and a2 are the denominator polynomial coefficients.

[0015] As a preferred solution, the first-order difference calculation is performed on each sampling point in the electrocardiogram signal using the following formula:

[0016] Δ1(t)=x(t)-x(t-3ms);

[0017] Where Δ1(t) is the first-order difference value of the ECG signal at time point t; x(t) is the value of the ECG signal at time point t; t is a continuous time variable; and t-3ms is a time offset of 3ms.

[0018] As a preferred solution, the second-order difference calculation is performed on each of the first-order difference values ​​using the following formula:

[0019] Δ2(t)=Δ1(t)-Δ1(t-1ms);

[0020] Wherein, Δ2(t) is the second-order difference value corresponding to each sampling point; t-1ms is the time offset of 1ms.

[0021] As a preferred solution, it also includes:

[0022] If the first-order difference value of the sampling point in the target ECG signal is not greater than the peak value, or the second-order difference value of the sampling point in the target ECG signal is not a positive value, it is determined that the candidate R wave is not an R wave, and the gain of the ECG signal is adjusted according to a preset gain adjustment rule.

[0023] As a preferred solution, it also includes:

[0024] It is determined whether the candidate R waves of all leads are all R waves. If so, the candidate R waves are determined to be valid R waves. Otherwise, the candidate R waves are determined not to be valid R waves.

[0025] As a preferred solution, after determining that the candidate R wave is a valid R wave, the method further includes:

[0026] The corresponding refractory period duration is calculated according to the heart rate corresponding to the electrocardiogram signal and a preset maximum heart rate, and the detection of the R wave of the electrocardiogram signal is suspended according to the refractory period duration.

[0027] Based on the above embodiment, another embodiment of the present invention provides an electrocardiogram signal R wave detection device, comprising: an electrocardiogram signal acquisition module, a first-order difference calculation module, a second-order difference calculation module, a candidate R wave selection module, and an R wave judgment module;

[0028] The ECG signal acquisition module is used to acquire the ECG signal of the current lead;

[0029] The first-order difference calculation module is used to perform first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point;

[0030] The second-order difference calculation module is used to perform second-order difference calculation on each of the first-order difference values ​​to obtain a second-order difference value corresponding to each sampling point;

[0031] The candidate R wave selection module is configured to compare the first-order difference value with a preset first-order difference threshold, and compare the second-order difference value with a preset second-order difference threshold. If the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, the waveform corresponding to the current sampling point is selected as a candidate R wave;

[0032] The R wave judgment module is used to take the ECG signal within a preset time length after the current sampling point as the target ECG signal, compare the first-order difference value of each sampling point in the target ECG signal with the peak value of the ECG signal, and judge whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value and the second-order difference value of each sampling point in the target ECG signal is positive, then the candidate R wave is judged to be an R wave.

[0033] Based on the above embodiments, another embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the method for detecting the R wave of the electrocardiogram signal described in the above embodiment of the invention.

[0034] Based on the above embodiment, another embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the method for detecting the R wave of the electrocardiogram signal described in the above embodiment of the invention.

[0035] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0036] The present invention provides a method for detecting the R wave of an electrocardiogram signal, which obtains the electrocardiogram signal of the current lead; performs a first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point; performs a second-order difference calculation on each first-order difference value to obtain a second-order difference value corresponding to each sampling point; compares the first-order difference value with a preset first-order difference threshold, and compares the second-order difference value with a preset second-order difference threshold; if the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the The second-order difference threshold is set, and the waveform corresponding to the current sampling point is used as a candidate R wave; the ECG signal within a preset time length after the current sampling point is used as the target ECG signal, and the first-order difference value of each sampling point in the target ECG signal is compared with the peak value of the ECG signal, and it is determined whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value, and the second-order difference value of each sampling point in the target ECG signal is positive, then the candidate R wave is determined to be an R wave. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is a flow chart of a method for detecting R waves of an electrocardiogram signal provided by one embodiment of the present invention;

[0038] Figure 2 This is a waveform comparison diagram of the first-order and second-order differences near the R wave;

[0039] Figure 3 It is the logic flow chart of automatic gain adjustment;

[0040] Figure 4 is a flowchart of the R-wave detection algorithm of the present invention;

[0041] Figure 5 It is a structural diagram of a device for detecting R waves of an electrocardiogram signal provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0042] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions in this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.

[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned figure descriptions are intended to cover non-exclusive inclusions.

[0044] In the description of the embodiments of this application, the technical terms "first" and "second" are used only to distinguish different objects and should not be understood to indicate or imply relative importance or implicitly specify the quantity, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, the meaning of "plurality" is more than two, unless otherwise clearly and specifically defined.

[0045] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0046] In the description of the embodiments of this application, the term "and / or" is simply a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent the following three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.

[0047] In the description of the embodiments of the present application, the terms "multiple" and "several" refer to more than two (including two). Similarly, "multiple groups" refer to more than two groups (including two groups), and "multiple pieces" refer to more than two pieces (including two pieces).

[0048] In the description of the embodiments of the present application, unless otherwise expressly specified or limited, technical terms such as "installed," "connected," "connected," and "fixed" should be understood in a broad sense. For example, they can refer to fixed connections, detachable connections, or integration; mechanical connections or electrical connections; direct connections or indirect connections through an intermediate medium; internal connections between two components or interactions between two components. Those skilled in the art can understand the specific meanings of the above terms in the embodiments of the present application based on specific circumstances.

[0049] Example 1

[0050] Please refer to Figure 1 To address the problems in the prior art of traditional R-wave detection algorithms (such as differential moving window integration and wavelet transform) that rely on complex calculations and are unable to complete real-time detection within 30ms after the R-wave appears; have insufficient suppression capabilities for low-amplitude signals (such as ventricular flutter) and pacing signals, and are unable to adapt to dynamic gain changes and multi-lead processing requirements; and have limited embedded device resources and the difficulty of existing algorithms in balancing computational efficiency and detection accuracy, an embodiment of the present invention provides a flow chart of a method for detecting R-waves in an electrocardiogram signal. This method can achieve efficient R-wave detection (delay ≤ 30ms) in low-computing-power devices while being compatible with complex electrocardiogram scenarios (such as pacing suppression, dynamic gain adjustment, and multi-lead collaborative processing). The method includes the following specific steps:

[0051] S1. Obtain the ECG signal of the current lead;

[0052] Specifically, first obtain the ECG signals of each lead, input the number of leads ≤ 3, and if more than half of the leads are identified consistently, the result is considered valid. The lead data marked as missing by the host computer can be actively shielded.

[0053] S2. performing first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point;

[0054] Preferably, before performing first-order difference calculation on each sampling point in the ECG signal, the method further includes: filtering the ECG signal according to a preset second-order IIR notch filter; wherein the transfer function of the second-order IIR notch filter is:

[0055]

[0056] Wherein, H(z) is the transfer function of the second-order IIR notch filter; z -1 is the unit delay operator of the second-order IIR notch filter; b0, b1 and b2 are the numerator polynomial coefficients; a1 and a2 are the denominator polynomial coefficients.

[0057] Preferably, the first-order difference calculation is performed on each sampling point in the electrocardiogram signal using the following formula:

[0058] Δ1(t)=x(t)-x(t-3ms);

[0059] Where Δ1(t) is the first-order difference value of the ECG signal at time point t; x(t) is the value of the ECG signal at time point t; t is a continuous time variable; and t-3ms is a time offset of 3ms.

[0060] Specifically, after obtaining the ECG signal of the current lead, the ECG signal is preprocessed and differentially calculated:

[0061] S201. First, pre-process the ECG signal with a sampling frequency ≥ 1000 Hz and normalized to a resolution of 1 μV, including using a notch filter with a cutoff frequency of 45-55 Hz to suppress power frequency interference. The specific implementation is as follows:

[0062] Power frequency notch filter: This filter uses a second-order IIR filter with a center frequency of 50Hz, a bandwidth of ±2Hz, and a group delay of ≤2ms. This filter is primarily used to suppress 50Hz (or 60Hz) AC interference introduced by the power grid into the ECG signal while preserving as much of the signal's active components as possible (such as the QRS complex, with a frequency range of 0.5-40Hz).

[0063] The implementation principle of the second-order IIR notch filter is:

[0064] Using a biquad structure, the transfer function is:

[0065]

[0066] Where: H(z) is the transfer function of the system (expressed in the frequency domain), which describes the frequency response characteristics of the filter to the input signal; z -1 is the unit delay operator, which means that the signal is delayed by one sampling period in the time domain; b0, b1, and b2 are the numerator polynomial coefficients, which control the zero position of the filter and determine the suppression ability of the stopband frequency (50Hz); a1a2 are the denominator polynomial coefficients, which control the pole position of the filter and affect the passband flatness and stability.

[0067] The zero of a second-order IIR notch filter is located on the unit circle, corresponding to the target frequency of 50 Hz, completely suppressing this frequency component. The pole of a second-order IIR notch filter is located close to the zero but slightly inward toward the origin, forming a narrowband attenuation (bandwidth ±2 Hz) while maintaining stability.

[0068] S201, perform a first-order difference operation on the pre-processed signal with a time interval of 3ms, and perform a low-pass filter on the first-order difference result:

[0069] First-order difference calculation: calculated according to the formula Δ1(t) = x(t) - x(t-3ms); where Δ1(t) (first-order difference) represents the first-order difference value of the signal at time point t; x(t) (original signal) represents the value of the signal at time point t; t is a continuous time variable, and t-3ms is the time offset.

[0070] First-order difference is used to initially extract the short-term trend of the signal and eliminate low-frequency components. The first-order difference result is then low-pass filtered to retain the frequency band below 40Hz. An FIR low-pass filter is used. For embedded systems, the filter coefficients are quantized to fixed-point numbers to reduce computational complexity.

[0071] S3. Perform a second-order difference calculation on each of the first-order difference values ​​to obtain a second-order difference value corresponding to each sampling point;

[0072] Preferably, the second-order difference calculation is performed on each of the first-order difference values ​​using the following formula:

[0073] Δ2(t)=Δ1(t)-Δ1(t-1ms);

[0074] Wherein, Δ2(t) is the second-order difference value corresponding to each sampling point; t-1ms is the time offset of 1ms.

[0075] Specifically, a second-order difference operation is performed on the filtered first-order difference result to generate a second-order difference sequence.

[0076] Second-order difference: Δ2(t) = Δ1(t) - Δ1(t-1ms), which enhances the R-wave slope characteristics. The time interval for the second-order difference calculation is 1ms. A smaller time interval can capture the instantaneous changes in the R-wave slope and avoid smoothing effects. Then, Δ2(t) is calculated for each sampling point in time sequence to form a discrete difference sequence {Δ2(1), Δ2(2), ..., Δ2(n)};

[0077] S4. Compare the first-order difference value with a preset first-order difference threshold, and compare the second-order difference value with a preset second-order difference threshold. If the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, then select the waveform corresponding to the current sampling point as a candidate R wave.

[0078] Specifically, the R wave candidates are preliminarily determined based on the threshold conditions of the first-order difference and the second-order difference:

[0079] Initial judgment conditions: Δ1(t)>Th1 (e.g. 200μV / ms) and Δ2(t)>Th2 (e.g. 50μV / ms 2 ); Th1: preset first-order difference threshold; Th2: preset second-order difference threshold;

[0080] If the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, the waveform corresponding to the current sampling point is taken as a candidate R wave. Figure 2 , which is a waveform comparison diagram of the first-order and second-order differences near the R wave.

[0081] S5. Use the ECG signal within a preset time period after the current sampling point as the target ECG signal, compare the first-order difference value of each sampling point in the target ECG signal with the peak value of the ECG signal, and determine whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value and the second-order difference value of each sampling point in the target ECG signal is positive, determine that the candidate R wave is an R wave.

[0082] Specifically, after selecting a candidate R wave, the signal amplitude, the first-order difference, and the non-negativity of the second-order difference are verified within a preset time (e.g., 10 ms) after the candidate point to confirm the R wave;

[0083] Confirmation conditions: The signal does not drop to 80% of the peak value within the next 10ms, and Δ2(t) ≥ 0. At this point, the R wave is confirmed to have been found. The signal peak is the potential difference from the baseline to the peak. A time window is defined (e.g., 10-30ms), and the maximum amplitude within the window is found as a candidate peak. The signal does not drop to 80% of the current peak value (i.e., the drop amplitude ≤ 20%) within 10ms after the peak. If the signal drops significantly after the first-order difference, the R wave is confirmed to have been found. If it does not drop significantly, the second-order difference result is determined. If the second-order difference is non-negative, the R wave is found.

[0084] In R-wave detection, the signal amplitude decreases rapidly after the R-wave apex, resulting in a gradual decrease in the first-order difference value (i.e., the rate of change of the signal). By verifying the decay characteristics of the first-order difference within 10 ms after the candidate point, noise interference or a slow decay of non-R-wave signals can be ruled out. If the signal is an R-wave, its first-order difference should show a clear decay trend after the peak, such as a gradual decrease in the difference sequence from [5, 4, 3, 2] rather than a fluctuating or stable change.

[0085] The non-negativity of second-order differences indicates that the decay rate of first-order differences is gradually slowing (or remaining constant), meaning that the "deceleration amplitude" of the signal's rate of change is no longer increasing. In R-wave detection, this property verifies that the signal is in a stable downward phase, avoiding misinterpretation as oscillatory noise or other interfering waveforms. For example, a second-order difference sequence of [1, 0.5, 0] indicates that the decay rate of first-order differences is gradually decreasing, consistent with the smooth downward characteristic of the signal following the R wave.

[0086] Preferably, it also includes: if the first-order difference value of the sampling point in the target ECG signal is not greater than the peak value, or the second-order difference value of the sampling point in the target ECG signal is not a positive value, then it is judged that the candidate R wave is not an R wave, and the gain of the ECG signal is adjusted according to a preset gain adjustment rule.

[0087] Specifically, if no R wave is detected within the preset time window, the gain of the ECG signal can be adjusted. The dynamic gain adjustment strategies include: (1) automatic mode: if no R wave is detected within the preset time window, the gain is increased step by step (range 1 to 3); (2) manual mode: allows the user to set the gain value (range 0.3 to 3.0).

[0088] In a specific embodiment, please refer to Figure 3 , is a logic flow chart of automatic gain adjustment, providing the following gain adjustment embodiment:

[0089] Automatic gain trigger: If the signal is less than 50uV and no R wave is detected within 2S, the gain will be increased (the gain adjustment range is 1-3);

[0090] If the signal is not too low, greater than 100uV, but no R wave is detected within 1.6s, increase the gain (the gain adjustment range is 1-3);

[0091] Gain refers to the magnification of the input signal during signal processing. Its mathematical expression is: Gain = Output Signal Amplitude / Input Signal Amplitude. Increasing gain enhances weak signal detection. With increased gain, weak signals (such as heartbeats and breathing) that were previously below the threshold can be amplified to the effective detection range.

[0092] Preferably, the method further includes: determining whether the candidate R waves of all leads are all R waves; if so, determining that the candidate R waves are valid R waves; otherwise, determining that the candidate R waves are not valid R waves.

[0093] Specifically, the present invention can also realize multi-lead collaborative processing, including: inputting the number of leads ≤ 3, and judging as valid if more than half of the leads are identified in the same way; actively shielding the lead data marked as missing by the host computer.

[0094] In a specific embodiment, a corresponding multi-lead collaborative embodiment is provided:

[0095] Input 3-lead signals. If at least 2 leads meet the threshold conditions simultaneously, it is determined to be a valid R wave.

[0096] Preferably, after determining that the candidate R wave is a valid R wave, it also includes: calculating the corresponding refractory period duration according to the heart rate corresponding to the electrocardiogram signal and a preset maximum heart rate, and suspending the detection of the electrocardiogram signal R wave according to the refractory period duration.

[0097] Specifically, after determining that the candidate R wave is a valid R wave, that is, after detecting a valid R wave, a refractory period is set to shield repeated detection, and the refractory period duration is dynamically adjusted based on the maximum heart rate:

[0098] The refractory period refers to the time window during which the device temporarily shuts down its sensing function after detecting a valid signal (such as an R wave), shielding it from false triggering by subsequent interference signals. Specifically, the refractory period timing is started immediately after detecting a valid R wave or pacing pulse; the sensing amplifier is shut down during the refractory period, ignoring all input signals; missed detection or over-inhibition caused by a fixed duration is avoided; and the refractory period duration is adjusted based on the current heart rate or signal characteristics (such as maximum heart rate).

[0099] First, calculate the shortest cardiac cycle: Based on the preset maximum heart rate (e.g., 180 bpm), derive the shortest RR interval (e.g., 333 ms);

[0100] Secondly, set the proportional relationship: the refractory period is usually set to 30%-50% of the shortest RR interval. For example, if the maximum heart rate corresponds to the shortest RR interval of 333ms, the refractory period can be adjusted to 150ms (45%) or 200ms (60%).

[0101] When the heart rate increases: shorten the refractory period (such as from 300ms to 200ms) to avoid covering the detection window of the next expected heartbeat; when the heart rate decreases: extend the refractory period (such as from 200ms to 350ms) to enhance anti-interference ability.

[0102] Finally, if the pacing pulse appears as a high-frequency narrow pulse (usually lasting 0.4 to 0.5 ms), the start and end of the pacing pin are determined by detecting the rapid rise and fall of the signal amplitude; when the end of the pacing pulse is detected, the subsequent 40 ms of data are immediately skipped to avoid interference.

[0103] It can be seen that the present invention provides a method for detecting the R wave of an electrocardiogram signal. Figure 4 , is a flowchart of the R-wave detection algorithm of the present invention, which can be achieved through the present invention:

[0104] (1) Two-level differential operation: The first-order differential (3ms interval) is used to capture the rising edge of the R wave, and the second-order differential is used to enhance the mutation characteristics and reduce noise interference;

[0105] (2) Dynamic gain adjustment: Automatically / manually adjust the gain (range 0.3 to 3.0) based on the signal amplitude and time window to improve the detection capability of low-amplitude signals (such as ventricular flutter);

[0106] (3) Multi-lead collaborative decision-making: The identification of more than half of the leads is considered valid, supporting lead-off shielding and real-time processing efficiency optimization;

[0107] (4) Embedded-friendly design: avoids floating-point operations, adopts fixed threshold and short-time window strategy, and adapts to the resource limitations of the microcontroller.

[0108] In specific embodiments, the present invention is verified to have the following effects:

[0109] Test data: EC13 database (single-lead 720Hz sampling), after interpolation to 1000Hz, R wave detection rate >98% (at gain = 2.5, no missed detection outside the transition period of aami4a_h data);

[0110] Real-time performance: The measured processing delay of the STM32F4 series microcontroller is ≤25ms, and the CPU usage is <15%.

[0111] By implementing the present invention, the following specific effects can be achieved:

[0112] (1) Low latency: R-wave recognition delay ≤30ms, meeting real-time monitoring requirements;

[0113] (2) High robustness: supports heart rates of 30-200 bpm, pacing inhibition, ventricular flutter signals, and severe arrhythmia scenarios;

[0114] (3) Low resource usage: Single-lead processing only requires 3ms time window data, and the CPU load is controllable when multiple leads (≤3) are processed in parallel.

[0115] The present invention can be integrated into electrocardiogram monitors, portable defibrillators (AEDs) and pacemaker devices, significantly improving the real-time detection reliability in complex electrocardiogram scenarios.

[0116] Example 2

[0117] Please refer to Figure 5 , is a schematic diagram of the structure of an electrocardiogram signal R wave detection device provided by an embodiment of the present invention, the device comprising: an electrocardiogram signal acquisition module, a first-order difference calculation module, a second-order difference calculation module, a candidate R wave selection module, and an R wave judgment module;

[0118] The ECG signal acquisition module is used to acquire the ECG signal of the current lead;

[0119] The first-order difference calculation module is used to perform first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point;

[0120] The second-order difference calculation module is used to perform second-order difference calculation on each of the first-order difference values ​​to obtain a second-order difference value corresponding to each sampling point;

[0121] The candidate R wave selection module is configured to compare the first-order difference value with a preset first-order difference threshold, and compare the second-order difference value with a preset second-order difference threshold. If the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, the waveform corresponding to the current sampling point is selected as a candidate R wave;

[0122] The R wave judgment module is used to take the ECG signal within a preset time length after the current sampling point as the target ECG signal, compare the first-order difference value of each sampling point in the target ECG signal with the peak value of the ECG signal, and judge whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value and the second-order difference value of each sampling point in the target ECG signal is positive, then the candidate R wave is judged to be an R wave.

[0123] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement the present invention without inventive effort.

[0124] Those skilled in the art will clearly understand that for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0125] Example 3

[0126] Accordingly, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the method for detecting the R wave of the electrocardiogram signal described in the above-mentioned embodiment of the invention.

[0127] The electronic device may be a computing device such as a desktop computer, a notebook computer, a PDA, a cloud server, etc. The device may include, but is not limited to, a processor and a memory.

[0128] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the device and connects various parts of the entire device using various interfaces and lines.

[0129] Example 4

[0130] Accordingly, an embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the method for detecting the R wave of the electrocardiogram signal described in the above embodiment of the invention.

[0131] The memory can be used to store the computer program, and the processor realizes various functions of the device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0132] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. The computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0133] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for detecting R waves of an electrocardiogram signal, characterized in that: include: Get the ECG signal of the current lead; Performing a first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point; Performing a second-order difference calculation on each of the first-order difference values ​​to obtain a second-order difference value corresponding to each sampling point; Comparing the first-order difference value with a preset first-order difference threshold, and comparing the second-order difference value with a preset second-order difference threshold; if the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, then taking the waveform corresponding to the current sampling point as a candidate R wave; The ECG signal within a preset time length after the current sampling point is used as the target ECG signal, the first-order difference value of each sampling point in the target ECG signal is compared with the peak value of the ECG signal, and it is determined whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value and the second-order difference value of each sampling point in the target ECG signal is positive, then the candidate R wave is determined to be an R wave.

2. The method for detecting R waves of an electrocardiogram signal according to claim 1, wherein: Before performing first-order difference calculation on each sampling point in the electrocardiogram signal, the method further includes: Filtering the ECG signal using a preset second-order IIR notch filter; The transfer function of the second-order IIR notch filter is: Wherein, H(z) is the transfer function of the second-order IIR notch filter; z -1 is the unit delay operator of the second-order IIR notch filter; b0, b1 and b2 are the numerator polynomial coefficients; a1 and a2 are the denominator polynomial coefficients.

3. The method for detecting R waves of an electrocardiogram signal according to claim 1, wherein: The first-order difference calculation is performed on each sampling point in the ECG signal using the following formula: Δ1(t)=x(t)-x(t-3ms); Where Δ1(t) is the first-order difference value of the ECG signal at time point t; x(t) is the value of the ECG signal at time point t; t is a continuous time variable; and t-3ms is a time offset of 3ms.

4. The method for detecting R waves of an electrocardiogram signal according to claim 3, wherein: The second-order difference calculation is performed on each of the first-order difference values ​​using the following formula: Δ2(t)=Δ1(t)-Δ1(t-1ms); Wherein, Δ2(t) is the second-order difference value corresponding to each sampling point; t-1ms is the time offset of 1ms.

5. The method for detecting R waves of an electrocardiogram signal according to claim 1, wherein: Also includes: If the first-order difference value of the sampling point in the target ECG signal is not greater than the peak value, or the second-order difference value of the sampling point in the target ECG signal is not a positive value, it is determined that the candidate R wave is not an R wave, and the gain of the ECG signal is adjusted according to a preset gain adjustment rule.

6. The method for detecting R waves of an electrocardiogram signal according to claim 5, wherein: Also includes: It is determined whether the candidate R waves of all leads are all R waves. If so, the candidate R waves are determined to be valid R waves. Otherwise, the candidate R waves are determined not to be valid R waves.

7. The method for detecting R waves of an electrocardiogram signal according to claim 6, wherein: After determining that the candidate R wave is a valid R wave, the method further includes: The corresponding refractory period duration is calculated according to the heart rate corresponding to the electrocardiogram signal and a preset maximum heart rate, and the detection of the R wave of the electrocardiogram signal is suspended according to the refractory period duration.

8. A device for detecting R waves of an electrocardiogram signal, characterized in that: include: ECG signal acquisition module, first-order difference calculation module, second-order difference calculation module, candidate R wave selection module and R wave judgment module; The ECG signal acquisition module is used to acquire the ECG signal of the current lead; The first-order difference calculation module is used to perform first-order difference calculation on each sampling point in the electrocardiogram signal to obtain a first-order difference value corresponding to each sampling point; The second-order difference calculation module is used to perform second-order difference calculation on each of the first-order difference values ​​to obtain a second-order difference value corresponding to each sampling point; The candidate R wave selection module is configured to compare the first-order difference value with a preset first-order difference threshold, and compare the second-order difference value with a preset second-order difference threshold. If the first-order difference value corresponding to the current sampling point is greater than the first-order difference threshold, and the second-order difference value is greater than the second-order difference threshold, the waveform corresponding to the current sampling point is selected as a candidate R wave; The R wave judgment module is used to take the ECG signal within a preset time length after the current sampling point as the target ECG signal, compare the first-order difference value of each sampling point in the target ECG signal with the peak value of the ECG signal, and judge whether the second-order difference value of each sampling point in the target ECG signal is positive. If the first-order difference value of each sampling point in the target ECG signal is greater than the peak value and the second-order difference value of each sampling point in the target ECG signal is positive, then the candidate R wave is judged to be an R wave.

9. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for detecting the R wave of the electrocardiogram signal according to any one of claims 1 to 7 is implemented.

10. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is executed, the device where the storage medium is located is controlled to execute the method for detecting the R wave of the electrocardiogram signal according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Automated detection method of QRS wave groups of electrocardiosignals

    CN107788969A

  • Electrocardiosignal R-wave detection method and system

    CN109009085A

  • Electrocardiosignal R-wave detection method and system

    CN109009086A

  • System and method for detecting r wave of electrocardiography signal based on som

    KR1020140087918A

  • Electrocardiosignal processing method, apparatus and device, and readable medium

    WO2021238082A1