CN115886834A - ECG data peak detection method and device and computer equipment - Google Patents

ECG data peak detection method and device and computer equipment Download PDF

Info

Publication number
CN115886834A
CN115886834A CN202211414560.2A CN202211414560A CN115886834A CN 115886834 A CN115886834 A CN 115886834A CN 202211414560 A CN202211414560 A CN 202211414560A CN 115886834 A CN115886834 A CN 115886834A
Authority
CN
China
Prior art keywords
value
peak
threshold
signal
parameter
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.)
Granted
Application number
CN202211414560.2A
Other languages
Chinese (zh)
Other versions
CN115886834B (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

Images

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 ECG data peak detection computer equipment. The method and the device realize accurate distinguishing of the R peak and the noise in the electrocardio data containing the noise, and obtain the R peak identification result with higher identification accuracy.

Description

ECG data peak detection method and device and computer equipment
Technical Field
The application relates to the technical field of signal processing, in particular to an ECG data wave crest detection method and device and computer equipment.
Background
Electrocardiography (ECG, the full term ECG is electrocardiagram) is a record of the myocardial electrical activity of the heart in a cardiac cycle, and is composed of P (in a cardiac cycle, the first small and blunt wave is called P wave), QRS (the second short time after P wave), a group of short time, high amplitude and sharp shape, called QRS group, which reflects the depolarization process of the left and right ventricles, and a typical QRS group includes three closely linked potential fluctuations, the first downward wave is called Q wave, the first upward wave is called R wave, the downward wave after R wave is called S wave), T (the upward wave with long duration and low amplitude, called T wave, which reflects the repolarization process of ventricles, lasting 0.05-0.25 sec, 0.1-0.8 amplitude) and a condition wave (the upward wave occurring at a time interval after QRS group, called T wave, the repolarization process of ventricles, and a rhythm related to ventricular contraction cycle, called mV is called atrial wave and a rhythm is called ventricular contraction phase with low amplitude.
The electrocardiosignal can be acquired by placing the 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 the PR interval (meaning from the start of the P wave to the start of the QRS wave), the QRS interval (duration from the QRS complex), the QT interval (from the start of the Q wave to the start of the conditional U wave in the QRS complex), the ST interval (duration from the end of the S wave to the start of the T wave in the QRS complex), the PR segment (duration from the start of the P wave to the start of the QRS wave) and the ST segment (from the end of the QRS wave to the start of the T wave) are used to infer the heart condition. The detection of the QRS complex and the R peak provides the basis for almost all automated electrocardiographic analysis algorithms. The QRS complex reflects the electrical activity of the heart during ventricular contraction, the time of occurrence and shape of which provide much information about the current state of the heart. It can be seen that accurate QRS detection not only allows for the calculation of heart rate, but also is important for the analysis of heart rate variability.
In the research of the prior art, it is found that the prior art generally adopts a Pan, tompkins algorithm, that is, a band-pass filter of 5-15Hz is used to remove interference noise and T waves, a 5-point derivative method and a square are used to highlight an R peak, a sliding window integration is used to eliminate double peaks, a relatively prominent R peak is obtained, and a double threshold mode and an RR interval are used to identify the R peak.
However, after the method is adopted, double peaks appear in the square signal after derivation, and meanwhile, the signal square is adopted to highlight the R peak, so that the difference of the R peaks with different amplitudes is increased. Therefore, the Pan and Tompkins algorithm is not enough in the capability of suppressing noise interference, when a square signal after derivation is subjected to integration processing by using a moving window, not only can a candidate R peak be obtained, but also high-frequency noise similar to the waveform state of the R wave can be obtained, so that the algorithm cannot be well distinguished, and the condition of false detection can be directly caused. And when the degree of noise interference of the electrocardiosignal is serious, the false detection probability is increased.
Disclosure of Invention
The embodiment of the application provides an ECG data peak detection method, an ECG data peak detection device and ECG data peak detection computer equipment, and aims to solve the problem that in the prior art, when R peak identification is carried out on ECG data, not only can a candidate R peak be obtained, but also high-frequency noise similar to an R wave form state can be obtained possibly, so that the R peak cannot be accurately detected.
In a first aspect, an embodiment of the present application provides a method for detecting a peak of electrocardiographic data of an ECG, which includes:
responding to a wave crest detection instruction, and acquiring to-be-detected electrocardiogram data corresponding to the wave crest detection instruction; the electrocardiogram data to be detected comprises a sequence of a plurality of electrocardiogram value conversion numerical values arranged according to a time sequence;
removing baseline drift of the electrocardiogram data to be detected to obtain a first signal;
removing T waves of the first signal to obtain a second signal;
performing R peak protrusion on the second signal to obtain a third signal;
and performing R peak identification on the third signal based on double-threshold amplitude reduction to obtain an R peak identification result.
In a second aspect, an embodiment of the present application provides an ECG peak detection apparatus, which includes:
the to-be-detected electrocardiogram data acquisition module is used for responding to a wave crest detection instruction and acquiring to-be-detected electrocardiogram data corresponding to the wave crest detection instruction; the electrocardiogram data to be detected comprises a sequence of a plurality of electrocardiogram value conversion numerical values which are arranged according to a time sequence;
the baseline drift removal module is used for removing baseline drift of the electrocardiogram data to be detected to obtain a first signal;
the T wave removing module is used for removing T waves of 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 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, and the processor, when executing the computer program, implements the ECG peak detection method according to the first aspect.
In a fourth aspect, the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the ECG electrocardiographic data peak detection method according to the first aspect.
The embodiment of the application provides an ECG data peak detection method, device and computer equipment, wherein after acquiring ECG data to be detected, baseline drift removal, T wave removal, R peak protrusion and R peak identification based on dual-threshold amplitude reduction are sequentially carried out to obtain an R peak identification result. The method and the device realize accurate distinguishing of the R peak and the noise in the electrocardio data containing the noise, and obtain 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 needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a method for detecting a peak of ECG electrocardiographic data according to an embodiment of the present application;
FIG. 2 is a schematic flowchart of a method for detecting a peak of ECG data according to an embodiment of the present application;
fig. 3 is a schematic general flow chart of a dual-threshold amplitude reduction method in an ECG electrocardiographic data peak detection method according to an embodiment of the present application;
FIG. 4 is a schematic block diagram of an ECG peak detection device according to an embodiment of the present application;
fig. 5 is a schematic block diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
It will be understood that the terms "comprises" and/or "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 present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application 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 this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a method for detecting a peak of ECG electrocardiographic data according to an embodiment of the present application; fig. 2 is a schematic flow chart of an ECG electrocardiographic data peak detection method according to an embodiment of the present application, where the ECG electrocardiographic data peak detection method is applied to an electrocardiographic 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 electrocardiogram data to be detected corresponding to the wave crest detection instruction; the electrocardiogram data to be detected is a sequence comprising a plurality of electrocardiogram value conversion values arranged according to a time sequence.
In this embodiment, an electrocardiogram data acquisition device (e.g., a smart watch with an electrocardiogram acquisition function) is used as an implementation subject to describe the technical solution. In addition, the technical scheme is described in the application by taking the electrocardiogram data to be detected in one acquisition period as an example. Generally, if the actually acquired electrocardiographic data includes electrocardiographic data of a plurality of acquisition cycles, R peak identification in the electrocardiographic data of each acquisition cycle is the technical scheme of the reference application. In addition, the initial electrocardiographic data of each acquisition cycle is data in a time domain, but the electrocardiographic data needs to be subjected to AD conversion (i.e., analog-to-digital conversion) in the electrocardiographic data acquisition device to obtain electrocardiographic data to be detected corresponding to the initial electrocardiographic data. In the process of performing AD conversion on the initial electrocardiographic data, conversion is performed according to a preset sampling frequency, where the sampling frequency is denoted as Fs.
The peak detection instruction may be automatically generated by the electrocardiograph data obtaining device, and if the interval between the current system time and the last peak detection time is equal to a preset peak detection period (if the peak detection period is set to 1 hour, the electrocardiograph data obtaining device automatically generates one peak detection instruction per hour and triggers a subsequent peak detection process). The peak detection instruction may also be generated when the electrocardiogram data acquiring device receives a manual operation instruction of a user, that is, when the user clicks a peak detection button on a user interaction interface of the electrocardiogram data acquiring device, the peak detection instruction may be triggered to be generated. Therefore, no matter how the peak detection instruction is generated, as long as the peak detection instruction is generated, the subsequent peak detection processing can be performed.
S102, baseline drift removal is carried out on the electrocardio 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 it is required to remove noise in the electrocardiographic data to be detected and ensure that signals are not distorted. Moreover, if the signal corresponding to the electrocardiogram data to be detected contains noise, the R peak identification may be wrong; if the signal corresponding to the electrocardiographic data to be detected is distorted, the difference between the position of the filtered R peak and the actual position may be caused.
In one embodiment, step S102 includes:
performing baseline drift removal on the electrocardiogram data to be detected based on an integer coefficient linear high-pass filter to obtain a first signal; the integral coefficient linear high-pass filter corresponds to the following formula:
Figure BDA0003939227900000051
y 3 (n)=m 1 *y 3 (n-L)-m 2 *y 3 (n-L*M)+x(n)-m 3 *x(n-K*L)+m 4 *x(n-K*L*M);
Figure BDA0003939227900000052
Figure BDA0003939227900000053
where x (n) is the input signal, y (n) is the output signal, f pm Is a 3db cut-off frequency point, h1 is the maximum fluctuation amplitude in the pass band, K, L, M are integers, m 1 、m 2 、m 3 And m 4 Are all preset parameter values, y 3 (n) represents an intermediate meterAnd (4) calculating a value.
In this embodiment, the integer coefficient linear high-pass filter corresponding to the above formula can be used to remove both baseline wander and power frequency interference. Because the coefficient of the integer coefficient linear high-pass filter is an integer, the operation rate can be improved, real-time operation can be met on wearable equipment, and the ECG waveform is guaranteed not to be distorted.
S103, T wave removal is carried out on the first signal to obtain a second signal.
In this embodiment, the T wave in the first signal is filtered based on a median filter, and the window size of the median filter is Fs/6, where Fs is the sampling frequency. After the first signal is subjected to T wave removal, the interference of the T wave is effectively removed, and the subsequent R peak detection is more accurate.
And S104, performing R peak protrusion on the second signal to obtain a third signal.
In the embodiment, after the T wave in the first signal is removed, the interference of the T wave on the R peak identification is avoided. But in order to more accurately locate the R peak, the R peak can be highlighted by the aroma energy, so as to suppress noise and T waves, and further exclude more interference terms from the obtained third signal, so as to detect and obtain a more accurate R peak.
In one embodiment, step S104 includes:
and acquiring the aroma concentration energy entropy of each signal in the second signal to perform R peak projection to obtain a third signal.
In this embodiment, when calculating the energy entropy of the fragrance concentration of each signal in the second signal, the following formula (1) is specifically referred to:
q(n)=-p(n) 2 logp(n) 2 (1)
wherein, in formula (1), p (n) represents any one of the second signals, and q (n) represents the fragrance energy entropy corresponding to p (n). After the aroma concentration 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 large, T waves and noise are suppressed, and the amplitude difference of the R peak at different moments is small.
And S105, performing R peak identification on the third signal based on dual-threshold amplitude reduction to obtain an R peak identification result.
In the present embodiment, the reason why the dual-threshold amplitude reduction is used to perform R peak identification on the third signal is that a candidate R peak may be obtained in the third signal, and a high-frequency noise similar to the waveform of the R wave is likely to be obtained. The R peak can be accurately identified and high-frequency noise can be eliminated by a double-threshold amplitude reduction method, so that the R peak identification result with extremely low false detection probability is finally obtained.
In one embodiment, step S105 includes:
and sequentially searching potential wave crests, eliminating interference wave crests and supplementing missing wave crests for the third signal based on the double-threshold amplitude reduction to obtain an R peak identification result.
In this embodiment, since the third signal stores therein the high-frequency noise similar to the waveform of the R wave, the candidate peak, the interference peak (i.e. the high-frequency noise) and the trace-back missing peak can be sequentially searched for from the third signal based on the dual-threshold amplitude reduction method, so as to obtain the R peak identification result with high identification accuracy.
In an embodiment, the sequentially performing potential peak search, interference peak elimination and missing peak supplement on the third signal based on dual-threshold amplitude reduction to obtain an R peak identification result includes:
initializing a first threshold, a second threshold and an initial amplitude value;
acquiring an ith signal value in the third signal; wherein, the initial value of i is 1, the value range of i is [1,N ], and N represents the total number of the third signal values including the signal values;
judging whether the initial amplitude value is larger than the ith signal value;
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 execute the step of acquiring the ith signal value in the third signal;
if the initial amplitude value is larger than the ith signal value, increasing the value of i by 1 by self 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 greater than a first preset sampling frequency or not;
if the difference between the value of i and the first parameter is less 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 the 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 less 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 value between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, updating the value of a third parameter to [ second parameter-second threshold ] × 2/sampling frequency;
updating the first threshold and the second threshold based on a preset threshold updating strategy so as to update the values of the first threshold and the second threshold;
updating the value of the previous first parameter to the first parameter, and updating the identification value to a second preset value;
updating the initial amplitude value to a second parameter-sampling frequency/5-third parameter 3/4;
and outputting the first parameter as an R peak identification result.
In this embodiment, for better understanding of the present solution, please refer to a general flowchart of a dual-threshold amplitude reduction method in the ECG electrocardiographic data peak detection method as shown in fig. 3. Specifically, the initialized first threshold is denoted by th1 in fig. 3, the initialized second threshold is denoted by th2 in fig. 3, and the initial amplitude value is denoted by Y in fig. 3, and then after initializing the above 3 values, the first threshold th1, the second threshold th2, and the initial amplitude value Y are obtained (generally, Y is an initial value close to 0, and is changed in a subsequent process).
Since the third signal includes N signal values, the processing can be performed in sequence according to the arrangement order of the signal values. If the 1 st signal value in the third signal is first extracted, then it is determined whether the initial amplitude value Y is greater than the 1 st signal value for determining whether the 1 st signal value is a potential R peak.
If the initial amplitude value is smaller than or equal to the 1 st signal value, it indicates that the 1 st signal value is not a potential R peak, at this time, the value of the initial amplitude value Y is directly updated to the 1 st signal value, the value of the first parameter Peaklock is updated to the value of i, the value of the second parameter peaklal is updated to the 1 st signal value, the value of the identification value Flag is updated to the first preset value (in specific implementation, the first preset value is equal to 1), 1 is increased from 1 to 2 to update the value of i, and the step of acquiring the ith signal value in the third signal is executed. If the initial amplitude value is larger than the 1 st signal value, it indicates that the 1 st signal value is a potential R peak, and at this time, the value of i is updated by increasing 1 by itself to 2.
And then judging whether the identification value Flag is equal to a first preset value or not, if so, acquiring a difference value between the value of i and the first parameter Peaklock, and judging whether the difference value between the value of i and the first parameter Peaklock is greater than a first preset sampling frequency or not so as to judge whether the 1 st signal value is an interference peak or not (in specific implementation, the first preset sampling frequency is equal to the sampling frequency Fs/5).
If the difference between the value 2 of i and the first parameter Peaklock is less than or equal to the first preset sampling frequency Fs/5, it indicates that the 1 st signal value is an interference peak, and the step of obtaining the ith signal value in the third signal is performed. And if the difference between the value of i and the first parameter Peaklock is greater than the first preset sampling frequency Fs/5, indicating that the 1 st signal value is not an interference peak, and continuing to execute the next step.
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 a specific implementation, the second preset sampling frequency is equal to the sampling frequency Fs × 2) so as to determine whether there is a missing peak condition. And if the difference between the first parameter Peaklock and the previous first parameter PrePeaklock is less than Fs x 2, updating the value of the third parameter k to [ second parameter Peakval-second threshold th2 ]. X2/sampling frequency Fs. And then updating the first threshold th1 and the second threshold th2 based on a preset threshold updating strategy to obtain the 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 identification value Flag to a second preset value (in specific implementation, the second preset value is set to 0), where updating the identification value Flag to the second preset value is to re-take the identification value Flag to 0 when performing R-peak detection on electrocardiographic data to be detected in a next acquisition period; updating the initial amplitude value Y into a second parameter Peakval-sampling frequency Fs/5 and a third parameter k 3/4, wherein the updating of the initial amplitude value Y can ensure that the Y value can inherit the adjustment value of the previous round instead of reinitializing the Y value when R peak detection is carried out on the electrocardiogram data to be detected in the next acquisition cycle; and outputting the first parameter Peaklock as an R peak identification result. Therefore, based on the process, the candidate wave peak can be searched for the third signal, the interference wave peak can be eliminated, and the missing wave peak can be added in a backtracking manner, so that the R peak identification result with high identification accuracy can be obtained.
In an embodiment, after determining whether a difference between the first parameter and a previous first parameter is smaller than a 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 of the R peak identification result in the third signal based on the R peak backtracking search strategy includes:
reading a first history R peak and a second history R peak which are stored from a buffer area, and acquiring data positioned between the first history R peak and the second history R peak in the buffer area to form a first data set;
deleting the data with the sampling frequency less than the first preset sampling frequency in the first data set to obtain a second data set;
acquiring a maximum value in the second data set and a subscript corresponding to the maximum value;
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 history R peak and second history R peak from the buffer of the electrocardiographic data obtaining device based on the above R peak backtracking search strategy, and obtain the data located between the first history R peak and the second history R peak in the buffer, so as to form a first data set (i.e., read all data between 2 candidate R peaks). And then removing the interference data in the first data set, namely removing the data which is less than the first preset sampling frequency Fs/5 in the first data set, thereby reserving effective data to form a second data set. And finally, acquiring the maximum value maxval from the second data to be used as an R peak identification result. Based on a backtracking reading mode, the candidate R peak in the buffer area can be reselected as an R peak identification result, so that the real R peak is effectively prevented from being deleted by mistake. The subscript corresponding to the maximum value is obtained 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 quickly positioning an R peak identification result when the peak backtracking search is performed on the electrocardiographic data to be detected in each subsequent acquisition period.
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 the first preset value, judging whether the initial amplitude value is smaller than the second threshold value;
if the initial amplitude value is smaller than the second threshold, updating the value of the initial amplitude value to the second threshold;
if the initial amplitude value is larger than or equal to the second threshold, subtracting the third parameter from the value of the initial amplitude value to update the initial amplitude value;
subtracting 1 from the second threshold to update the value of the second threshold;
judging whether the second threshold value is smaller than a preset second lowest limit value or not;
if the second threshold value is smaller than the second minimum limit value, updating the value of the initial amplitude value to 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;
if the initial amplitude value is smaller than the preset second lowest limit value, updating the initial amplitude value to the preset second lowest limit value, and returning to execute 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 lowest limit value, returning to execute 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 value Flag is not equal to the first preset value (i.e., the 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 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 larger than or equal to th2, subtracting the value of 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 manners, the value of the second threshold th2 is updated by subtracting 1 from the second threshold th2. Then, it is determined whether the second threshold th2 is smaller than a preset second minimum limit value th2_ limit. If the second threshold th2 is smaller than the second minimum limit value th2_ limit, updating the value of the initial amplitude value Y to the second threshold th2, and performing a step of determining whether the initial amplitude value Y is smaller than the preset second minimum limit value th2_ limit; if the second threshold th2 is greater than or equal to the second minimum limit value th2_ limit, a step of determining whether the initial amplitude value Y is less than the preset second minimum limit value th2_ limit is performed.
After the updating is completed, it is further determined whether the initial amplitude value Y is smaller than the preset second minimum limit value th2_ limit, and the step of obtaining the ith signal value in the third signal is executed again after the determination. If the initial amplitude value Y is smaller than the preset second minimum limit value th2_ limit, the step of obtaining the ith signal value in the third signal is executed after the initial amplitude value Y is updated to the preset second minimum limit value th2_ limit. And if the initial amplitude value Y is greater than or equal to the preset second minimum limit value th2_ limit, directly returning to the step of acquiring the ith signal value in the third signal. It can be seen that the above-mentioned manner can also be used to find the R peak again from the remaining signal values after the amplitude of the dual threshold has dropped.
In an embodiment, the updating the first threshold and the second threshold based on a preset threshold updating policy to update 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;
if the second parameter is larger than the first threshold, updating the value of the first threshold to be 0.6-fold middle value of the stored R peak of the buffer area, and updating the value of the second threshold to be 0.4-fold middle value of the stored R peak of the buffer area;
if the second parameter is less than or equal to the first threshold, judging whether the second parameter is greater than the second threshold and judging whether the second parameter is less 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 an absolute value of a middle value of a stored R peak of the buffer from the first threshold to update the first threshold, and updating a value of the second threshold to be 0.4 times of the middle value of the stored R peak of the 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, updating the value of the first threshold to a preset first minimum value, and updating the value of the second threshold to a preset second minimum value;
and saving the second parameter to a buffer area.
In this embodiment, updating the first threshold and the second threshold based on a preset threshold updating policy may be regarded as an adjustment manner of dual threshold amplitude decrease, specifically, first obtaining a second parameter Peakval, then determining whether the second parameter Peakval is greater than the first threshold th1, and if the second parameter Peakval is greater than the first threshold th1, updating the first threshold th1 and the second threshold th2 according to a first manner, that is, updating a value of the first threshold to a 0.6 stored R-peak intermediate value of the buffer (where the stored R-peak intermediate value of the buffer is obtained by arranging the stored R-peaks in order from large to small and then taking a value of the R-peak arranged at the middle as a stored R-peak intermediate value of the buffer, where the buffer may be represented by a peak, the R-peak intermediate value may be represented by a median (peak), and updating a value of the second threshold to a 0.4 stored R-peak intermediate value of the buffer.
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 manner, that is, the first threshold th1 is subtracted from an absolute value abs (peak buffer) of a middle value of a stored R peak in the buffer to update the first threshold th1, and a value of the second threshold th2 is updated to 0.4, the middle value of the stored R peak in the buffer is updated according to a third manner, 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 manner, that is, the value of the first threshold th1 is updated to a preset first minimum limit value th1_ limit value, and the value of the second threshold 2 is updated to a preset second minimum value 2_ limit value, and the update of the buffer peak amplitude is performed based on the updated value of the residual peak R peak, and the updated value of the peak is updated from the second threshold th2 to the second threshold.
The method realizes the accurate distinguishing of 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 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 electrocardiographic data peak detection apparatus 100 according to an embodiment of the present application.
As shown in fig. 4, the ECG electrocardiographic data peak detection apparatus 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 to-be-detected electrocardiogram data acquisition module 101 is used for responding to a peak detection instruction and acquiring to-be-detected electrocardiogram data corresponding to the peak detection instruction; the electrocardiogram data to be detected is a sequence comprising a plurality of electrocardiogram value conversion values arranged according to a time sequence.
In this embodiment, an electrocardiogram data acquisition device (e.g., a smart watch with an electrocardiogram acquisition function) is used as an execution subject to describe the technical solution. In addition, the technical scheme is described in the application by taking the electrocardiogram data to be detected in one acquisition period as an example. Generally, if the actually acquired electrocardiographic data includes electrocardiographic data of a plurality of acquisition cycles, R peak identification in the electrocardiographic data of each acquisition cycle is the technical scheme of the reference application. In addition, the initial electrocardiographic data of each acquisition cycle is data in a time domain, but the electrocardiographic data needs to be subjected to AD conversion (i.e., analog-to-digital conversion) in the electrocardiographic data acquisition device to obtain electrocardiographic data to be detected corresponding to the initial electrocardiographic data. In the process of performing AD conversion on the initial electrocardiographic data, the conversion is performed according to a preset sampling frequency, wherein the sampling frequency is recorded as Fs.
The peak detection instruction may be automatically generated by the electrocardiograph data obtaining device, and if the interval between the current system time and the last peak detection time is equal to a preset peak detection period (if the peak detection period is set to 1 hour, the electrocardiograph data obtaining device automatically generates one peak detection instruction per hour and triggers a subsequent peak detection process). The peak detection instruction may also be generated when the electrocardiogram data acquisition device receives a manual operation instruction of a user, that is, when the user clicks a peak detection button on a user interaction interface of the electrocardiogram data acquisition device, the peak detection instruction may be triggered to be generated. Therefore, no matter what way to generate the peak detection instruction, as long as the peak detection instruction is generated, the subsequent peak detection processing can be performed.
The baseline wander removing module 102 is configured to remove baseline wander from the electrocardiographic data to be detected to obtain a first signal.
In this embodiment, the reason why the baseline drift removal is performed on the electrocardiographic data to be detected is to remove the noise in the electrocardiographic data to be detected and ensure that the signal is not distorted. Moreover, if the signal corresponding to the electrocardiogram data to be detected contains noise, the R peak identification may be wrong; if the signal corresponding to the electrocardiographic data to be detected is distorted, the difference between the position of the filtered R peak and the actual position may be caused.
In an embodiment, the baseline drift removal module 102 is specifically configured to:
performing baseline drift removal on the electrocardiogram data to be detected based on an integer coefficient linear high-pass filter to obtain a first signal; the integral coefficient linear high-pass filter corresponds to the following formula:
Figure BDA0003939227900000131
y 3 (n)=m 1 *y 3 (n-L)-m 2 *y 3 (n-L*M)+x(n)-m 3 *x(n-K*L)+m 4 *x(n-K*L*M);
Figure BDA0003939227900000132
Figure BDA0003939227900000141
where x (n) is the input signal, y (n) is the output signal, f pm Is the 3db cut-off frequency point, h1 is the maximum fluctuation amplitude in the pass band, K, L, M are integers, m 1 、m 2 、m 3 And m 4 Are all preset parameter values, y 3 (n) represents an intermediate calculation value.
In this embodiment, the integer coefficient linear high-pass filter corresponding to the above formula can be used to remove both baseline wander and power frequency interference. Because the coefficient of the integer coefficient linear high-pass filter is an integer, the operation rate can be improved, real-time operation can be met on wearable equipment, and the ECG waveform is guaranteed 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, the T wave in the first signal is filtered based on a median filter, and the window size of the median filter is Fs/6, where Fs is the sampling frequency. After the first signal is subjected to T wave removal, the interference of the T wave is effectively eliminated, so that the subsequent R peak detection is more accurate.
And an R peak protrusion module 104, configured to perform R peak protrusion on the second signal to obtain a third signal.
In the embodiment, after the T wave in the first signal is removed, the interference of the T wave on the R peak identification is avoided. However, in order to more accurately locate the R peak, the R peak may be highlighted by the aroma energy, so as to suppress noise and T wave, and further exclude more interference terms from the obtained third signal, so as to detect and obtain a more accurate R peak.
In one embodiment, R peak protrusion module 104 is specifically configured to:
and acquiring the aroma concentration energy entropy of each signal in the second signal to perform R peak projection to obtain a third signal.
In this embodiment, when calculating the energy entropy of the fragrance concentration of each signal in the second signal, the above formula (1) is specifically referred to. In formula (1), p (n) represents any one of the second signals, and q (n) represents the fragrance concentration energy entropy corresponding to p (n). After the aroma concentration 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 large, T waves and noise are suppressed, and the amplitude difference of the R peak at different moments is small.
And the R peak identification module 105 is configured to perform R peak identification on the third signal based on dual-threshold amplitude reduction, so as to obtain an R peak identification result.
In the embodiment, the reason why the dual-threshold amplitude reduction is adopted to perform R peak identification on the third signal is that candidate R peaks may be obtained in the third signal, and high-frequency noise similar to the waveform of the R wave may also be obtained. The R peak can be accurately identified and high-frequency noise can be eliminated by a double-threshold amplitude reduction method, so that the 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 sequentially searching potential wave crests, eliminating interference wave crests and supplementing missing wave crests for the third signal based on the double-threshold amplitude reduction to obtain an R peak identification result.
In this embodiment, since the third signal stores the high-frequency noise similar to the waveform state of the R wave, the candidate peak, the interference peak (i.e., the high-frequency noise) elimination and the trace-back missing peak can be sequentially searched for the third signal based on the dual-threshold amplitude reduction method, so as to obtain the R peak identification result with high identification accuracy.
In an embodiment, the sequentially performing potential peak search, interference peak elimination and missing peak supplement on the third signal based on dual-threshold amplitude reduction 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, the value range of i is [1,N ], and N represents the total number of the third signal values including the signal values;
judging whether the initial amplitude value is larger than the ith signal value;
if the initial amplitude value is less 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 the identification value to a first preset value, increasing the value of i by 1 so as to update the value of i, and returning to execute the step of acquiring the ith signal value in the third signal;
if the initial amplitude value is larger than the ith signal value, increasing the value of i by 1 by self 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 greater than a first preset sampling frequency or not;
if the difference between the value of i and the first parameter is less 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 greater than the first preset sampling frequency, acquiring the 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 less 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 value between the first parameter and the previous first parameter is smaller than the second preset sampling frequency, updating the value of a third parameter to [ second parameter-second threshold ]. Multidot.2/sampling frequency;
updating the first threshold and the second threshold based on a preset threshold updating strategy so as to update the values of the first threshold and the second threshold;
updating the value of the previous first parameter to the first parameter, and updating the identification value to a second preset value;
updating the initial amplitude value to a second parameter-sampling frequency/5-third parameter 3/4;
and outputting the first parameter as an R peak identification result.
In this embodiment, the initialized first threshold is denoted by th1, the initialized second threshold is denoted by th2, and the initial amplitude value is denoted by Y, and then the first threshold th1, the second threshold 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 a subsequent process).
Since the third signal includes N signal values, the processing can be performed in sequence according to the arrangement order of the signal values. If the 1 st signal value in the third signal is first extracted, then it is determined whether the initial amplitude value Y is greater than the 1 st signal value for determining whether the 1 st signal value is a potential R peak.
If the initial amplitude value is less than or equal to the 1 st signal value, it indicates that the 1 st signal value is not the potential R peak, at this time, the value of the initial amplitude value Y is directly updated to the 1 st signal value, the value of the first parameter Peaklock is updated to the value of i, the value of the second parameter Peakval is updated to the 1 st signal value, the value of the identification value Flag is updated to the first preset value (in concrete implementation, the first preset value is equal to 1), 1 is increased from 1 to 2 to update the value of i, and the step of acquiring the ith signal value in the third signal is executed in a return manner. If the initial amplitude value is larger than the 1 st signal value, it indicates that the 1 st signal value is a potential R peak, and at this time, the value of i is updated by increasing 1 by itself to 2.
And then judging whether the identification value Flag is equal to a first preset value or not, if so, acquiring a difference value between the value of i and the first parameter Peaklock, and judging whether the difference value between the value of i and the first parameter Peaklock is greater than a first preset sampling frequency or not so as to judge whether the 1 st signal value is an interference peak or not (in specific implementation, the first preset sampling frequency is equal to the sampling frequency Fs/5).
If the difference between the value 2 of i and the first parameter Peaklock is less than or equal to the first preset sampling frequency Fs/5, it indicates that the 1 st signal value is an interference peak, and the step of obtaining the ith signal value in the third signal is performed. And if the difference between the value of i and the first parameter Peaklock is greater than the first preset sampling frequency Fs/5, indicating that the 1 st signal value is not an interference peak, and continuing to execute the next step.
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 specific implementation, the second preset sampling frequency is equal to the sampling frequency Fs × 2) so as to determine whether there is a missing peak. And if the difference between the first parameter Peaklock and the previous first parameter PrePeaklock is less than Fs x 2, updating the value of the third parameter k to [ second parameter Peakval-second threshold th2 ]. X2/sampling frequency Fs. And then updating the first threshold th1 and the second threshold th2 based on a preset threshold updating strategy to obtain the 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 identification value Flag to a second preset value (in specific implementation, the second preset value is set to 0), where updating the identification value Flag to the second preset value is to re-take the identification value Flag to 0 when performing R-peak detection on electrocardiographic data to be detected in a next acquisition period; updating the initial amplitude value Y into a second parameter Peakval-sampling frequency Fs/5 and a third parameter k 3/4, wherein the updating of the initial amplitude value Y can ensure that the Y value can inherit the adjustment value of the previous round instead of reinitializing the Y value when R peak detection is carried out on the electrocardiogram data to be detected in the next acquisition cycle; and outputting the first parameter Peaklock as an R peak identification result. Therefore, based on the process, the candidate wave peak can be searched for the third signal, the interference wave peak can be eliminated, and the missing wave peak can be added in a backtracking manner, so that the R peak identification result with high identification accuracy can be obtained.
In an embodiment, after determining whether a difference between the first parameter and a previous first parameter is smaller than a 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 of the R peak identification result in the third signal based on the R peak backtracking search strategy includes:
reading a first history R peak and a second history R peak which are stored from a buffer area, and acquiring data positioned between the first history R peak and the second history R peak in the buffer area to form a first data set;
deleting the data with the sampling frequency less than the first preset sampling frequency in the first data set to obtain a second data set;
acquiring 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.
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 history R peak and second history R peak from the buffer of the electrocardiographic data obtaining device based on the above R peak backtracking search strategy, and obtain the data located between the first history R peak and the second history R peak in the buffer, so as to form a first data set (i.e., read all data between 2 candidate R peaks). And then removing interference data in the first data set, namely removing data which are less than the first preset sampling frequency Fs/5 in the first data set, and reserving effective data to form a second data set. And finally, acquiring the maximum value maxval in the second data to be used as an R peak identification result. Based on a backtracking reading mode, the candidate R peak in the buffer area can be reselected as an R peak identification result, and the real R peak is effectively prevented from being deleted by mistake. The subscript corresponding to the maximum value is obtained 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 quickly positioning an R peak identification result when the peak backtracking search is performed on the electrocardiographic data to be detected in each subsequent acquisition period.
In an embodiment, after the determining whether the identification value is equal to the first preset value, the method further includes:
if the identification value is not equal to the first preset value, judging whether the initial amplitude value is smaller than the second threshold value;
if the initial amplitude value is smaller than the second threshold, updating the value of the initial amplitude value to the second threshold;
if the initial amplitude value is larger than or equal to the second threshold, subtracting the third parameter from the value of the initial amplitude value to update the initial amplitude value;
subtracting 1 from the second threshold to update the value of the second threshold;
judging whether the second threshold value is smaller than a preset second lowest limit value or not;
if the second threshold value is smaller than the second minimum limit value, updating the value of the initial amplitude value to 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;
if the initial amplitude value is smaller than the preset second lowest limit value, updating the initial amplitude value to the preset second lowest limit value, and returning to execute 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 lowest limit value, returning to execute 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 value Flag is not equal to the first preset value (i.e., the 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 th2, and if Y is smaller than th2, the value of Y is updated to the value of th2 at that time. And if the Y is greater than or equal to th2, subtracting the value of the third parameter k from the value of the Y to update the value of the Y. After the value of Y is adjusted based on one of the two manners, the value of the second threshold th2 is updated by subtracting 1 from the second threshold th2. Then, it is determined whether the second threshold th2 is smaller than a preset second minimum limit value th2_ limit. If the second threshold th2 is smaller than the second minimum limit value th2_ limit, updating the value of the initial amplitude value Y to the second threshold th2, and performing a step of determining whether the initial amplitude value Y is smaller than the preset second minimum limit value th2_ limit; if the second threshold th2 is greater than or equal to the second minimum limit value th2_ limit, a step of determining whether the initial amplitude value Y is less than the preset second minimum limit value th2_ limit is performed.
After the updating is completed, it is further determined whether the initial amplitude value Y is smaller than the preset second minimum limit value th2_ limit, and the step of obtaining the ith signal value in the third signal is executed again after the determination. If the initial amplitude value Y is smaller than the preset second minimum limit value th2_ limit, the step of obtaining the ith signal value in the third signal is executed after the initial amplitude value Y is updated to the preset second minimum limit value th2_ limit. And if the initial amplitude value Y is greater than or equal to the preset second lowest limit value th2_ limit, directly returning to execute the step of acquiring the ith signal value in the third signal. It can be seen that the above-mentioned manner can also be used to find the R peak again from the remaining signal values after the amplitude of the dual threshold has dropped.
In an embodiment, the updating the first threshold and the second threshold based on a preset threshold updating policy to update 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;
if the second parameter is larger than the first threshold, updating the value of the first threshold to be a middle value of the stored R peak of the 0.6 × buffer, and updating the value of the second threshold to be a middle value of the stored R peak of the 0.4 × buffer;
if the second parameter is less than or equal to the first threshold, judging whether the second parameter is greater than the second threshold and judging whether the second parameter is less 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 an absolute value of a middle value of a stored R peak of the buffer from the first threshold to update the first threshold, and updating a value of the second threshold to be 0.4 times of the middle value of the stored R peak of the 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, updating the value of the first threshold to a preset first minimum value, and updating the value of the second threshold to a preset second minimum value;
and saving the second parameter to a buffer area.
In this embodiment, updating the first threshold and the second threshold based on a preset threshold updating policy may be regarded as an adjustment manner of dual threshold amplitude decrease, specifically, first obtaining a second parameter Peakval, then determining whether the second parameter Peakval is greater than the first threshold th1, and if the second parameter Peakval is greater than the first threshold th1, updating the first threshold th1 and the second threshold th2 according to a first manner, that is, updating a value of the first threshold to a 0.6 stored R-peak intermediate value of the buffer (where the stored R-peak intermediate value of the buffer is obtained by arranging the stored R-peaks in order from large to small and then taking a value of the R-peak arranged at the middle as a stored R-peak intermediate value of the buffer, where the buffer may be represented by a peak, the R-peak intermediate value may be represented by a median (peak), and updating a value of the second threshold to a 0.4 stored R-peak intermediate value of the buffer.
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 manner, that is, the first threshold th1 is subtracted from an absolute value abs (peak buffer) of a middle value of a stored R peak in the buffer to update the first threshold th1, and a value of the second threshold th2 is updated to 0.4, the middle value of the stored R peak in the buffer is updated according to a third manner, 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 manner, that is, the value of the first threshold th1 is updated to a preset first minimum limit value th1_ limit value, and the value of the second threshold 2 is updated to a preset second minimum value 2_ limit value, and the update of the buffer peak amplitude is performed based on the updated value of the residual peak R peak, and the updated value of the peak is updated from the second threshold th2 to the second threshold.
The device realizes the accurate distinction of 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 peak detection apparatus may 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 with electrocardiogram acquisition functionality, such as a smart watch or the like.
Referring to fig. 5, the computer apparatus 500 includes a processor 502, a memory, which may include a storage medium 503 and an internal memory 504, and a network interface 505 connected by a device bus 501.
The storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, causes the processor 502 to perform a method of ECG cardiac data peak detection.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the operation of the computer program 5032 in the storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can execute the ECG peak detection method.
The network interface 505 is used for network communication, such as providing transmission of data information. It will be appreciated by those skilled in the art that the configuration shown in fig. 5 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the scope of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run the computer program 5032 stored in the memory to implement the ECG electrocardiographic data peak detection method disclosed in the embodiment of the present application.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 5 does not constitute a limitation on the specific construction of the computer device, and that in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 5, which are not described herein again.
It should be understood that in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the present 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 ECG electrocardiographic data peak detection method disclosed in the embodiments of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly 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 implementation. 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 in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electrical, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the elements may be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a backend server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An ECG peak detection method, comprising:
responding to a wave crest detection instruction, and acquiring to-be-detected electrocardiogram data corresponding to the wave crest detection instruction; the electrocardiogram data to be detected comprises a sequence of a plurality of electrocardiogram value conversion numerical values which are arranged according to a time sequence;
removing baseline drift of the electrocardiogram data to be detected to obtain a first signal;
removing T waves of the first signal to obtain a second signal;
performing R peak protrusion on the second signal to obtain a third signal;
and performing R peak identification on the third signal based on dual-threshold amplitude reduction to obtain an R peak identification result.
2. The method for detecting the ECG peak of the ECG data according to claim 1, wherein the performing R peak identification on the third signal based on dual-threshold amplitude reduction to obtain an R peak identification result comprises:
and sequentially searching potential wave crests, eliminating interference wave crests and supplementing missing wave crests of the third signal based on dual-threshold amplitude reduction to obtain the R peak identification result.
3. The ECG electrocardiographic data peak detection method according to claim 2, wherein the step of sequentially performing potential peak search, interference peak elimination and missing peak supplement on the third signal based on dual-threshold amplitude reduction to obtain the R peak identification result comprises:
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, the value range of i is [1,N ], and N represents the total number of the third signal values including the signal values;
judging whether the initial amplitude value is larger than the ith signal value;
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 execute the step of acquiring the ith signal value in the third signal;
if the initial amplitude value is larger than the ith signal value, increasing the value of i by 1 by self 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 greater than a first preset sampling frequency or not;
if the difference between the value of i and the first parameter is less 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 greater than the first preset sampling frequency, acquiring the 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 value between the first parameter and the previous first parameter is less than the second preset sampling frequency, updating the value of a third parameter to [ second parameter-second threshold ] × 2/sampling frequency;
updating the first threshold and the second threshold based on a preset threshold updating strategy so as to update the values of the first threshold and the second threshold;
updating the value of the previous first parameter to the first parameter, and updating the identification value to a second preset value;
updating the initial amplitude value to a second parameter-sampling frequency/5-third parameter 3/4;
and outputting the first parameter as the R peak identification result.
4. The method for detecting the peak of the ECG data according to claim 3, wherein after determining whether the difference between the first parameter and the previous first parameter is less than a second predetermined sampling frequency, the method further comprises:
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 of the R peak identification result in the third signal based on the R peak backtracking search strategy includes:
reading a first historical R peak and a second historical R peak which are stored from a buffer area, and acquiring data positioned between the first historical R peak and the second historical R peak in the buffer area to form a first data set;
deleting the data with the sampling frequency less than the first preset sampling frequency in the first data set to obtain a second data set;
acquiring a maximum value in the second data set and a subscript corresponding to the maximum value;
outputting the maximum value in the second data set as an R peak identification result.
5. The ECG data peak detection method according to claim 3, wherein the updating the first threshold and the second threshold based on a preset threshold updating policy to update 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;
if the second parameter is greater than the first threshold, updating the value of the first threshold to be 0.6 of the middle value of the stored R peak of the buffer, and updating the value of the second threshold to be 0.4 of the middle value of the stored R peak of the buffer;
if the second parameter is less than or equal to the first threshold, judging whether the second parameter is greater than the second threshold and judging whether the second parameter is less 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 an absolute value of a middle value of a stored R peak in a buffer from the first threshold to update the first threshold, and updating a value of the second threshold to be 0.4 x of the middle value of the stored R peak in the 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, updating the value of the first threshold to a preset first minimum value, and updating the value of the second threshold to a preset second minimum value;
and saving the second parameter to the buffer area.
6. The method for detecting ECG data peaks as claimed in claim 3, wherein after determining whether the identification value is equal to the first predetermined value, the method further comprises:
if the identification value is not equal to the first preset value, judging whether the initial amplitude value is smaller than the second threshold value;
if the initial amplitude value is smaller than the second threshold, updating the value of the initial amplitude value to the second threshold;
if the initial amplitude value is larger than or equal to the second threshold, 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 lowest limit value or not;
if the second threshold value is smaller than the second minimum limit value, updating the value of the initial amplitude value to the second threshold value;
if the second threshold is greater than or equal to the second minimum limit value, determining whether the initial amplitude value is less than the preset second minimum limit value;
if the initial amplitude value is smaller than the preset second lowest limit value, updating the initial amplitude value to the preset second lowest limit value, and returning to execute 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 lowest limit value, returning to execute the step of acquiring the ith signal value in the third signal.
7. The method for detecting the peak of the electrocardiographic data of the ECG according to claim 1, wherein the removing the baseline shift of the electrocardiographic data to be detected to obtain the first signal comprises:
performing baseline drift removal on the electrocardiogram data to be detected based on an integer coefficient linear high-pass filter to obtain a first signal; the integral coefficient linear high-pass filter corresponds to the following formula:
Figure FDA0003939227890000041
y 3 (n)=m 1 *y 3 (n-L)-m 2 *y 3 (n-L*M)+x(n)-m 3 *x(n-K*L)+m 4 *x(n-K*L*M);
Figure FDA0003939227890000042
Figure FDA0003939227890000043
where x (n) is the input signal, y (n) is the output signal, f pm Is the 3db cut-off frequency point, h1 is the maximum fluctuation amplitude in the pass band, K, L, M are integers, m 1 、m 2 、m 3 And m 4 Are all preset parameter values, y 3 (n) represents an intermediate calculation value.
8. The method for detecting the peak of the ECG data of an ECG according to any of claims 1-7, wherein performing R-peak protrusion on the second signal to obtain a third signal comprises:
and acquiring the aroma concentration energy entropy of each signal in the second signal to perform R peak projection to obtain a third signal.
9. An ECG peak detection device, comprising:
the to-be-detected electrocardiogram data acquisition module is used for responding to the wave crest detection instruction and acquiring to-be-detected electrocardiogram data corresponding to the wave crest detection instruction; the electrocardiogram data to be detected comprises a sequence of a plurality of electrocardiogram value conversion numerical values which are arranged according to a time sequence;
the baseline drift removal module is used for removing baseline drift of the electrocardiogram data to be detected to obtain a first signal;
the T wave removing module is used for removing T waves of 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 double-threshold amplitude reduction to obtain an R peak identification result.
10. 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 for ECG peak detection of ECG data according to any one of claims 1 to 8 when executing the computer program.
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 true CN115886834A (en) 2023-04-04
CN115886834B 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 (14)

* 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
CN107233093A (en) * 2017-05-23 2017-10-10 安徽华米信息科技有限公司 Detection method, device and the electronic equipment of R ripples
CN107788969A (en) * 2017-09-29 2018-03-13 成都瑞迪康医疗科技有限公司 The automatic testing method of QRS complex in a kind of electrocardiosignal
CN108830255A (en) * 2018-06-29 2018-11-16 江苏师范大学 A kind of peak R recognition methods based on Wavelet Denoising Method electrocardiosignal
CN108888259A (en) * 2018-05-21 2018-11-27 南京大学 A kind of real-time QRS wave detection method of electrocardiosignal
KR20190019668A (en) * 2017-08-18 2019-02-27 가천대학교 산학협력단 An apparatus for detecting r-peak in electrocardiogram signal by using wavelet transform and modified shannon energy envelope and the method thereof
CN109820501A (en) * 2018-11-12 2019-05-31 浙江清华柔性电子技术研究院 A kind of recognition methods of R wave of electrocardiosignal, device, computer equipment
CN110680302A (en) * 2019-08-30 2020-01-14 西北大学 Automatic identification method for electrocardiosignal characteristic wave
KR20200024518A (en) * 2018-08-28 2020-03-09 한국과학기술연구원 Method for detecting r-peak of electrocardiogram in mobile environment and system for implementing the same
US20200229728A1 (en) * 2019-01-22 2020-07-23 Industry-Academic Cooperation Foundation Chosun University R wave detection method using periodicity of electrocardiogram signal
CN113100778A (en) * 2021-04-14 2021-07-13 福州大学 R peak positioning method of electrocardiosignal
US20210290095A1 (en) * 2020-03-23 2021-09-23 Jiangyu Kangjian Innovation Medical Technology(Chengdu) Co., Ltd Method for detecting qrs complex, electrocardiogram detection device and readable storage medium
CN114366121A (en) * 2022-01-18 2022-04-19 西安理工大学 Double-dynamic threshold electrocardio QRS wave detection method based on digital morphology
CN115120248A (en) * 2022-09-02 2022-09-30 之江实验室 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device

Patent Citations (14)

* 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
CN107233093A (en) * 2017-05-23 2017-10-10 安徽华米信息科技有限公司 Detection method, device and the electronic equipment of R ripples
KR20190019668A (en) * 2017-08-18 2019-02-27 가천대학교 산학협력단 An apparatus for detecting r-peak in electrocardiogram signal by using wavelet transform and modified shannon energy envelope and the method thereof
CN107788969A (en) * 2017-09-29 2018-03-13 成都瑞迪康医疗科技有限公司 The automatic testing method of QRS complex in a kind of electrocardiosignal
CN108888259A (en) * 2018-05-21 2018-11-27 南京大学 A kind of real-time QRS wave detection method of electrocardiosignal
CN108830255A (en) * 2018-06-29 2018-11-16 江苏师范大学 A kind of peak R recognition methods based on Wavelet Denoising Method electrocardiosignal
KR20200024518A (en) * 2018-08-28 2020-03-09 한국과학기술연구원 Method for detecting r-peak of electrocardiogram in mobile environment and system for implementing the same
CN109820501A (en) * 2018-11-12 2019-05-31 浙江清华柔性电子技术研究院 A kind of recognition methods of R wave of electrocardiosignal, device, computer equipment
US20200229728A1 (en) * 2019-01-22 2020-07-23 Industry-Academic Cooperation Foundation Chosun University R wave detection method using periodicity of electrocardiogram signal
CN110680302A (en) * 2019-08-30 2020-01-14 西北大学 Automatic identification method for electrocardiosignal characteristic wave
US20210290095A1 (en) * 2020-03-23 2021-09-23 Jiangyu Kangjian Innovation Medical Technology(Chengdu) Co., Ltd Method for detecting qrs complex, electrocardiogram detection device and readable storage medium
CN113100778A (en) * 2021-04-14 2021-07-13 福州大学 R peak positioning method of electrocardiosignal
CN114366121A (en) * 2022-01-18 2022-04-19 西安理工大学 Double-dynamic threshold electrocardio QRS wave detection method based on digital morphology
CN115120248A (en) * 2022-09-02 2022-09-30 之江实验室 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈耿铎, 曾有灵, 李喆: "自适应双阈值心电信号检测算法研究", 暨南大学学报, vol. 39, no. 3, 30 June 2018 (2018-06-30), pages 262 - 268 *

Also Published As

Publication number Publication date
CN115886834B (en) 2024-06-25

Similar Documents

Publication Publication Date Title
CN106659900B (en) Implantable medical device with autocorrelation device and with analysis device for estimating heart rate
JP4602354B2 (en) Cardiac monitoring
WO2012051320A2 (en) Motion and noise artifact detection for ecg data
CN109009073B (en) Atrial fibrillation detection apparatus and storage medium
Rahul et al. Dynamic thresholding based efficient QRS complex detection with low computational overhead
De Chazal Detection of supraventricular and ventricular ectopic beats using a single lead ECG
Al-Ani ECG waveform classification based on P-QRS-T wave recognition
CN109567780B (en) Beat-to-beat heart rate calculation method and device, electronic equipment and storage medium
CN109077721B (en) Atrial fibrillation detection apparatus and storage medium
Talatov et al. Algorithmic and software analysis and processing of ECG signals
CN113786202B (en) Electrocardiogram characteristic starting point and ending point detection method, system, device and medium
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
KR102470132B1 (en) Apparatus and method for detecting r peak of ecg signal using adaptive median filter
CN114788704A (en) QRS wave identification method, device, equipment and storage medium in electrocardiogram signal
CN114246569A (en) Method, apparatus and medium for detecting premature beat type
Marsili et al. Optimized algorithms for atrial fibrillation detection by wearable tele-holter devices
CN115886834B (en) ECG (electrocardiogram) data peak detection method and device and computer equipment
Yan et al. A resource-efficient, robust QRS detector using data compression and time-sharing architecture
CN112438735B (en) Electrocardiogram P wave detection method, analysis device and storage medium
CN110477904B (en) House flapping signal detection method and device
Vega-Martínez et al. Wavelet packet based algorithm for QRS region detection and R/S wave identification
CN110897627B (en) Electrocardiogram signal feature extraction method, device, equipment, system and storage medium
JP7163058B2 (en) ECG machine including filters for feature detection

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
GR01 Patent grant