CN115120248B - Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device - Google Patents

Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device Download PDF

Info

Publication number
CN115120248B
CN115120248B CN202211068196.9A CN202211068196A CN115120248B CN 115120248 B CN115120248 B CN 115120248B CN 202211068196 A CN202211068196 A CN 202211068196A CN 115120248 B CN115120248 B CN 115120248B
Authority
CN
China
Prior art keywords
peak
histogram
threshold
electrocardiosignal
electrocardiosignals
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211068196.9A
Other languages
Chinese (zh)
Other versions
CN115120248A (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.)
Zhejiang Lab
Original Assignee
Zhejiang Lab
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 Zhejiang Lab filed Critical Zhejiang Lab
Priority to CN202211068196.9A priority Critical patent/CN115120248B/en
Publication of CN115120248A publication Critical patent/CN115120248A/en
Application granted granted Critical
Publication of CN115120248B publication Critical patent/CN115120248B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/24Detecting, measuring or recording bioelectric or biomagnetic signals of the body or parts thereof
    • A61B5/316Modalities, i.e. specific diagnostic methods
    • A61B5/318Heart-related electrical modalities, e.g. electrocardiography [ECG]
    • A61B5/346Analysis of electrocardiograms
    • A61B5/349Detecting specific parameters of the electrocardiograph cycle
    • A61B5/352Detecting R peaks, e.g. for synchronising diagnostic apparatus; Estimating R-R interval
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/02Detecting, measuring or recording pulse, heart rate, blood pressure or blood flow; Combined pulse/heart-rate/blood pressure determination; Evaluating a cardiovascular condition not otherwise provided for, e.g. using combinations of techniques provided for in this group with electrocardiography or electroauscultation; Heart catheters for measuring blood pressure
    • A61B5/024Detecting, measuring or recording pulse rate or heart rate
    • A61B5/02405Determining heart rate variability
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/02Detecting, measuring or recording pulse, heart rate, blood pressure or blood flow; Combined pulse/heart-rate/blood pressure determination; Evaluating a cardiovascular condition not otherwise provided for, e.g. using combinations of techniques provided for in this group with electrocardiography or electroauscultation; Heart catheters for measuring blood pressure
    • A61B5/024Detecting, measuring or recording pulse rate or heart rate
    • A61B5/0245Detecting, measuring or recording pulse rate or heart rate by using sensing means generating electric signals, i.e. ECG signals
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/72Signal processing specially adapted for physiological signals or for diagnostic purposes
    • A61B5/7235Details of waveform analysis
    • A61B5/7253Details of waveform analysis characterised by using transforms
    • A61B5/726Details of waveform analysis characterised by using transforms using Wavelet transforms
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/72Signal processing specially adapted for physiological signals or for diagnostic purposes
    • A61B5/7235Details of waveform analysis
    • A61B5/7264Classification of physiological signals or data, e.g. using neural networks, statistical classifiers, expert systems or fuzzy systems
    • A61B5/7267Classification of physiological signals or data, e.g. using neural networks, statistical classifiers, expert systems or fuzzy systems involving training the classification device

Landscapes

  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Engineering & Computer Science (AREA)
  • Cardiology (AREA)
  • Physics & Mathematics (AREA)
  • Animal Behavior & Ethology (AREA)
  • Public Health (AREA)
  • Biomedical Technology (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Medical Informatics (AREA)
  • Molecular Biology (AREA)
  • Surgery (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Pathology (AREA)
  • Veterinary Medicine (AREA)
  • Physiology (AREA)
  • Artificial Intelligence (AREA)
  • Signal Processing (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Psychiatry (AREA)
  • Evolutionary Computation (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)

Abstract

The invention discloses a histogram-based adaptive threshold R peak detection and heart rhythm classification method and device, which are characterized in that the maximum value and the minimum value of electrocardiosignals are calculated, and if the absolute value of the minimum value is greater than the maximum value, the preprocessed electrocardiosignals are horizontally turned; extracting a maximum value of the electrocardiosignal as a candidate R peak; counting the histogram distribution of the R peak; determining the number range of R peaks according to the limit heart rate range of the human body and the duration of the electrocardiosignal, and intercepting a corresponding histogram range; determining a histogram segmentation threshold according to a maximum inter-class variance method so as to obtain an R peak threshold; taking the R peak above a threshold value; and determining an R peak interval threshold according to the human body limit heart rate range, and filtering the R peak smaller than the interval threshold to obtain a final R peak. Calculating time domain characteristics according to the R peak value, converting the time domain characteristics into frequency domain characteristics, and taking the time domain characteristics and the frequency domain characteristics as electrocardiosignal characteristic indexes; and inputting the electrocardiosignal characteristic indexes into the electrocardio recognition model to obtain a heart rhythm classification result.

Description

Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device
Technical Field
The invention relates to the field of digital signal processing, in particular to a histogram-based adaptive threshold R peak detection and heart rate classification method and device.
Background
At present, two schemes are mainly adopted for classifying the heart rhythm at home and abroad, one scheme is classification based on the waveform structure of an electrocardiosignal, and the specific methods comprise template matching, structure description and the like; the other is classification based on electrocardiosignal characteristics, which is subdivided into artificial characteristics and machine learning automatic characteristics, such as a Convolutional Neural Network (CNN). The method extracts significant features in the electrocardiosignals according to human experience and knowledge, and has good robustness; the latter automatically learns the features by data driving, generally with higher accuracy, but if the data volume is not large enough, overfitting is easy to occur, so that it is a more reliable scheme to adopt artificial features under the condition of insufficient data volume. Heart Rate Variability (HRV), which refers to small changes in successive cardiac cycles (R-R intervals) or small fluctuations in successive instantaneous heart rates, is the most common artificial feature. The accuracy of HRV depends on the accuracy of R peak detection, and common methods include a differential threshold method (Wu Jian, li kang, panyu, etc.. Based on an electrocardio R wave extraction algorithm [ J ] matched with a template, chongqing post electric university science edition, 2016, 27 (3): 372-376.), a Pan-Tompkins method (Pan J, tompkins W J. A real-time QRS detection algorithm [ J ]. IEEE transactions on biological engineering, 1985 (3): 230-236.), but the accuracy of heart rhythm classification is not high due to the fact that detection omission and error detection often occur on abnormal electrocardiosignals and universality is poor.
Disclosure of Invention
In order to solve the defects of the prior art and achieve the purpose of improving the accuracy and efficiency of heart rhythm classification, the invention adopts the following technical scheme:
a histogram-based adaptive threshold R peak detection method comprises the following steps:
step S401: calculating the maximum value and the minimum value of the preprocessed electrocardiosignals, and if the absolute value of the minimum value is greater than the maximum value, horizontally turning the preprocessed electrocardiosignals;
step S402: extracting the maximum values of all the preprocessed electrocardiosignals to be used as candidate R peaks;
step S403: counting the histogram distribution of the R peak; determining the number range of R peaks according to the limit heart rate range of the human body and the duration of the electrocardiosignal, and intercepting a corresponding histogram range; determining a histogram segmentation threshold according to a maximum inter-class variance method (OTSU) to obtain an R peak threshold;
step S404: taking the R peak higher than the threshold value;
step S405: and determining an R peak interval threshold according to the human body limit heart rate range, and filtering the R peak with the interval smaller than the interval threshold to obtain a final R peak.
Further, in the maximum inter-class variance method in step S403, the optimal threshold of the histogram is set as T, which divides the histogram into the foreground and the background, wherein the ratio of the number of foreground intervals is
Figure 100002_DEST_PATH_IMAGE002
Average distribution value of
Figure 100002_DEST_PATH_IMAGE004
(ii) a Background interval ratio of
Figure 100002_DEST_PATH_IMAGE006
Average distribution value of
Figure 100002_DEST_PATH_IMAGE008
(ii) a The average distribution value of the histogram is
Figure 100002_DEST_PATH_IMAGE010
The between-class variance is
Figure 100002_DEST_PATH_IMAGE012
The exhaustive T calculates all the inter-class variances, and the T which maximizes the variance is the segmentation threshold, namely the R peak threshold.
A heart rhythm classification method based on adaptive threshold R peak detection of a histogram comprises the following steps:
step S101: acquiring an electrocardiosignal of a person to be detected;
step S102: carrying out data preprocessing on the electrocardiosignals to obtain preprocessed electrocardiosignals;
step S103: extracting the preprocessed electrocardiosignal characteristic indexes, comprising the following steps:
step S301: detecting an R peak by the preprocessed electrocardiosignal by adopting the self-adaptive threshold R peak detection method based on the histogram;
step S302: calculating time domain characteristics according to the R peak value, converting the time domain characteristics into frequency domain characteristics, and taking the time domain characteristics and the frequency domain characteristics as electrocardiosignal characteristic indexes;
step S104: and inputting the characteristic indexes of the electrocardiosignals into an electrocardio recognition model to obtain a heart rhythm classification result.
Further, in step S302, the time domain features include a heart rate (number/duration of R peaks) and a heart rate variability HRV index, both of which are calculated by extracting the positions of the R peaks, wherein the heart rate variability HRV index includes the percentage of the number of R-R interval standard deviation of sinus heart beats and the number of adjacent NN differences >50ms to the total number of sinus heart beats.
Further, a Poincare diagram (poincare diagram) is used for evaluating the R-R interval, time domain features are extracted, the X axis of the Poincare diagram represents the duration of the current heart beat, the Y axis represents the duration of the next beat, scattered points on the XY axis approximate to elliptical distribution, an ellipse is fitted according to the scattered points, the standard deviation of the long axis of the ellipse represents short-term variability and generally reflects parasympathetic nerve activity, the standard deviation of the short axis represents long-term variability, the association degree of the sympathetic nerve activity is stronger than the parasympathetic nerve activity, and the standard deviation of the long axis of the ellipse, the standard deviation of the short axis and the area of the short axis of the ellipse are calculated and used as the features of the Poincare diagram.
Further, in step S302, time domain features are extracted using a difference scattergram, an X-axis of which represents a difference between a duration of a current cardiac beat and a duration of a previous cardiac beat, a Y-axis of which represents a difference between a duration of a next cardiac beat and a duration of a current cardiac beat, a + + of which represents a number of points in a first quadrant of the difference scattergram, represents an increase in two consecutive cardiac intervals, a decrease in heart rate, represents parasympathetic activity, and B — represents a number of points in a third quadrant, represents a decrease in two consecutive cardiac intervals, a increase in heart rate, represents sympathetic activity, and a + + and B — two features are calculated as features of the difference scattergram.
Further, in step S302, the time domain characteristic is converted into a frequency domain characteristic through fast fourier transform, and in the frequency domain characteristic, the low-frequency energy, the high-frequency energy, and a ratio of the two are calculated as the frequency domain characteristic of the electrocardiographic signal.
Further, the step S102 includes the following steps:
step S201: filtering out high-frequency signals in the electrocardiosignals through a low-pass filter;
step S202: filtering power frequency interference in the electrocardiosignals through a band elimination filter;
step S203: filtering baseline drift in the electrocardiosignals through a high-pass filter; until the noise outside the range of most electrocardio frequency is filtered, the noise with overlapped frequency ranges is left;
step S204: carrying out wavelet threshold denoising on the electrocardiosignal; firstly, decomposing the electrocardiosignal into different scales by using wavelet transformation, removing wavelet coefficients belonging to noise under each scale, reserving and enhancing the wavelet coefficients belonging to the electrocardiosignal, and finally restoring the electrocardiosignal by using wavelet inverse transformation; daubechies-4 (db 4) is used as a wavelet generation function with a threshold of
Figure DEST_PATH_IMAGE014
Step S205: the EMG noise is filtered through empirical mode decomposition; decomposing the electrocardiosignal into a plurality of eigenmode functions through empirical mode decomposition, wherein each eigenmode function comprises local characteristic information of the electrocardiosignal at different time scales, and deleting a group of high-frequency signals in the local characteristic information to obtain the preprocessed electrocardiosignal.
Further, in the step 104, a random forest is used to construct a rhythm classification model, where the random forest includes multiple decision trees, and when constructing a decision tree, a part of feature indexes are selected from the training data of the electrocardiograph signal feature indexes as samples and a part of sample features for training, because the samples and sample features used by each tree are different, the trained results are also different, for an input sample, N classification results are provided for N trees, the random forest integrates all rhythm classification voting results, and specifies the rhythm class with the highest voting frequency as the final output. Compared with a neural network method, the method has the advantages of less overfitting possibility, better interpretability and lower calculation cost due to the result of integrating a plurality of trees.
A histogram-based adaptive threshold Rpeak detection cardiac rhythm classification device comprising a memory having stored therein executable code and one or more processors that, when executing the executable code, perform the histogram-based adaptive threshold Rpeak detection cardiac rhythm classification method.
The invention has the advantages and beneficial effects that:
the adaptive threshold R peak detection and heart rhythm classification method and device based on the histogram improve the detection efficiency and the detection accuracy and have better adaptability, meanwhile, the heart rhythm classification is carried out on the electrocardiosignals by adopting the random forest, the overfitting is avoided, the interpretability is improved, the calculation cost is reduced, the heart rhythm classification accuracy is improved, and the F1 index on the public electrocardio data set PTB-XL is 82.4 percent and can be used as an auxiliary reference for electrocardiogram classification.
Drawings
Fig. 1 is a flow chart of a method of classifying a heart rhythm in an embodiment of the present invention.
FIG. 2 is a flow chart of the pre-processing of the cardiac signal according to an embodiment of the present invention.
FIG. 3 is a flowchart of the cardiac signal feature extraction in the embodiment of the present invention.
FIG. 4 is a flow chart of a histogram-based adaptive threshold R-peak detection method according to an embodiment of the present invention
FIG. 5 is a histogram of the distribution of the number of R peaks in an example of the present invention.
FIG. 6a shows the R peak detection effect of the difference threshold method on the first electrocardiogram according to the embodiment of the present invention.
FIG. 6b is a graph showing the effect of the Pan-Tompkin method on the detection of the R peak on the first electrocardiogram in the embodiment of the present invention.
FIG. 6c is a graph illustrating the R-peak detection effect of the histogram-based adaptive threshold R-peak detection method on the first electrocardiogram, in accordance with an embodiment of the present invention.
FIG. 6d shows the R-peak detection effect of the difference thresholding on the second electrocardiogram in the embodiment of the present invention.
FIG. 6e is a graph showing the effect of the Pan-Tompkin method on the detection of the R peak on the second electrocardiogram in accordance with the present invention.
FIG. 6f is a graph of the R peak detection effect of the histogram-based adaptive threshold R peak detection method on a second electrocardiogram, in accordance with an embodiment of the present invention.
FIG. 6g shows the R-peak detection effect of the difference threshold method on the third electrocardiogram in the embodiment of the present invention.
FIG. 6h is a graph showing the effect of the Pan-Tompkin method on the detection of the R peak on the third electrocardiogram in the embodiment of the present invention.
FIG. 6i is a graph showing the effect of histogram-based adaptive threshold R-peak detection on the R-peak of a third electrocardiogram in accordance with an embodiment of the present invention.
Figure 7a is a precision box plot of an ecg classification model in an embodiment of the present invention (5-fold cross validation).
FIG. 7b is a box chart of the recall ratio of the classification model of ECG in accordance with the embodiment of the present invention (cross validation, 5).
FIG. 7c is an index boxed graph of the classification model F1 of ECG in accordance with the embodiment of the present invention (5-fold cross validation).
FIG. 8 is a schematic diagram of the structure of the apparatus in the example of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
As shown in fig. 1, the heart rhythm classification method based on histogram adaptive threshold R peak detection includes the following steps:
step S101: acquiring an electrocardiosignal of a person to be detected;
step S102: carrying out data preprocessing on the electrocardiosignals to obtain preprocessed electrocardiosignals;
the frequency of normal electrocardiosignals is between 0.01Hz and 100Hz, and actually acquired electrocardiosignals are mainly interfered by three types of noise: as shown in fig. 2, the method for removing noise includes the following steps:
step S201: filtering out high-frequency signals in the electrocardiosignals through a low-pass filter;
in the embodiment of the invention, a Butterworth filter is used as the filter, which is the most commonly used filter and is characterized in that the frequency response curve of a passband is the smoothest, and a Butterworth low-pass filter is used for filtering high-frequency noise with the frequency of more than 100 Hz;
step S202: filtering power frequency interference in the electrocardiosignals through a band elimination filter;
in the embodiment of the invention, a Butterworth band elimination filter is used for filtering power frequency interference about 50 Hz;
step S203: filtering baseline drift in the electrocardiosignals through a high-pass filter;
in the embodiment of the invention, a Butterworth high-pass filter is used for filtering low-frequency noise lower than 0.25Hz, so that the problem of baseline drift is solved; so far, most of noises outside the electrocardio frequency range are filtered, and noises with overlapped frequency ranges are left;
step S204: carrying out wavelet threshold denoising on the electrocardiosignal; firstly, decomposing the electrocardiosignal into different scales by using wavelet transformation, removing wavelet coefficients belonging to noise under each scale, reserving and enhancing the wavelet coefficients belonging to the electrocardiosignal, and finally restoring the electrocardiosignal by using wavelet inverse transformation;
in the embodiment of the invention, daubechies-4 (db 4) is used as a wavelet generating function, and the threshold value is
Figure 352230DEST_PATH_IMAGE014
Step S205: the EMG noise is filtered through empirical mode decomposition; decomposing the electrocardiosignal into a plurality of eigenmode functions through empirical mode decomposition, wherein each eigenmode function comprises local characteristic information of the electrocardiosignal at different time scales, and deleting a group of high-frequency signals in the local characteristic information to obtain the preprocessed electrocardiosignal.
In the embodiment of the invention, the electrocardiosignal is decomposed into a finite number of eigenmode functions (IMFs) by using Empirical Mode Decomposition (EMD), each decomposed IMF component contains local characteristic information of the original signal at different time scales, the first two high-frequency signals are abandoned, most of the electromyographic noise can be filtered, and the preprocessed electrocardiosignal is obtained.
Step S103: extracting the preprocessed electrocardiosignal characteristic index, as shown in fig. 3, includes the following steps:
step S301: the R peak is detected by the preprocessed electrocardiosignal by adopting a histogram-based adaptive threshold R peak detection method, and as shown in figure 4, the method comprises the following steps:
step S401: calculating the maximum value and the minimum value of the preprocessed electrocardiosignals, and if the absolute value of the minimum value is greater than the maximum value, horizontally turning the preprocessed electrocardiosignals;
step S402: extracting the maximum values of all the preprocessed electrocardiosignals to be used as candidate R peaks;
step S403: counting the histogram distribution of the R peak; determining the number range of R peaks according to the limit heart rate range of the human body and the duration of the electrocardiosignal, and intercepting a corresponding histogram range; determining a histogram segmentation threshold according to a maximum inter-class variance method (OTSU) to obtain an R peak threshold; as shown in fig. 5, the vertical axis represents frequency (the number of R peaks falling in the current interval in the histogram), the horizontal axis represents the number of R peaks, the number range of R peaks is determined according to the human body limit heart rate range and the electrocardiographic signal duration between two solid lines, and the broken line is a segmentation threshold determined according to the maximum inter-class variance method;
the maximum inter-class variance method is generally used for determining an image binarization segmentation threshold, the algorithm assumes that an image can distinguish a background and a foreground according to a global threshold, calculates the variance of background and foreground gray values respectively, and solves the threshold which maximizes the variance, which is essentially histogram threshold segmentation. In the embodiment of the invention, the straight line is arrangedThe optimal threshold for the histogram is T, which divides the histogram into foreground and background, where the ratio of the number of foreground bins (bins) is
Figure 862846DEST_PATH_IMAGE002
Average distribution value of
Figure 111425DEST_PATH_IMAGE004
(ii) a The background bin ratio is
Figure 349377DEST_PATH_IMAGE006
Average distribution value of
Figure 632591DEST_PATH_IMAGE008
(ii) a The average distribution value of the histogram is
Figure 251791DEST_PATH_IMAGE010
Between classes variance of
Figure 863032DEST_PATH_IMAGE012
Exhaustive T calculates all inter-class variances, and the T with the largest variance is the segmentation threshold, namely the R peak threshold;
step S404: taking the R peak above a threshold value;
step S405: and determining an R peak interval threshold according to the human body limit heart rate range, and filtering the R peak with the interval smaller than the interval threshold to obtain a final R peak.
Fig. 6a to 6i, wherein the ordinate ecg (electrocardiogram) represents the voltage value (mV) of the electrocardiographic signal, and the abscissa represents the time(s), respectively, the difference threshold method, the Pan-Tompkins (the adaptive dual-threshold QRS wave detection algorithm proposed for the first time by Pan and Tompkins, etc.) method and the histogram-based adaptive threshold R peak detection of the present invention are used to compare the detection effects on three electrocardiograms with significantly different electrocardiographic characteristics, wherein "R" is the R peak. In the three comparison graphs, the Pan-Tompkins method has more error detection, and the detection of other two algorithms is error-free; in the middle three comparison graphs, a difference threshold method has a plurality of missed detections, and a Pan-Tompkins method has an R peak of the missed detections; in the following three comparison graphs, the differential threshold method has many false detections, and the other two algorithms have no false detections.
Table 1 shows the run time comparison of the three algorithms, averaged in 77136 records, with the fastest visible differential thresholding method, followed by the adaptive thresholding method based on histogram statistics, with comparable efficiency, the slowest being the Pan-Tompkins method, with an order of magnitude difference.
TABLE 1 average run time comparison table of three R peak detection algorithms
Algorithm Differential threshold method Pan-Tompkins method Self-adaptive threshold method based on histogram statistics
Mean run time (ms) 5.73 106.62 6.84
Step S302: calculating time domain characteristics according to the R peak value, converting the time domain characteristics into frequency domain characteristics, and taking the time domain characteristics and the frequency domain characteristics as electrocardiosignal characteristic indexes;
the time domain features comprise heart rate (R peak number/duration) and HRV (heart rate variability) indexes, and the positions of the R peaks need to be extracted in the calculation of the heart rate and the HRV indexes;
wherein the HRV index comprises the percentage of the number of standard deviation of R-R interval of sinus heart beats and the difference between adjacent NNs which is larger than 50ms in the total number of sinus heart beats.
Evaluating the R-R interval by using a Poincare graph (poincare graph), wherein the X axis of the Poincare graph represents the duration of the current heart beat, the Y axis represents the duration of the next beat, scattered points on the XY axis approximate to elliptical distribution, an ellipse is fitted according to the scattered points, the standard deviation of the long axis of the ellipse represents short-term variability and generally reflects parasympathetic nerve activity, the standard deviation of the short axis represents long-term variability, the association degree of the standard deviation of the long axis of the ellipse and the sympathetic nerve activity is stronger than that of the parasympathetic nerve activity, and the standard deviation of the long axis of the ellipse, the standard deviation of the short axis and the area of the ellipse are calculated and used as the characteristics of the Poincare graph;
an X-axis of the difference scattergram represents a difference between a duration of a current cardiac beat and a duration of a previous cardiac beat, a Y-axis represents a difference between a duration of a next cardiac beat and a duration of a current cardiac beat, a + + represents the number of points in a first quadrant of the difference scattergram, represents an increase in two consecutive cardiac intervals, a decrease in heart rate, represents parasympathetic activity, and B-represents the number of points in a third quadrant, represents a decrease in two consecutive cardiac intervals, a increase in heart rate, represents sympathetic activity, and calculates a + + and B-two characteristics as characteristics of the difference scattergram;
and converting the time domain characteristic into a frequency domain characteristic through fast Fourier transform, and calculating low-frequency energy, high-frequency energy and the ratio of the low-frequency energy and the high-frequency energy as the frequency domain characteristic of the electrocardiosignal under the frequency domain characteristic.
Step S104: inputting the characteristic indexes of the electrocardiosignals into an electrocardio recognition model to obtain a heart rhythm classification result;
a random forest method is adopted to construct a rhythm classification model, the random forest comprises a plurality of decision trees, when the decision trees are constructed, a part of characteristic indexes are selected from electrocardiosignal characteristic index training data in a returned random mode to serve as samples and a part of sample characteristics to be trained, because the samples and the sample characteristics used by each tree are different, the trained results are different, N classification results exist for one input sample and N trees, the random forest integrates all rhythm classification voting results, and the rhythm class with the largest voting times is designated as final output. Compared with a neural network method, the method has the advantages of less overfitting possibility, better interpretability and lower calculation cost due to the result of integrating a plurality of trees.
In the embodiment of the invention, a subset of a large electrocardiogram data base PTB-XL which is disclosed on the internet is used for training the model. This subset contains 6428 clinical 12-lead ECG recordings with classification labels: normal heart rhythm, sinus rhythm, and other arrhythmias, with data rates of 31.9%, 24.3%, and 43.6%, respectively. And respectively denoising and extracting features of each recorded lead signal, splicing the features of the 12 leads into a one-dimensional vector, and inputting the one-dimensional vector into a random forest. Setting parameters: the number of the classifiers is 1000, the maximum characteristic number is 12, the maximum depth is not limited, the maximum leaf node number is not limited, bootstrap sampling is adopted, and the evaluation standard is the Gini index. Model accuracy, recall rate and F1 index were calculated using 5-fold cross validation (data was randomly split into 5 equal parts, 4 of which were taken as training sets each time, and the rest were taken as test sets and repeated 5 times), and the results are shown in fig. 7a to 7c and table 2, with an average accuracy of 82.6%, a recall rate of 82.2% and an F1 index of 82.4%.
The model classification effects of other R peak detection algorithms are compared as follows, the adaptive threshold method based on histogram statistics is superior to a differential threshold method and a Pan-Tompkins method in model precision, recall ratio and F1 indexes, all indexes are over 80%, and reference basis can be provided for heart rhythm classification.
TABLE 2 comparison of three R peak detection algorithm models
Algorithm Differential threshold method Pan-Tompkins method The invention relates to a method for classifying heart rhythms
Average accuracy 60.54% 80.20% 82.6%
Average recall rate 55.18% 80.23% 82.2%
Average F1 index 54.07% 80.19% 82.4%
Corresponding to the foregoing embodiments of the method for classifying a heart rhythm based on histogram-based adaptive threshold R-peak detection, the present invention also provides embodiments of a device for classifying a heart rhythm based on histogram-based adaptive threshold R-peak detection.
Referring to fig. 8, the apparatus for classifying a heart rhythm based on histogram adaptive threshold R peak detection according to the embodiment of the present invention includes a memory and one or more processors, where the memory stores executable codes, and the one or more processors execute the executable codes to implement the method for classifying a heart rhythm based on histogram adaptive threshold R peak detection according to the above embodiment.
Embodiments of the histogram-based adaptive threshold R-peak detection-based cardiac rhythm classification apparatus of the present invention may be applied to any data processing-capable device, such as a computer or other like device or apparatus. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for running through the processor of any device with data processing capability. In terms of hardware, as shown in fig. 8, a hardware structure diagram of any device with data processing capability where the apparatus for classifying a heart rhythm based on adaptive threshold R peak detection of a histogram of the present invention is located is shown, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 8, any device with data processing capability where the apparatus is located in the embodiment may generally include other hardware according to the actual function of the any device with data processing capability, which is not described again.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and 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 modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
Embodiments of the present invention also provide a computer-readable storage medium, on which a program is stored, which, when executed by a processor, implements the method for classifying a heart rhythm based on histogram-based adaptive threshold R-peak detection in the above-described embodiments.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any data processing capability device described in any of the foregoing embodiments. The computer readable storage medium may also be any external storage device of a device with data processing capabilities, such as a plug-in hard disk, a Smart Media Card (SMC), an SD Card, a Flash memory Card (Flash Card), etc. provided on the device. Further, the computer readable storage medium may include both internal storage units and external storage devices of any data processing capable device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing-capable device, and may also be used for temporarily storing data that has been output or is to be output.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and these modifications or substitutions do not depart from the scope of the embodiments of the present invention in nature.

Claims (9)

1. A histogram-based adaptive threshold R peak detection method is characterized by comprising the following steps:
step S401: calculating the maximum value and the minimum value of the preprocessed electrocardiosignals, and if the absolute value of the minimum value is greater than the maximum value, horizontally turning the preprocessed electrocardiosignals;
step S402: extracting the maximum values of all the preprocessed electrocardiosignals to be used as candidate R peaks;
step S403: counting the histogram distribution of the R peak; determining the number range of R peaks according to the limit heart rate range of the human body and the duration of the electrocardiosignal, and intercepting a corresponding histogram range; determining a histogram segmentation threshold according to a maximum inter-class variance method so as to obtain an R peak threshold; the maximum inter-class variance method is characterized in that the optimal threshold value of the histogram is set as T, the histogram is divided into a foreground and a background by the T, and the ratio of the number of foreground intervals to the number of background intervals is
Figure DEST_PATH_IMAGE002
Average distribution value of
Figure DEST_PATH_IMAGE004
(ii) a Background interval ratio of
Figure DEST_PATH_IMAGE006
Average distribution value of
Figure DEST_PATH_IMAGE008
(ii) a The average distribution value of the histogram is
Figure DEST_PATH_IMAGE010
Between classes variance of
Figure DEST_PATH_IMAGE012
Calculating all inter-class variances by exhaustive T, wherein the T with the maximum variance is a segmentation threshold, namely an R peak threshold;
step S404: taking the R peak above a threshold value;
step S405: and determining an R peak interval threshold according to the human body limit heart rate range, and filtering the R peak with the interval smaller than the interval threshold to obtain a final R peak.
2. A heart rhythm classification method based on histogram adaptive threshold R peak detection is characterized by comprising the following steps:
step S101: acquiring an electrocardiosignal of a person to be detected;
step S102: carrying out data preprocessing on the electrocardiosignals to obtain preprocessed electrocardiosignals;
step S103: the method for extracting the preprocessed electrocardiosignal characteristic indexes comprises the following steps:
step S301: detecting an R peak by the preprocessed electrocardiosignals by adopting the histogram-based adaptive threshold R peak detection method of claim 1;
step S302: calculating time domain characteristics according to the R peak value, converting the time domain characteristics into frequency domain characteristics, and taking the time domain characteristics and the frequency domain characteristics as electrocardiosignal characteristic indexes;
step S104: and inputting the characteristic indexes of the electrocardiosignals into an electrocardio recognition model to obtain a heart rhythm classification result.
3. The histogram based adaptive threshold R-peak detection cardiac rhythm classification method according to claim 2, characterized in that: in step S302, the time-domain features include a heart rate and a heart rate variability index, and both calculations require extracting the position of the R peak, where the heart rate variability index includes the percentage of the number of sinus heart beat R-R interval standard deviations and the number of adjacent NN differences >50ms to the total number of sinus heart beats.
4. The histogram-based adaptive threshold R-peak detection cardiac rhythm classification method of claim 3, wherein: evaluating the R-R interval by using a Poincare diagram, extracting time domain characteristics, wherein the X axis of the Poincare diagram represents the duration of the current heart beat, the Y axis represents the duration of the next beat, scattered points on the XY axis approximate to elliptical distribution, fitting an ellipse according to the scattered points, the standard deviation of the long axis of the ellipse represents short-term variability, the standard deviation of the short axis represents long-term variability, and calculating the standard deviation of the long axis of the ellipse, the standard deviation of the short axis and the area of the short axis to serve as the characteristics of the Poincare diagram.
5. The histogram based adaptive threshold R-peak detection cardiac rhythm classification method according to claim 2, characterized in that: in step S302, time domain features are extracted using a difference scattergram, an X axis of the difference scattergram represents a difference between a duration of a current cardiac beat and a duration of a previous cardiac beat, a Y axis represents a difference between a duration of a next cardiac beat and a duration of a current cardiac beat, a + + represents the number of points in a first quadrant of the difference scattergram, represents an increase in two consecutive cardiac intervals, a decrease in heart rate, represents parasympathetic activity, and B — represents the number of points in a third quadrant, represents a decrease in two consecutive cardiac intervals, an increase in heart rate, represents sympathetic activity, and a + + and B — two features are calculated as features of the difference scattergram.
6. The histogram-based adaptive threshold R-peak detection cardiac rhythm classification method of claim 2, wherein: in step S302, the time domain characteristic is converted into a frequency domain characteristic by fast fourier transform, and under the frequency domain characteristic, the low frequency energy, the high frequency energy, and a ratio of the two are calculated as the frequency domain characteristic of the electrocardiographic signal.
7. The histogram based adaptive threshold R-peak detection cardiac rhythm classification method according to claim 2, characterized in that: the step S102 includes the steps of:
step S201: filtering out high-frequency signals in the electrocardiosignals through a low-pass filter;
step S202: filtering power frequency interference in the electrocardiosignals through a band elimination filter;
step S203: filtering baseline drift in the electrocardiosignals through a high-pass filter;
step S204: carrying out wavelet threshold denoising on the electrocardiosignal; firstly, decomposing the electrocardiosignal into different scales by using wavelet transformation, removing wavelet coefficients belonging to noise under each scale, reserving and enhancing the wavelet coefficients belonging to the electrocardiosignal, and finally restoring the electrocardiosignal by using wavelet inverse transformation;
step S205: the EMG noise is filtered through empirical mode decomposition; decomposing the electrocardiosignal into a plurality of eigen-mode functions through empirical mode decomposition, wherein each eigen-mode function comprises local characteristic information of the electrocardiosignal at different time scales, and deleting a group of high-frequency signals in the local characteristic information to obtain the preprocessed electrocardiosignal.
8. The histogram based adaptive threshold R-peak detection cardiac rhythm classification method according to claim 2, characterized in that: in the step S104, a random forest method is used to construct a rhythm classification model, where the random forest includes multiple decision trees, and when a decision tree is constructed, a part of feature indexes are selected from electrocardiographic signal feature index training data as samples and a part of sample features for training, and since the samples and sample features used by each tree are different, the trained results are also different, for an input sample, N classification results are provided for N trees, the random forest integrates all rhythm classification voting results, and designates the rhythm class with the highest voting frequency as the final output.
9. A histogram based adaptive threshold R-peak detection heart rhythm classification apparatus comprising a memory having stored therein executable code and one or more processors that, when executing the executable code, perform a method of classifying heart rhythms for histogram based adaptive threshold R-peak detection as recited in any one of claims 2-8.
CN202211068196.9A 2022-09-02 2022-09-02 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device Active CN115120248B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211068196.9A CN115120248B (en) 2022-09-02 2022-09-02 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211068196.9A CN115120248B (en) 2022-09-02 2022-09-02 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device

Publications (2)

Publication Number Publication Date
CN115120248A CN115120248A (en) 2022-09-30
CN115120248B true CN115120248B (en) 2022-12-20

Family

ID=83387499

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211068196.9A Active CN115120248B (en) 2022-09-02 2022-09-02 Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device

Country Status (1)

Country Link
CN (1) CN115120248B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116746900A (en) * 2022-10-19 2023-09-15 荣耀终端有限公司 Arrhythmia identification method and wearable device
CN117271977A (en) * 2023-09-27 2023-12-22 北京津发科技股份有限公司 HRV data preprocessing method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060119472A (en) * 2005-05-20 2006-11-24 건양대학교산학협력단 Method for removing baseline wander of electrocardiogram signal
KR20080069392A (en) * 2007-01-23 2008-07-28 건양대학교산학협력단 The method for detecting r peak of an electrocardiogram signal
CN101856225A (en) * 2010-06-30 2010-10-13 重庆大学 Method for detecting R wave crest of electrocardiosignal
CN108814591A (en) * 2018-03-23 2018-11-16 南京大学 A kind of detection method and its ecg analysis method of Electrocardiograph QRS Wave group width
CN113499080A (en) * 2021-06-08 2021-10-15 深圳邦健生物医疗设备股份有限公司 R wave detection method, device, equipment and medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101828918B (en) * 2010-05-12 2011-09-21 重庆大学 Electrocardiosignal R peak detection method based on waveform characteristic matching
CN105997054B (en) * 2016-06-22 2019-07-09 天津理工大学 A kind of method of electrocardiosignal preanalysis
US20210369176A1 (en) * 2020-06-02 2021-12-02 Pacesetter, Inc. Methods, devices and systems for identifying false r-r intervals and false arrhythmia detections due to r-wave undersensing or intermittent av conduction block

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060119472A (en) * 2005-05-20 2006-11-24 건양대학교산학협력단 Method for removing baseline wander of electrocardiogram signal
KR20080069392A (en) * 2007-01-23 2008-07-28 건양대학교산학협력단 The method for detecting r peak of an electrocardiogram signal
CN101856225A (en) * 2010-06-30 2010-10-13 重庆大学 Method for detecting R wave crest of electrocardiosignal
CN108814591A (en) * 2018-03-23 2018-11-16 南京大学 A kind of detection method and its ecg analysis method of Electrocardiograph QRS Wave group width
CN113499080A (en) * 2021-06-08 2021-10-15 深圳邦健生物医疗设备股份有限公司 R wave detection method, device, equipment and medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Detection and identification of ECG waves by histogram approach;B. Halder et al.;《2016 2nd International Conference on Control, Instrumentation, Energy & Communication (CIEC)》;20160718;全文 *
基于频数直方图检测QRS波的新方法;涂承媛等;《生物医学工程学杂志》;20030625(第02期);全文 *

Also Published As

Publication number Publication date
CN115120248A (en) 2022-09-30

Similar Documents

Publication Publication Date Title
CN115120248B (en) Histogram-based adaptive threshold R peak detection and heart rhythm classification method and device
Faezipour et al. A patient-adaptive profiling scheme for ECG beat classification
Gupta et al. Efficient R-peak detection in electrocardiogram signal based on features extracted using Hilbert transform and Burg method
CN109758145B (en) Automatic sleep staging method based on electroencephalogram causal relationship
Zhang et al. ECG signal classification with deep learning for heart disease identification
JP2021503309A (en) Noise detection method and equipment
CN115486855B (en) Electrocardiogram and heart beat classification method based on QRS complex indefinite cycle superposition
CN113057648A (en) ECG signal classification method based on composite LSTM structure
Xie et al. Intelligent analysis of premature ventricular contraction based on features and random forest
Shen et al. Atrial fibrillation detection algorithm based on manual extraction features and automatic extraction features
CN113974653B (en) Method and device for detecting optimized spike based on about log index, storage medium and terminal
Liu et al. A novel P-QRS-T wave localization method in ECG signals based on hybrid neural networks
CN115969398B (en) Blink detection method and device
Shantha Selva Kumari et al. Classification of cardiac arrhythmias based on morphological and rhythmic features
Ghosal et al. Ecg beat quality assessment using self organizing map
Zhou et al. Embedded real-time QRS detection algorithm for pervasive cardiac care system
Zavantis et al. Robust automatic detection of P wave and T wave in electrocardiogram
Rodrigues et al. The issue of automatic classification of heartbeats
Mondal et al. Fast CNN Based Electrocardiogram Signal Quality Assessment Using Fourier Magnitude Spectrum for Resource-Constrained ECG Diagnosis Devices
CN108836312B (en) Clutter rejection method and system based on artificial intelligence
Kammath et al. Detection of bundle branch blocks using machine learning techniques
Jokić et al. An efficient approach for heartbeat classification
CN115067967A (en) Heart beat signal reference point determining method, heart beat type identifying method and device
CN112446307A (en) Local constraint-based non-negative matrix factorization electrocardiogram identity recognition method and system
Kurniawan et al. QVAT: QRS complex detection based on variance analysis and adaptive threshold for electrocardiogram signal

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