CN115886834B - ECG (electrocardiogram) data peak detection method and device and computer equipment - Google Patents

ECG (electrocardiogram) data peak detection method and device and computer equipment Download PDF

Info

Publication number
CN115886834B
CN115886834B CN202211414560.2A CN202211414560A CN115886834B CN 115886834 B CN115886834 B CN 115886834B CN 202211414560 A CN202211414560 A CN 202211414560A CN 115886834 B CN115886834 B CN 115886834B
Authority
CN
China
Prior art keywords
value
peak
threshold
parameter
signal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211414560.2A
Other languages
Chinese (zh)
Other versions
CN115886834A (en
Inventor
游伟强
刘恩锋
曾敏华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yanxiang Smart Iot Technology Co ltd
Original Assignee
Yanxiang Smart Iot Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yanxiang Smart Iot Technology Co ltd filed Critical Yanxiang Smart Iot Technology Co ltd
Priority to CN202211414560.2A priority Critical patent/CN115886834B/en
Publication of CN115886834A publication Critical patent/CN115886834A/en
Application granted granted Critical
Publication of CN115886834B publication Critical patent/CN115886834B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/10Information and communication technologies [ICT] supporting adaptation to climate change, e.g. for weather forecasting or climate simulation

Landscapes

  • Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)

Abstract

The application relates to a signal processing technology, and provides an ECG (electrocardiogram) data peak detection method, an ECG data peak detection device and computer equipment. The application realizes the accurate distinction between the R peak and the noise in the electrocardio data containing the noise, and obtains the R peak identification result with higher identification accuracy.

Description

ECG (electrocardiogram) data peak detection method and device and computer equipment
Technical Field
The present application relates to the field of signal processing technologies, and in particular, to a method and an apparatus for detecting an electrocardiographic data peak of an ECG, and a computer device.
Background
An Electrocardiogram (ECG, which is collectively referred to as an electromagnogram) is a record of cardiac myocardial electrical activity during a cardiac cycle, and is characterized by P (a small, round-blunted wave that occurs first during a cardiac cycle, referred to as a P-wave), QRS (a short, high-amplitude, sharp-shaped complex that occurs a short time interval after the P-wave, referred to as a QRS complex, which reflects the depolarization of the left and right ventricles, a typical QRS complex comprising three closely-connected potential fluctuations, a first downward wave, referred to as a Q-wave, a first upward wave, referred to as an R-wave, a downward wave that occurs after the R-wave, referred to as an S-wave), a longer-duration, lower-amplitude upward wave, referred to as a T-wave, which reflects the ventricular repolarization process, for 0.05 to 0.25 seconds, a waveform of 0.1 to 0.8mV, and a conditional U-wave (a possible U-wave, referred to as a 0.02, and a pulse width, referred to as a pulse width, which is a pulse width, and a pulse width, which may be a pulse width, and a pulse width, which may be a waveform, and a waveform.
The electrocardiosignal can be collected by placing electrodes on the body surface of the human body. Electrocardiography is one of the most important diagnostic tools for various heart diseases. Different features of the electrocardiogram, such as PR interval (meaning from the beginning of the P wave to the beginning of the QRS wave), QRS interval (duration from the beginning of the QRS wave), QT interval (from the beginning of the Q wave to the beginning of the conditional U wave in the QRS wave), ST interval (duration from the end of the S wave to the beginning of the T wave in the QRS wave), PR segment (duration from the beginning of the P wave to the beginning of the QRS wave) and ST segment (from the end of the QRS wave to the beginning of the T wave), are used to infer the heart condition. The detection of QRS complexes and R peaks provides the basis for almost all automatic electrocardiographic analysis algorithms. The QRS complex reflects the electrical activity of the heart during ventricular systole, the time and shape of which provides a lot of information about the current state of the heart. It can be seen that accurate QRS detection not only can calculate heart rate, but also is important for analysis of heart rate variability.
In the research of the prior art, it is found that in the prior art, generally, pan, tompkins algorithm is adopted, that is, interference noise and T wave are removed through a band-pass filter of 5-15Hz, R peak is removed by a 5-point derivative method and squaring, double peak is removed by sliding window integration, relatively protruding R peak is obtained, and R peak is identified by adopting a double-threshold mode and RR interval.
However, after the method is adopted, double peaks appear in the square signal after derivation, and meanwhile, R peaks are highlighted by adopting signal squaring, so that R peak differences with different amplitudes are increased. Therefore, the Pan, tompkins algorithm has a defect in the capability of suppressing noise interference, when the square signal after the derivation is integrated by using the moving window, not only the candidate R peak can be obtained, but also high-frequency noise similar to the R waveform state is likely to be obtained, so that the algorithm can not be well distinguished, and the false detection can be directly caused. And when the noise interference of the electrocardiosignal is serious, the false detection probability is increased.
Disclosure of Invention
The embodiment of the application provides an ECG (electrocardiogram) data peak detection method, an ECG data peak detection device and computer equipment, and aims to solve the problems that in the prior art, when R peaks are identified for ECG data, not only candidate R peaks are obtained, but also high-frequency noise similar to the R waveform is likely to be obtained, so that the R peaks cannot be accurately detected.
In a first aspect, an embodiment of the present application provides a method for detecting an electrocardiographic data peak of an ECG, including:
responding to a wave crest detection instruction, and acquiring electrocardiograph data to be detected corresponding to the wave crest detection instruction; the electrocardiographic data to be detected are sequences comprising a plurality of electrocardiographic value conversion values which are arranged according to time sequence;
baseline drift removal is carried out on the electrocardiograph data to be detected, and a first signal is obtained;
t wave removal is carried out on the first signal, and a second signal is obtained;
r peak protrusion is carried out on the second signal, and a third signal is obtained;
and carrying out R peak identification on the third signal based on the dual-threshold amplitude reduction to obtain an R peak identification result.
In a second aspect, an embodiment of the present application provides an ECG electrocardiograph data peak detection device, which includes:
The electrocardiograph data acquisition module to be detected is used for responding to the wave crest detection instruction and acquiring electrocardiograph data to be detected corresponding to the wave crest detection instruction; the electrocardiographic data to be detected are sequences comprising a plurality of electrocardiographic value conversion values which are arranged according to time sequence;
the baseline drift removing module is used for removing baseline drift of the electrocardiograph data to be detected to obtain a first signal;
the T wave removing module is used for carrying out T wave removal on the first signal to obtain a second signal;
the R peak protrusion module is used for performing R peak protrusion on the second signal to obtain a third signal;
And the R peak identification module is used for carrying out R peak identification on the third signal based on the dual-threshold amplitude reduction to obtain an R peak identification result.
In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method for detecting an electrocardiographic data peak of ECG according to the first aspect when the processor executes the computer program.
In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program when executed by a processor causes the processor to perform the method for detecting an electrocardiographic data peak of an ECG according to the first aspect.
The embodiment of the application provides an ECG (electrocardiogram) data peak detection method, an ECG data peak detection device and computer equipment, which are characterized in that baseline drift removal, T wave removal, R peak protrusion and R peak identification based on dual-threshold amplitude reduction are sequentially carried out after ECG data to be detected are acquired, so that an R peak identification result is obtained. The application realizes the accurate distinction between the R peak and the noise in the electrocardio data containing the noise, and obtains the R peak identification result with higher identification accuracy.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an application scenario of an ECG data peak detection method according to an embodiment of the present application;
FIG. 2 is a flowchart of an ECG data peak detection method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a total flow of a dual-threshold amplitude reduction method in an ECG data peak detection method according to an embodiment of the present application;
FIG. 4 is a schematic block diagram of an ECG data peak detection device for ECG provided by an embodiment of the present application;
fig. 5 is a schematic block diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic diagram of an application scenario of an ECG electrocardiograph data peak detection method according to an embodiment of the present application; fig. 2 is a flowchart of an ECG data peak detection method according to an embodiment of the present application, where the ECG data peak detection method is applied to an ECG data acquisition device.
As shown in fig. 2, the method includes steps S101 to S105.
S101, responding to a wave crest detection instruction, and acquiring electrocardiograph data to be detected corresponding to the wave crest detection instruction; the electrocardiographic data to be detected is a sequence comprising a plurality of electrocardiographic value conversion values which are arranged according to time sequence.
In this embodiment, an electrocardiographic data acquisition device (such as a smart watch with an electrocardiographic acquisition function) is used as a main implementation description solution. In addition, the technical scheme is described by taking the electrocardiographic data to be detected in one acquisition period as an example. Generally, if the actually collected electrocardiographic data includes electrocardiographic data of a plurality of collection periods, the R peak identification in electrocardiographic data of each collection period is referred to in the technical scheme of the present application. Moreover, the initial electrocardiographic data of each acquisition period is data in a time domain, but the data is subjected to AD conversion (i.e. analog-to-digital conversion) in electrocardiographic data acquisition equipment to obtain electrocardiographic data to be detected, which corresponds to the initial electrocardiographic data. In the process of AD conversion of the initial electrocardiographic data, conversion is performed according to a preset sampling frequency, wherein the sampling frequency is denoted as Fs.
The peak detection command may be automatically generated by the electrocardiographic data acquisition device, for example, if the interval between the current system time and the previous peak detection time is equal to a preset peak detection period (for example, if the peak detection period is set to 1 hour, the electrocardiographic data acquisition device automatically generates a peak detection command every hour and triggers a subsequent peak detection process). The wave crest detection instruction can also be generated by the electrocardiographic data acquisition equipment receiving a manual operation instruction of a user, namely, the user clicks a wave crest detection button on a user interaction interface of the electrocardiographic data acquisition equipment, and then the wave crest detection instruction can be triggered to be generated. Therefore, no matter what mode the crest detection instruction is generated, the subsequent crest detection processing can be performed as long as the crest detection instruction is generated.
S102, baseline drift removal is carried out on the electrocardiograph data to be detected, and a first signal is obtained.
In this embodiment, the baseline drift removal is performed on the electrocardiographic data to be detected, because both noise in the electrocardiographic data to be detected is removed and signal distortion is ensured. Moreover, if the signal corresponding to the electrocardiographic data to be detected contains noise, an R peak identification error may be caused; if the signal corresponding to the electrocardiographic data to be detected is distorted, different differences may occur between the R peak position after filtering and the actual position.
In one embodiment, step S102 includes:
Based on an integral coefficient linear high-pass filter, baseline drift removal is carried out on the electrocardiograph data to be detected, and a first signal is obtained; wherein, the formula corresponding to the integral coefficient linear high-pass filter is as follows:
y3(n)=m1*y3(n-L)-m2*y3(n-L*M)+x(n)-m3*x(n-K*L)+m4*x(n-K*L*M);
Wherein x (n) is an input signal, y (n) is an output signal, f pm is a 3db cut-off frequency point, h1 is a maximum fluctuation amplitude in a passband, K, L, M is an integer, m 1、m2、m3 and m 4 are preset parameter values, and y 3 (n) represents an intermediate calculated value.
In this embodiment, the whole-coefficient linear high-pass filter corresponding to the above formula is adopted to remove the baseline drift and the power frequency interference. Because the coefficient of the integral coefficient linear high-pass filter is an integer, the operation speed can be improved, real-time operation can be met on the wearable device, and meanwhile, the ECG waveform is ensured not to be distorted.
S103, T wave removal is carried out on the first signal, and a second signal is obtained.
In this embodiment, filtering is performed on the T-wave in the first signal based on a median filter, and the window size of the median filter is Fs/6, where Fs is the sampling frequency. After T wave removal is carried out on the first signal, interference of T wave is effectively eliminated, and subsequent R peak detection is more accurate.
S104, R peak protrusion is carried out on the second signal, and a third signal is obtained.
In this embodiment, after the T wave in the first signal is removed, interference caused by the T wave to R peak identification is avoided. However, in order to locate the R peak more accurately, the R peak may be highlighted with aromatic energy, noise and T waves may be suppressed, so that the obtained third signal may exclude more interference terms, so as to detect the R peak more accurately.
In one embodiment, step S104 includes:
and obtaining the aroma energy entropy of each signal in the second signal to perform R peak protrusion, so as to obtain a third signal.
In this embodiment, in calculating the aromatic energy entropy of each signal in the second signal, the following formula (1) is specifically referred to:
q(n)=-p(n)2logp(n)2 (1)
In the formula (1), p (n) represents any one of the second signals, and q (n) represents a aromatic energy entropy corresponding to p (n). After the aromatic energy entropy of each signal in each second signal is calculated, the R peak can be highlighted, so that the amplitude of the R peak is larger, T waves and noise are restrained, and meanwhile, the difference of the amplitude of the R peak at different moments is smaller.
S105, carrying out R peak identification on the third signal based on the dual-threshold amplitude reduction, and obtaining an R peak identification result.
In this embodiment, the R-peak identification is performed on the third signal using the dual-threshold amplitude reduction, because the candidate R-peak may be obtained in the third signal, and high-frequency noise similar to the R-waveform may be obtained. The R peak can be accurately identified and high-frequency noise is eliminated by the double-threshold amplitude reduction method, so that an R peak identification result with extremely low false detection probability is finally obtained.
In one embodiment, step S105 includes:
And carrying out potential peak searching, interference peak elimination and missing peak supplement on the third signal based on the dual-threshold amplitude reduction in sequence to obtain an R peak identification result.
In this embodiment, since the third signal stores high-frequency noise similar to the R waveform, the candidate peak, the interference peak (i.e. the high-frequency noise is removed) and the missing peak is supplemented by backtracking can be sequentially found for the third signal based on the dual-threshold amplitude reduction method, so as to obtain the R peak identification result with higher identification accuracy.
In an embodiment, the step of sequentially performing potential peak searching, interference peak removing and missing peak supplementing on the third signal based on the dual-threshold amplitude decrease to obtain an R-peak identification result includes:
Initializing a first threshold value, a second threshold value and an initial amplitude value;
acquiring an ith signal value in the third signal; wherein, the initial value of i is 1, and the value range of i is [1, N ], N represents the total number of the third signal values including signal values;
judging whether the initial amplitude value is larger than an ith signal value or not;
If the initial amplitude value is smaller than or equal to the ith signal value, updating the value of the initial amplitude value to the ith signal value, updating the value of a first parameter to the value of i, updating the value of a second parameter to the ith signal value, updating the value of an identification value to a first preset value, increasing i by 1 to update the value of i, and returning to the step of acquiring the ith signal value in the third signal;
If the initial amplitude value is larger than the ith signal value, automatically increasing i by 1 to update the value of i;
Judging whether the identification value is equal to a first preset value or not;
if the identification value is equal to a first preset value, acquiring a difference value between the value of i and the first parameter;
Judging whether the difference value between the value of i and the first parameter is larger than a first preset sampling frequency or not;
if the difference between the value of i and the first parameter is smaller than or equal to the first preset sampling frequency, returning to the step of acquiring the ith signal value in the third signal;
If the difference between the value of i and the first parameter is larger than the first preset sampling frequency, acquiring a difference between the first parameter and the previous first parameter;
judging whether the difference value between the first parameter and the previous first parameter is smaller than a second preset sampling frequency or not; wherein the second preset sampling frequency is greater than the first preset sampling frequency;
If the difference between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, updating the value of the third parameter to [ second parameter-second threshold ]. Times.2/sampling frequency;
updating the first threshold value and the second threshold value based on a preset threshold value updating strategy so as to update the values of the first threshold value and the second threshold value;
updating the value of the previous first parameter to be the first parameter, and updating the identification value to be a second preset value;
updating the initial amplitude value to be a second parameter-sampling frequency/5 x third parameter 3/4;
And outputting the first parameter as an R peak identification result.
In this embodiment, for a better understanding of the present solution, please refer to a general flow chart of the dual-threshold amplitude reduction method in the ECG data peak detection method shown in fig. 3. Specifically, when the initialized first threshold value is denoted by th1 in fig. 3, the initialized second threshold value is denoted by th2 in fig. 3, and the initial amplitude value is denoted by Y in fig. 3, the first threshold value th1, the second threshold value th2, and the initial amplitude value Y are obtained after initializing the above 3 values (generally Y is an initial value close to 0 and is changed in the subsequent process).
Since the third signal includes N signal values, the processing can be sequentially performed in the order of arrangement of the signal values. The 1 st signal value in the third signal is taken out, and then whether the initial amplitude value Y is larger than the 1 st signal value is judged to be used for judging whether the 1 st signal value is a potential R peak or not.
If the initial amplitude value is less than or equal to the 1 st signal value, indicating that the 1 st signal value is not the potential R peak, directly updating the value of the initial amplitude value Y to the 1 st signal value, updating the value of the first parameter Peaklock to the value of i, updating the value of the second parameter Peakval to the 1 st signal value, updating the value of the Flag to a first preset value (the first preset value is equal to 1 in implementation), changing 1 from 1 to 2 to update the value of i, and returning to the step of acquiring the i th signal value in the third signal. If the initial amplitude value is greater than the 1 st signal value, the 1 st signal value is a potential R peak, and 1 is automatically increased to 1 and changed to 2 to update the value of i.
And then judging whether the Flag is equal to a first preset value, if the Flag is equal to the first preset value, acquiring a difference value between the i value and the first parameter Peaklock, and judging whether the difference value between the i value and the first parameter Peaklock is larger than a first preset sampling frequency or not to judge whether the 1 st signal value is an interference crest or not (in specific implementation, the first preset sampling frequency is equal to the sampling frequency Fs/5).
If the difference between the i value 2 and the first parameter Peaklock is smaller than or equal to the first preset sampling frequency Fs/5, the 1 st signal value is an interference peak, and the step of obtaining the i signal value in the third signal is performed again. If the difference between the value of i and the first parameter Peaklock is greater than the first preset sampling frequency Fs/5, the 1 st signal value is not the interference peak, and the step is continuously performed.
Then, it is determined whether the difference between the first parameter Peaklock and the previous first parameter PrePeaklock is smaller than a second preset sampling frequency (in implementation, the second preset sampling frequency is equal to the sampling frequency fs×2) for determining whether a missing peak exists. If the difference between the first parameter Peaklock and the previous first parameter PrePeaklock is smaller than fs×2, the value of the third parameter k is updated to [ second parameter Peakval-second threshold th2] ×2/sampling frequency Fs. And then updating the first threshold th1 and the second threshold th2 based on a preset threshold updating strategy to obtain updated first threshold th1 and second threshold th2. After updating the two thresholds, updating the value of the previous first parameter PrePeaklock to the first parameter Peaklock, and updating the Flag to a second preset value (the second preset value is set to 0 in specific implementation), where the updating of the Flag to the second preset value is to re-take the Flag to 0 when R peak detection is performed on the electrocardiographic data to be detected in the next acquisition period; and updating the initial amplitude value Y to be a second parameter Peakval, the sampling frequency Fs/5 and a third parameter k 3/4, wherein the updating of the initial amplitude value Y can inherit the adjustment value of the previous round rather than reinitializing a Y value when the R peak detection is carried out on the electrocardiograph data to be detected in the next acquisition period; and outputting the first parameter Peaklock as an R peak identification result. Therefore, based on the above process, candidate peaks can be found for the third signal, interference peaks can be eliminated, missing peaks can be supplemented by backtracking, and therefore R peak identification results with high identification accuracy can be obtained.
In an embodiment, after determining whether the difference between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, the method further includes:
If the difference value between the first parameter and the previous first parameter is greater than or equal to the second preset sampling frequency, acquiring a pre-stored R peak backtracking search strategy and acquiring the R peak identification result in the third signal based on the R peak backtracking search strategy;
the obtaining the R-peak identification result in the third signal based on the R-peak backtracking lookup policy includes:
Reading the stored first historical R peak and second historical R peak from the buffer, and acquiring the data in the buffer between the first historical R peak and the second historical R peak to form a first data set;
deleting the data smaller than the first preset sampling frequency in the first data set to obtain a second data set;
Obtaining a maximum value and a subscript corresponding to the maximum value in the second data set;
and outputting the maximum value in the second data set as an R peak identification result.
In this embodiment, if the difference between the first parameter and the previous first parameter is greater than or equal to the second preset sampling frequency, it indicates that there is a missing peak, and at this time, it is necessary to read the stored first historical R peak and second historical R peak from the buffer of the electrocardiographic data acquisition device based on the above R peak backtracking search policy, and acquire the data located between the first historical R peak and the second historical R peak in the buffer to form a first data set (that is, read all the data between 2 candidate R peaks). And then removing interference data in the first data set, namely removing data smaller than the first preset sampling frequency Fs/5 in the first data set, so as to keep effective data to form a second data set. Finally, the maximum maxval is obtained from the second data to be used as the R peak identification result. The candidate R peak in the buffer zone can be reselected back to serve as an R peak identification result based on a backtracking reading mode, so that the true R peak is effectively prevented from being deleted by mistake. The subscript corresponding to the maximum value is obtained, so as to obtain a sorting position of the maximum value in the second data set, and the sorting position can be used as a reference position value for rapidly positioning an R peak identification result when the electrocardiographic data to be detected in each subsequent acquisition period is subjected to peak backtracking search.
In an embodiment, after determining whether the identification value is equal to the first preset value, the method further includes:
if the identification value is not equal to a first preset value, judging whether the initial amplitude value is smaller than the second threshold value or not;
if the initial amplitude value is smaller than the second threshold value, updating the value of the initial amplitude value into the second threshold value;
if the initial amplitude value is greater than or equal to the second threshold value, subtracting the third parameter from the value of the initial amplitude value to update the initial amplitude value;
subtracting 1 from the second threshold value to update the value of the second threshold value;
Judging whether the second threshold value is smaller than a preset second minimum value or not;
If the second threshold value is smaller than the second minimum value, updating the value of the initial amplitude value to be the second threshold value;
if the second threshold value is greater than or equal to the second minimum limit value, judging whether the initial amplitude value is smaller than the preset second minimum limit value or not;
if the initial amplitude value is smaller than the preset second minimum value, updating the initial amplitude value to the preset second minimum value, and returning to the step of acquiring the ith signal value in the third signal;
And if the initial amplitude value is greater than or equal to the preset second minimum value, returning to the step of acquiring the ith signal value in the third signal.
In this embodiment, still referring to the above example of determining whether the 1 st signal value is the R peak, if the Flag is not equal to the first preset value (i.e., flag is not equal to 1), the first threshold th1, the second threshold th2, and the initial amplitude value Y may be updated in time.
Specifically, it is determined whether the initial amplitude value Y is smaller than the second threshold value th2, and if Y is smaller than th2, the value of Y is updated to the value of th2 at that time. And if Y is greater than or equal to th2, subtracting the third parameter k from the value of Y to update the value of Y. After the value of Y is adjusted based on one of the two modes, subtracting 1 from the second threshold th2 to update the value of the second threshold th 2. And then judging whether the second threshold value th2 is smaller than a preset second minimum value th2_limit. If the second threshold value th2 is smaller than the second minimum value th2_limit, updating the value of the initial amplitude value Y to the second threshold value th2, and executing the step of judging whether the initial amplitude value Y is smaller than the preset second minimum value th2_limit; and if the second threshold value th2 is greater than or equal to the second minimum value th2_limit, executing the step of judging whether the initial amplitude value Y is smaller than the preset second minimum value th2_limit.
After the updating is completed, it is further determined whether the initial amplitude value Y is smaller than the preset second minimum value th2_limit, and the step of acquiring the ith signal value in the third signal is returned to be performed after the determination. However, if the initial amplitude value Y is smaller than the preset second minimum value th2_limit, the step of acquiring the ith signal value in the third signal is performed after updating the initial amplitude value Y to the preset second minimum value th2_limit. And if the initial amplitude value Y is greater than or equal to the preset second minimum value th2_limit, the step of directly returning to the step of acquiring the ith signal value in the third signal is performed. It can be seen that the R peak is found again from the residual signal value after the amplitude of the double threshold is reduced based on the above manner.
In an embodiment, the updating the first threshold and the second threshold based on a preset threshold updating policy to update the values of the first threshold and the second threshold includes:
Acquiring the second parameter;
judging whether the second parameter is larger than the first threshold value or not;
if the second parameter is greater than the first threshold, updating the value of the first threshold to be 0.6 x the middle value of the R peak stored in the buffer, and updating the value of the second threshold to be 0.4 x the middle value of the R peak stored in the buffer;
If the second parameter is smaller than or equal to the first threshold, judging whether the second parameter is larger than the second threshold and judging whether the second parameter is smaller than the first threshold;
If the second parameter is greater than the second threshold and the second parameter is less than the first threshold, subtracting the absolute value of the intermediate value of the stored R peak of the buffer from the first threshold to update the first threshold, and updating the value of the second threshold to 0.4 x the intermediate value of the stored R peak of the buffer;
if the second parameter is smaller than or equal to the second threshold value or the second parameter is larger than or equal to the first threshold value, updating the value of the first threshold value to a preset first minimum value, and updating the value of the second threshold value to a preset second minimum value;
and storing the second parameter into a buffer area.
In this embodiment, the first threshold and the second threshold are updated based on a preset threshold updating policy, which can be regarded as a dual-threshold amplitude decreasing adjustment method, specifically, a second parameter Peakval is acquired first, then it is determined whether the second parameter Peakval is greater than the first threshold th1, if the second parameter Peakval is greater than the first threshold th1, the first threshold th1 and the second threshold th2 are updated according to a first mode, that is, the value of the first threshold is updated to 0.6 x the buffer already stores the R peak intermediate value (wherein, the buffer already stores the R peak intermediate value refers to the value of the R peak which is arranged in the middle after the stored R peak is arranged in order from large to small as the buffer already stores the R peak intermediate value, and the buffer can be represented by PeakBuffer, and the R peak intermediate value can be represented by median (PeakBuffer)), and the value of the second threshold is updated to 0.4 x the buffer already stores the R peak intermediate value.
If the second parameter Peakval is greater than the second threshold th2 and the second parameter Peakval is less than the first threshold th1, the first threshold th1 and the second threshold th2 are updated according to a second mode, that is, the absolute value abs (median (PeakBuffer)) of the stored R peak middle value in the buffer area is subtracted from the first threshold th1 to update the first threshold th1, the value of the second threshold th2 is updated to 0.4 x the stored R peak middle value mean (peak buffer. If the second parameter is less than or equal to the second threshold, or the second parameter is greater than or equal to the first threshold, the first threshold th1 and the second threshold th2 are updated according to a third mode, that is, the value of the first threshold th1 is updated to a preset first minimum value th1_limit, the value of the second threshold th2 is updated to a preset second minimum value th2_limit, and the second parameter is updated to be equal to 32 x the second minimum value, and the second parameter is updated to the second threshold value after the second parameter is updated to be equal to the first threshold, the second parameter is updated to the second threshold value, and the second parameter is updated to be equal to the second threshold value, and the threshold is again updated to the second threshold value is found to be equal to the second threshold value, and the threshold value is updated to the second threshold value is again, and the threshold is updated to be equal to the threshold value.
The method realizes the accurate distinction between the R peak and the noise in the electrocardio data containing the noise, and obtains the R peak identification result with higher identification accuracy.
The embodiment of the application also provides an ECG (electrocardiogram) data peak detection device, which is used for executing any embodiment of the ECG data peak detection method. Specifically, referring to fig. 4, fig. 4 is a schematic block diagram of an ECG data peak detection apparatus 100 according to an embodiment of the present application.
As shown in fig. 4, the ECG electrocardiographic data peak detection device 100 includes an electrocardiographic data acquisition module 101 to be detected, a baseline drift removal module 102, a T-wave removal module 103, an R-peak protrusion module 104, and an R-peak identification module 105.
The electrocardiograph data to be detected acquisition module 101 is used for responding to a wave crest detection instruction and acquiring electrocardiograph data to be detected corresponding to the wave crest detection instruction; the electrocardiographic data to be detected is a sequence comprising a plurality of electrocardiographic value conversion values which are arranged according to time sequence.
In this embodiment, an electrocardiographic data acquisition device (such as a smart watch with an electrocardiographic acquisition function) is used as a main implementation description solution. In addition, the technical scheme is described by taking the electrocardiographic data to be detected in one acquisition period as an example. Generally, if the actually collected electrocardiographic data includes electrocardiographic data of a plurality of collection periods, the R peak identification in electrocardiographic data of each collection period is referred to in the technical scheme of the present application. Moreover, the initial electrocardiographic data of each acquisition period is data in a time domain, but the data is subjected to AD conversion (i.e. analog-to-digital conversion) in electrocardiographic data acquisition equipment to obtain electrocardiographic data to be detected, which corresponds to the initial electrocardiographic data. In the process of AD conversion of the initial electrocardiographic data, conversion is performed according to a preset sampling frequency, wherein the sampling frequency is denoted as Fs.
The peak detection command may be automatically generated by the electrocardiographic data acquisition device, for example, if the interval between the current system time and the previous peak detection time is equal to a preset peak detection period (for example, if the peak detection period is set to 1 hour, the electrocardiographic data acquisition device automatically generates a peak detection command every hour and triggers a subsequent peak detection process). The wave crest detection instruction can also be generated by the electrocardiographic data acquisition equipment receiving a manual operation instruction of a user, namely, the user clicks a wave crest detection button on a user interaction interface of the electrocardiographic data acquisition equipment, and then the wave crest detection instruction can be triggered to be generated. Therefore, no matter what mode the crest detection instruction is generated, the subsequent crest detection processing can be performed as long as the crest detection instruction is generated.
The baseline drift removal module 102 is configured to perform baseline drift removal on the electrocardiographic data to be detected, so as to obtain a first signal.
In this embodiment, the baseline drift removal is performed on the electrocardiographic data to be detected, because both noise in the electrocardiographic data to be detected is removed and signal distortion is ensured. Moreover, if the signal corresponding to the electrocardiographic data to be detected contains noise, an R peak identification error may be caused; if the signal corresponding to the electrocardiographic data to be detected is distorted, different differences may occur between the R peak position after filtering and the actual position.
In one embodiment, the baseline wander removal module 102 is specifically configured to:
Based on an integral coefficient linear high-pass filter, baseline drift removal is carried out on the electrocardiograph data to be detected, and a first signal is obtained; wherein, the formula corresponding to the integral coefficient linear high-pass filter is as follows:
y3(n)=m1*y3(n-L)-m2*y3(n-L*M)+x(n)-m3*x(n-K*L)+m4*x(n-K*L*M);
Wherein x (n) is an input signal, y (n) is an output signal, f pm is a 3db cut-off frequency point, h1 is a maximum fluctuation amplitude in a passband, K, L, M is an integer, m 1、m2、m3 and m 4 are preset parameter values, and y 3 (n) represents an intermediate calculated value.
In this embodiment, the whole-coefficient linear high-pass filter corresponding to the above formula is adopted to remove the baseline drift and the power frequency interference. Because the coefficient of the integral coefficient linear high-pass filter is an integer, the operation speed can be improved, real-time operation can be met on the wearable device, and meanwhile, the ECG waveform is ensured not to be distorted.
And the T-wave removing module 103 is configured to perform T-wave removal on the first signal to obtain a second signal.
In this embodiment, filtering is performed on the T-wave in the first signal based on a median filter, and the window size of the median filter is Fs/6, where Fs is the sampling frequency. After T wave removal is carried out on the first signal, interference of T wave is effectively eliminated, and subsequent R peak detection is more accurate.
And the R peak protrusion module 104 is configured to perform R peak protrusion on the second signal to obtain a third signal.
In this embodiment, after the T wave in the first signal is removed, interference caused by the T wave to R peak identification is avoided. However, in order to locate the R peak more accurately, the R peak may be highlighted with aromatic energy, noise and T waves may be suppressed, so that the obtained third signal may exclude more interference terms, so as to detect the R peak more accurately.
In one embodiment, the R peak protrusion module 104 is specifically configured to:
and obtaining the aroma energy entropy of each signal in the second signal to perform R peak protrusion, so as to obtain a third signal.
In this embodiment, in calculating the aromatic energy entropy of each of the second signals, reference is specifically made to the above formula (1). In the formula (1), p (n) represents any one of the second signals, and q (n) represents a fragrance energy entropy corresponding to p (n). After the aromatic energy entropy of each signal in each second signal is calculated, the R peak can be highlighted, so that the amplitude of the R peak is larger, T waves and noise are restrained, and meanwhile, the difference of the amplitude of the R peak at different moments is smaller.
And the R peak identifying module 105 is configured to identify an R peak of the third signal based on the dual-threshold amplitude decrease, so as to obtain an R peak identification result.
In this embodiment, the R-peak identification is performed on the third signal using the dual-threshold amplitude reduction, because the candidate R-peak may be obtained in the third signal, and high-frequency noise similar to the R-waveform may be obtained. The R peak can be accurately identified and high-frequency noise is eliminated by the double-threshold amplitude reduction method, so that an R peak identification result with extremely low false detection probability is finally obtained.
In one embodiment, the R-peak identification module 105 is specifically configured to:
And carrying out potential peak searching, interference peak elimination and missing peak supplement on the third signal based on the dual-threshold amplitude reduction in sequence to obtain an R peak identification result.
In this embodiment, since the third signal stores high-frequency noise similar to the R waveform, the candidate peak, the interference peak (i.e. the high-frequency noise is removed) and the missing peak is supplemented by backtracking can be sequentially found for the third signal based on the dual-threshold amplitude reduction method, so as to obtain the R peak identification result with higher identification accuracy.
In an embodiment, the step of sequentially performing potential peak searching, interference peak removing and missing peak supplementing on the third signal based on the dual-threshold amplitude decrease to obtain an R-peak identification result includes:
Initializing a first threshold value, a second threshold value and an initial amplitude value;
acquiring an ith signal value in the third signal; wherein, the initial value of i is 1, and the value range of i is [1, N ], N represents the total number of the third signal values including signal values;
judging whether the initial amplitude value is larger than an ith signal value or not;
If the initial amplitude value is smaller than or equal to the ith signal value, updating the value of the initial amplitude value to the ith signal value, updating the value of a first parameter to the value of i, updating the value of a second parameter to the ith signal value, updating the value of an identification value to a first preset value, increasing i by 1 to update the value of i, and returning to the step of acquiring the ith signal value in the third signal;
If the initial amplitude value is larger than the ith signal value, automatically increasing i by 1 to update the value of i;
Judging whether the identification value is equal to a first preset value or not;
if the identification value is equal to a first preset value, acquiring a difference value between the value of i and the first parameter;
Judging whether the difference value between the value of i and the first parameter is larger than a first preset sampling frequency or not;
if the difference between the value of i and the first parameter is smaller than or equal to the first preset sampling frequency, returning to the step of acquiring the ith signal value in the third signal;
If the difference between the value of i and the first parameter is larger than the first preset sampling frequency, acquiring a difference between the first parameter and the previous first parameter;
judging whether the difference value between the first parameter and the previous first parameter is smaller than a second preset sampling frequency or not; wherein the second preset sampling frequency is greater than the first preset sampling frequency;
If the difference between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, updating the value of the third parameter to [ second parameter-second threshold ]. Times.2/sampling frequency;
updating the first threshold value and the second threshold value based on a preset threshold value updating strategy so as to update the values of the first threshold value and the second threshold value;
updating the value of the previous first parameter to be the first parameter, and updating the identification value to be a second preset value;
updating the initial amplitude value to be a second parameter-sampling frequency/5 x third parameter 3/4;
And outputting the first parameter as an R peak identification result.
In this embodiment, the initialized first threshold value is denoted by th1, the initialized second threshold value is denoted by th2, and the initial amplitude value is denoted by Y, and after initializing the above 3 values, the first threshold value th1, the second threshold value th2, and the initial amplitude value Y are obtained (typically Y is an initial value close to 0, and will be changed in the subsequent process).
Since the third signal includes N signal values, the processing can be sequentially performed in the order of arrangement of the signal values. If the 1 st signal value in the third signal is taken out, then judging whether the initial amplitude value is Y or not and is larger than the 1 st signal value or not, and judging whether the 1 st signal value is a potential R peak or not.
If the initial amplitude value is less than or equal to the 1 st signal value, indicating that the 1 st signal value is not the potential R peak, directly updating the value of the initial amplitude value Y to the 1 st signal value, updating the value of the first parameter Peaklock to the value of i, updating the value of the second parameter Peakval to the 1 st signal value, updating the value of the Flag to a first preset value (the first preset value is equal to 1 in implementation), changing 1 from 1 to 2 to update the value of i, and returning to the step of acquiring the i th signal value in the third signal. If the initial amplitude value is greater than the 1 st signal value, the 1 st signal value is a potential R peak, and 1 is automatically increased to 1 and changed to 2 to update the value of i.
And then judging whether the Flag is equal to a first preset value, if the Flag is equal to the first preset value, acquiring a difference value between the i value and the first parameter Peaklock, and judging whether the difference value between the i value and the first parameter Peaklock is larger than a first preset sampling frequency or not to judge whether the 1 st signal value is an interference crest or not (in specific implementation, the first preset sampling frequency is equal to the sampling frequency Fs/5).
If the difference between the i value 2 and the first parameter Peaklock is smaller than or equal to the first preset sampling frequency Fs/5, the 1 st signal value is an interference peak, and the step of obtaining the i signal value in the third signal is performed again. If the difference between the value of i and the first parameter Peaklock is greater than the first preset sampling frequency Fs/5, the 1 st signal value is not the interference peak, and the step is continuously performed.
Then, it is determined whether the difference between the first parameter Peaklock and the previous first parameter PrePeaklock is smaller than a second preset sampling frequency (in implementation, the second preset sampling frequency is equal to the sampling frequency fs×2) for determining whether a missing peak exists. If the difference between the first parameter Peaklock and the previous first parameter PrePeaklock is smaller than fs×2, the value of the third parameter k is updated to [ second parameter Peakval-second threshold th2] ×2/sampling frequency Fs. And then updating the first threshold th1 and the second threshold th2 based on a preset threshold updating strategy to obtain updated first threshold th1 and second threshold th2. After updating the two thresholds, updating the value of the previous first parameter PrePeaklock to the first parameter Peaklock, and updating the Flag to a second preset value (the second preset value is set to 0 in specific implementation), where the updating of the Flag to the second preset value is to re-take the Flag to 0 when R peak detection is performed on the electrocardiographic data to be detected in the next acquisition period; and updating the initial amplitude value Y to be a second parameter Peakval, the sampling frequency Fs/5 and a third parameter k 3/4, wherein the updating of the initial amplitude value Y can inherit the adjustment value of the previous round rather than reinitializing a Y value when the R peak detection is carried out on the electrocardiograph data to be detected in the next acquisition period; and outputting the first parameter Peaklock as an R peak identification result. Therefore, based on the above process, candidate peaks can be found for the third signal, interference peaks can be eliminated, missing peaks can be supplemented by backtracking, and therefore R peak identification results with high identification accuracy can be obtained.
In an embodiment, after determining whether the difference between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, the method further includes:
If the difference value between the first parameter and the previous first parameter is greater than or equal to the second preset sampling frequency, acquiring a pre-stored R peak backtracking search strategy and acquiring the R peak identification result in the third signal based on the R peak backtracking search strategy;
the obtaining the R-peak identification result in the third signal based on the R-peak backtracking lookup policy includes:
Reading the stored first historical R peak and second historical R peak from the buffer, and acquiring the data in the buffer between the first historical R peak and the second historical R peak to form a first data set;
deleting the data smaller than the first preset sampling frequency in the first data set to obtain a second data set;
Obtaining a maximum value and a subscript corresponding to the maximum value in the second data set;
and outputting the maximum value in the second data set as an R peak identification result.
In this embodiment, if the difference between the first parameter and the previous first parameter is greater than or equal to the second preset sampling frequency, it indicates that there is a missing peak, and at this time, it is necessary to read the stored first historical R peak and second historical R peak from the buffer of the electrocardiographic data acquisition device based on the above R peak backtracking search policy, and acquire the data located between the first historical R peak and the second historical R peak in the buffer to form a first data set (that is, read all the data between 2 candidate R peaks). And then removing interference data in the first data set, namely removing data smaller than the first preset sampling frequency Fs/5 in the first data set, so as to keep effective data to form a second data set. Finally, the maximum maxval is obtained from the second data to be used as the R peak identification result. The candidate R peak in the buffer zone can be reselected back to serve as an R peak identification result based on a backtracking reading mode, so that the true R peak is effectively prevented from being deleted by mistake. The subscript corresponding to the maximum value is obtained, so as to obtain a sorting position of the maximum value in the second data set, and the sorting position can be used as a reference position value for rapidly positioning an R peak identification result when the electrocardiographic data to be detected in each subsequent acquisition period is subjected to peak backtracking search.
In an embodiment, after determining whether the identification value is equal to the first preset value, the method further includes:
if the identification value is not equal to a first preset value, judging whether the initial amplitude value is smaller than the second threshold value or not;
if the initial amplitude value is smaller than the second threshold value, updating the value of the initial amplitude value into the second threshold value;
if the initial amplitude value is greater than or equal to the second threshold value, subtracting the third parameter from the value of the initial amplitude value to update the initial amplitude value;
subtracting 1 from the second threshold value to update the value of the second threshold value;
Judging whether the second threshold value is smaller than a preset second minimum value or not;
If the second threshold value is smaller than the second minimum value, updating the value of the initial amplitude value to be the second threshold value;
if the second threshold value is greater than or equal to the second minimum limit value, judging whether the initial amplitude value is smaller than the preset second minimum limit value or not;
if the initial amplitude value is smaller than the preset second minimum value, updating the initial amplitude value to the preset second minimum value, and returning to the step of acquiring the ith signal value in the third signal;
And if the initial amplitude value is greater than or equal to the preset second minimum value, returning to the step of acquiring the ith signal value in the third signal.
In this embodiment, still referring to the above example of determining whether the 1 st signal value is the R peak, if the Flag is not equal to the first preset value (i.e., flag is not equal to 1), the first threshold th1, the second threshold th2, and the initial amplitude value Y may be updated in time.
Specifically, it is determined whether the initial amplitude value Y is smaller than the second threshold value th2, and if Y is smaller than th2, the value of Y is updated to the value of th2 at that time. And if Y is greater than or equal to th2, subtracting the third parameter k from the value of Y to update the value of Y. After the value of Y is adjusted based on one of the two modes, subtracting 1 from the second threshold th2 to update the value of the second threshold th 2. And then judging whether the second threshold value th2 is smaller than a preset second minimum value th2_limit. If the second threshold value th2 is smaller than the second minimum value th2_limit, updating the value of the initial amplitude value Y to the second threshold value th2, and executing the step of judging whether the initial amplitude value Y is smaller than the preset second minimum value th2_limit; and if the second threshold value th2 is greater than or equal to the second minimum value th2_limit, executing the step of judging whether the initial amplitude value Y is smaller than the preset second minimum value th2_limit.
After the updating is completed, it is further determined whether the initial amplitude value Y is smaller than the preset second minimum value th2_limit, and the step of acquiring the ith signal value in the third signal is returned to be performed after the determination. However, if the initial amplitude value Y is smaller than the preset second minimum value th2_limit, the step of acquiring the ith signal value in the third signal is performed after updating the initial amplitude value Y to the preset second minimum value th2_limit. And if the initial amplitude value Y is greater than or equal to the preset second minimum value th2_limit, the step of directly returning to the step of acquiring the ith signal value in the third signal is performed. It can be seen that the R peak is found again from the residual signal value after the amplitude of the double threshold is reduced based on the above manner.
In an embodiment, the updating the first threshold and the second threshold based on a preset threshold updating policy to update the values of the first threshold and the second threshold includes:
Acquiring the second parameter;
judging whether the second parameter is larger than the first threshold value or not;
if the second parameter is greater than the first threshold, updating the value of the first threshold to be 0.6 x the middle value of the R peak stored in the buffer, and updating the value of the second threshold to be 0.4 x the middle value of the R peak stored in the buffer;
If the second parameter is smaller than or equal to the first threshold, judging whether the second parameter is larger than the second threshold and judging whether the second parameter is smaller than the first threshold;
If the second parameter is greater than the second threshold and the second parameter is less than the first threshold, subtracting the absolute value of the intermediate value of the stored R peak of the buffer from the first threshold to update the first threshold, and updating the value of the second threshold to 0.4 x the intermediate value of the stored R peak of the buffer;
if the second parameter is smaller than or equal to the second threshold value or the second parameter is larger than or equal to the first threshold value, updating the value of the first threshold value to a preset first minimum value, and updating the value of the second threshold value to a preset second minimum value;
and storing the second parameter into a buffer area.
In this embodiment, the first threshold and the second threshold are updated based on a preset threshold updating policy, which can be regarded as a dual-threshold amplitude decreasing adjustment method, specifically, a second parameter Peakval is acquired first, then it is determined whether the second parameter Peakval is greater than the first threshold th1, if the second parameter Peakval is greater than the first threshold th1, the first threshold th1 and the second threshold th2 are updated according to a first mode, that is, the value of the first threshold is updated to 0.6 x the buffer already stores the R peak intermediate value (wherein, the buffer already stores the R peak intermediate value refers to the value of the R peak which is arranged in the middle after the stored R peak is arranged in order from large to small as the buffer already stores the R peak intermediate value, and the buffer can be represented by PeakBuffer, and the R peak intermediate value can be represented by median (PeakBuffer)), and the value of the second threshold is updated to 0.4 x the buffer already stores the R peak intermediate value.
If the second parameter Peakval is greater than the second threshold th2 and the second parameter Peakval is less than the first threshold th1, the first threshold th1 and the second threshold th2 are updated according to a second mode, that is, the absolute value abs (median (PeakBuffer)) of the stored R peak middle value in the buffer area is subtracted from the first threshold th1 to update the first threshold th1, the value of the second threshold th2 is updated to 0.4 x the stored R peak middle value mean (peak buffer. If the second parameter is less than or equal to the second threshold, or the second parameter is greater than or equal to the first threshold, the first threshold th1 and the second threshold th2 are updated according to a third mode, that is, the value of the first threshold th1 is updated to a preset first minimum value th1_limit, the value of the second threshold th2 is updated to a preset second minimum value th2_limit, and the second parameter is updated to be equal to 32 x the second minimum value, and the second parameter is updated to the second threshold value after the second parameter is updated to be equal to the first threshold, the second parameter is updated to the second threshold value, and the second parameter is updated to be equal to the second threshold value, and the threshold is again updated to the second threshold value is found to be equal to the second threshold value, and the threshold value is updated to the second threshold value is again, and the threshold is updated to be equal to the threshold value.
The device realizes the accurate distinction between the R peak and the noise in the electrocardio data containing the noise, and obtains the R peak identification result with higher identification accuracy.
The ECG data peak detection apparatus described above can be implemented in the form of a computer program which can be run on a computer device as shown in fig. 5.
Referring to fig. 5, fig. 5 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 is a smart device, such as a smart watch, having an electrocardiogram acquisition function.
With reference to fig. 5, the computer device 500 includes a processor 502, a memory, and a network interface 505, which are connected by a device bus 501, where the memory may include a storage medium 503 and an internal memory 504.
The storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, may cause the processor 502 to perform an ECG electrocardiographic data peak detection method.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of a computer program 5032 in the storage medium 503, which computer program 5032, when executed by the processor 502, causes the processor 502 to perform the method of peak detection of electrocardiographic data of ECG.
The network interface 505 is used for network communication, such as providing for transmission of data information, etc. It will be appreciated by those skilled in the art that the architecture shown in fig. 5 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting of the computer device 500 to which the present inventive arrangements may be implemented, as a particular computer device 500 may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
The processor 502 is configured to execute a computer program 5032 stored in a memory, so as to implement the method for detecting an electrocardiographic data peak of ECG according to the embodiment of the present application.
Those skilled in the art will appreciate that the embodiment of the computer device shown in fig. 5 is not limiting of the specific construction of the computer device, and in other embodiments, the computer device may include more or less components than those shown, or certain components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may include only a memory and a processor, and in such embodiments, the structure and function of the memory and the processor are consistent with the embodiment shown in fig. 5, and will not be described again.
It should be appreciated that in embodiments of the present application, the Processor 502 may be a central processing unit (Central Processing Unit, CPU), the Processor 502 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATEARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the application, a computer-readable storage medium is provided. The computer readable storage medium may be a nonvolatile computer readable storage medium or a volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program when executed by a processor implements the method for detecting the cardiac data peak of the ECG disclosed by the embodiment of the application.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus, device and unit described above may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein. Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, for example, the division of the units is merely a logical function division, there may be another division manner in actual implementation, or units having the same function may be integrated into one unit, for example, multiple units or components may be combined or may be integrated into another apparatus, or some features may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices, or elements, or may be an electrical, mechanical, or other form of connection.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units may be stored in a storage medium if implemented in the form of software functional units and sold or used as stand-alone products. Based on this understanding, the technical solution of the present application may be essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a background server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
While the application has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (6)

1. A method for peak detection of electrocardiographic data of an ECG, comprising:
responding to a wave crest detection instruction, and acquiring electrocardiograph data to be detected corresponding to the wave crest detection instruction; the electrocardiographic data to be detected are sequences comprising a plurality of electrocardiographic value conversion values which are arranged according to time sequence;
baseline drift removal is carried out on the electrocardiograph data to be detected, and a first signal is obtained;
t wave removal is carried out on the first signal, and a second signal is obtained;
r peak protrusion is carried out on the second signal, and a third signal is obtained;
r peak identification is carried out on the third signal based on the dual-threshold amplitude reduction, and an R peak identification result is obtained;
and carrying out R peak identification on the third signal based on the dual-threshold amplitude reduction to obtain an R peak identification result, wherein the R peak identification result comprises the following steps:
Sequentially carrying out potential peak searching, interference peak elimination and missing peak supplementation on the third signal based on double-threshold amplitude reduction to obtain the R peak identification result;
the step of sequentially carrying out potential peak searching, interference peak removing and missing peak supplementing on the third signal based on the dual-threshold amplitude reduction to obtain the R peak identification result comprises the following steps:
Initializing a first threshold value, a second threshold value and an initial amplitude value;
acquiring an ith signal value in the third signal; wherein, the initial value of i is 1, and the value range of i is [1, N ], N represents the total number of the third signal values including signal values;
judging whether the initial amplitude value is larger than an ith signal value or not;
If the initial amplitude value is smaller than or equal to the ith signal value, updating the value of the initial amplitude value to the ith signal value, updating the value of a first parameter to the value of i, updating the value of a second parameter to the ith signal value, updating the value of an identification value to a first preset value, increasing i by 1 to update the value of i, and returning to the step of acquiring the ith signal value in the third signal;
If the initial amplitude value is larger than the ith signal value, automatically increasing i by 1 to update the value of i;
Judging whether the identification value is equal to a first preset value or not;
if the identification value is equal to a first preset value, acquiring a difference value between the value of i and the first parameter;
Judging whether the difference value between the value of i and the first parameter is larger than a first preset sampling frequency or not;
If the difference between the value of i and the first parameter is smaller than or equal to the first preset sampling frequency, returning to the step of acquiring the ith signal value in the third signal;
If the difference between the value of i and the first parameter is larger than the first preset sampling frequency, acquiring a difference between the first parameter and the previous first parameter;
judging whether the difference value between the first parameter and the previous first parameter is smaller than a second preset sampling frequency or not; wherein the second preset sampling frequency is greater than the first preset sampling frequency;
If the difference between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, updating the value of the third parameter to [ second parameter-second threshold ]. Times.2/sampling frequency;
updating the first threshold value and the second threshold value based on a preset threshold value updating strategy so as to update the values of the first threshold value and the second threshold value;
updating the value of the previous first parameter to be the first parameter, and updating the identification value to be a second preset value;
updating the initial amplitude value to be a second parameter-sampling frequency/5 x third parameter 3/4;
Outputting the first parameter as the R peak identification result;
Updating the first threshold and the second threshold based on a preset threshold updating strategy to update the values of the first threshold and the second threshold comprises:
Acquiring the second parameter;
judging whether the second parameter is larger than the first threshold value or not;
If the second parameter is greater than the first threshold, updating the value of the first threshold to be 0.6 x the middle value of the R peak stored in the buffer area, and updating the value of the second threshold to be 0.4 x the middle value of the R peak stored in the buffer area;
If the second parameter is smaller than or equal to the first threshold, judging whether the second parameter is larger than the second threshold and judging whether the second parameter is smaller than the first threshold;
If the second parameter is greater than the second threshold and the second parameter is less than the first threshold, subtracting the absolute value of the stored R-peak intermediate value of the buffer from the first threshold to update the first threshold, and updating the value of the second threshold to 0.4 x the stored R-peak intermediate value of the buffer;
if the second parameter is smaller than or equal to the second threshold value or the second parameter is larger than or equal to the first threshold value, updating the value of the first threshold value to a preset first minimum value, and updating the value of the second threshold value to a preset second minimum value;
and storing the second parameter into the buffer area.
2. The method according to claim 1, wherein after determining whether the difference between the first parameter and the previous first parameter is smaller than a second preset sampling frequency, further comprising:
If the difference value between the first parameter and the previous first parameter is greater than or equal to the second preset sampling frequency, acquiring a pre-stored R peak backtracking search strategy and acquiring the R peak identification result in the third signal based on the R peak backtracking search strategy;
the obtaining the R-peak identification result in the third signal based on the R-peak backtracking lookup policy includes:
Reading the stored first historical R peak and second historical R peak from a buffer, and acquiring data in the buffer between the first historical R peak and the second historical R peak to form a first data set;
deleting the data smaller than the first preset sampling frequency in the first data set to obtain a second data set;
Obtaining a maximum value in the second data set and a subscript corresponding to the maximum value;
and outputting the maximum value in the second data set as an R peak identification result.
3. The method for detecting an electrocardiographic data peak according to claim 1, wherein after determining whether the identification value is equal to the first preset value, further comprising:
if the identification value is not equal to a first preset value, judging whether the initial amplitude value is smaller than the second threshold value or not;
if the initial amplitude value is smaller than the second threshold value, updating the value of the initial amplitude value into the second threshold value;
if the initial amplitude value is greater than or equal to the second threshold value, subtracting the third parameter from the value of the initial amplitude value to update the initial amplitude value;
subtracting 1 from the second threshold value to update the value of the second threshold value;
Judging whether the second threshold value is smaller than a preset second minimum value or not;
If the second threshold value is smaller than the second minimum value, updating the value of the initial amplitude value to be the second threshold value;
if the second threshold value is greater than or equal to the second minimum limit value, judging whether the initial amplitude value is smaller than the preset second minimum limit value or not;
If the initial amplitude value is smaller than the preset second minimum value, updating the initial amplitude value to the preset second minimum value, and returning to the step of acquiring the ith signal value in the third signal;
And if the initial amplitude value is greater than or equal to the preset second minimum value, returning to the step of acquiring the ith signal value in the third signal.
4. A method of electrocardiographic data peak detection according to any one of claims 1 to 3, wherein said R-peak highlighting of the second signal results in a third signal, comprising:
and obtaining the aroma energy entropy of each signal in the second signal to perform R peak protrusion, so as to obtain the third signal.
5. An ECG electrocardiographic data peak detection device for performing the ECG electrocardiographic data peak detection method according to any one of claims 1 to 4.
6. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of electrocardiographic data peak detection of ECG according to any one of claims 1-4 when the computer program is executed by the processor.
CN202211414560.2A 2022-11-11 2022-11-11 ECG (electrocardiogram) data peak detection method and device and computer equipment Active CN115886834B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211414560.2A CN115886834B (en) 2022-11-11 2022-11-11 ECG (electrocardiogram) data peak detection method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211414560.2A CN115886834B (en) 2022-11-11 2022-11-11 ECG (electrocardiogram) data peak detection method and device and computer equipment

Publications (2)

Publication Number Publication Date
CN115886834A CN115886834A (en) 2023-04-04
CN115886834B true CN115886834B (en) 2024-06-25

Family

ID=86493294

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211414560.2A Active CN115886834B (en) 2022-11-11 2022-11-11 ECG (electrocardiogram) data peak detection method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN115886834B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103654770A (en) * 2013-12-03 2014-03-26 上海理工大学 Method and device for real-time detection of moving electrocardiosignal QRS (magnetic resonance angiography) waves

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107233093B (en) * 2017-05-23 2020-05-12 安徽华米智能科技有限公司 R wave detection method and device and electronic equipment
KR101983037B1 (en) * 2017-08-18 2019-05-29 가천대학교 산학협력단 An apparatus for detecting r-peak in electrocardiogram signal by using wavelet transform and modified shannon energy envelope and the method thereof
CN107788969B (en) * 2017-09-29 2020-09-29 成都瑞迪康医疗科技有限公司 Automatic detection method for QRS wave group in electrocardiosignal
CN108888259B (en) * 2018-05-21 2021-04-27 南京大学 Real-time QRS wave detection method for electrocardiosignals
CN108830255A (en) * 2018-06-29 2018-11-16 江苏师范大学 A kind of peak R recognition methods based on Wavelet Denoising Method electrocardiosignal
KR102165205B1 (en) * 2018-08-28 2020-10-13 한국과학기술연구원 Method for detecting r-peak of electrocardiogram in mobile environment and system for implementing the same
CN109820501B (en) * 2018-11-12 2023-11-28 浙江清华柔性电子技术研究院 Electrocardiosignal R wave identification method and device and computer equipment
KR102155206B1 (en) * 2019-01-22 2020-09-11 조선대학교산학협력단 R wave peak detection method using periodicity of ECG signal
CN110680302B (en) * 2019-08-30 2021-09-10 西北大学 Automatic identification method for electrocardiosignal characteristic wave
CN113499082B (en) * 2020-03-23 2023-12-19 疆域康健创新医疗科技成都有限公司 QRS complex detection method, electrocardiograph detection device and readable storage medium
CN113100778B (en) * 2021-04-14 2022-03-08 福州大学 R peak positioning method of electrocardiosignal
CN114366121B (en) * 2022-01-18 2024-04-19 西安理工大学 Double dynamic threshold value electrocardio QRS wave detection method based on digital morphology
CN115120248B (en) * 2022-09-02 2022-12-20 之江实验室 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103654770A (en) * 2013-12-03 2014-03-26 上海理工大学 Method and device for real-time detection of moving electrocardiosignal QRS (magnetic resonance angiography) waves

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
自适应双阈值心电信号检测算法研究;陈耿铎, 曾有灵, 李喆;暨南大学学报;20180630;第39卷(第3期);第262-268页 *

Also Published As

Publication number Publication date
CN115886834A (en) 2023-04-04

Similar Documents

Publication Publication Date Title
CN106659900B (en) Implantable medical device with autocorrelation device and with analysis device for estimating heart rate
JP6219942B2 (en) Real-time QRS period measurement in ECG
US4458691A (en) System and method for predicting ventricular tachycardia by adaptive high pass filter
US10213163B2 (en) Low-distortion ECG denoising
CN111134659B (en) Method and device for detecting P wave and T wave in electrocardiosignal
CN104799844A (en) Hybrid bipolar/unipolar detection of activation wavefront
CN107647864B (en) Electrocardiosignal analysis method and imaging method
JP2000333922A (en) System and method for quantifying alternation of electrocardiogram signal
CN109009073B (en) Atrial fibrillation detection apparatus and storage medium
JP7232194B2 (en) Method and system for processing EMG signals
CN111920407B (en) Electrocardiogram feature extraction method, system, device and medium based on wavelet transformation
US6668189B2 (en) Method and system for measuring T-wave alternans by alignment of alternating median beats to a cubic spline
De Chazal Detection of supraventricular and ventricular ectopic beats using a single lead ECG
CN109077721B (en) Atrial fibrillation detection apparatus and storage medium
Prasad et al. Heart rate detection using Hilbert transform
Orlandic et al. REWARD: Design, optimization, and evaluation of a real-time relative-energy wearable R-peak detection algorithm
CN115828056A (en) Electrocardiogram characteristic signal extraction method and terminal
CN113499082A (en) QRS complex detection method, electrocardiogram detection device and readable storage medium
Sabherwal et al. Aiding the detection of QRS complex in ECG signals by detecting S peaks independently
Hu et al. An approach to QRS complex detection based on multiscale mathematical morphology
CN115886834B (en) ECG (electrocardiogram) data peak detection method and device and computer equipment
CN113786202B (en) Electrocardiogram characteristic starting point and ending point detection method, system, device and medium
Chatterjee et al. Real–time detection of electrocardiogram wave features using template matching and implementation in FPGA
IL258417A (en) Ecg machine including filter for feature detection
CN110477904B (en) House flapping signal detection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant