Electrocardiosignal quality discrimination method, system, terminal and medium
By preprocessing and feature extraction of electrocardiogram (ECG) signals, combined with signal quality classification models and mapping scores, the problems of inaccurate ECG signal quality assessment and high computational resource consumption are solved, achieving real-time and accurate signal quality discrimination.
Patent Information
- Application Number
- CN202310211963.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-03
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2043-03-03
AI Technical Summary
Existing technologies suffer from inaccurate electrical signal quality assessment, high computational resource consumption, poor real-time performance, limited adaptability to various scenarios, and the signals acquired by dry electrodes are susceptible to baseline drift, resulting in a large number of invalid signals.
By preprocessing the electrocardiogram (ECG) signal to remove power frequency interference and baseline, feature data of a set length is extracted. Feature data analysis is performed using a signal quality classification model. Signal quality scoring is performed using semi-supervised learning and tree classification models, and mapping scoring is performed by combining the sigmoid function or multi-fold linear function.
It reduces algorithm complexity, saves computation time, improves the real-time performance and accuracy of signal recognition, adapts to more scenarios and devices, and meets the signal quality threshold judgment requirements of different applications.
Smart Images

Figure CN116327215B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrical signal processing, and in particular to a method, system, terminal, and medium for judging the quality of electrocardiogram (ECG) signals. Background Technology
[0002] An electrocardiogram (ECG) is a technique that uses an electrocardiograph to record the electrical activity changes of the heart during each cardiac cycle from the body surface. The myocardial cell membrane is a semi-permeable membrane. In the resting state, a certain number of positively charged cations are arranged outside the membrane, and an equal number of negatively charged anions are arranged inside. The external membrane potential is higher than the internal membrane potential, a state known as polarization. In the resting state, because myocardial cells in all parts of the heart are in a polarized state, there is no potential difference, and the potential curve recorded by the current recorder is flat, which is the isoelectric line on a surface ECG. When myocardial cells are stimulated to a certain intensity, the permeability of the cell membrane changes, and a large number of cations rush into the membrane in a short time, causing the membrane potential to change from negative to positive. This process is called depolarization. For the entire heart, the potential changes during the sequential depolarization process of myocardial cells from the endocardium to the epicardium, recorded by the current recorder, are called depolarization waves, namely the P wave in the atria and the QRS complex in the ventricles (a wave group on an ECG) on a surface ECG. After cell depolarization, the cell membrane releases a large number of cations, causing the membrane potential to change from positive to negative, restoring the original polarized state. This process occurs from the epicardium to the endocardium and is called repolarization. Similarly, the potential changes during the repolarization process of myocardial cells are recorded by an electrocardiogram and are called repolarization waves. Because the repolarization process is relatively slow, the repolarization wave is lower than the depolarization wave. The atrial repolarization wave is low and embedded in the ventricular depolarization wave, making it difficult to identify on a surface electrocardiogram. The ventricular repolarization wave appears as a T wave on a surface electrocardiogram. After all the myocardial cells have repolarized and returned to their polarized state, there is no potential difference between myocardial cells in different parts, and isoelectric lines are recorded on a surface electrocardiogram.
[0003] Ideally, each waveform on an electrocardiogram (ECG) contains a wealth of physiological information. Each waveform consists of a P wave, a T wave, and a QRS complex. Analyzing this physiological information can aid in disease treatment. By using advanced machine learning techniques, combining and analyzing data characteristics, a machine can generate a preliminary diagnostic result, which, in conjunction with the opinions of outpatient doctors, can significantly reduce the workload of doctors and greatly improve the efficiency of disease diagnosis.
[0004] With the development of smart healthcare and wearable devices, the public's awareness of their physical condition has significantly increased. It is essential to be able to conveniently and quickly monitor and assess one's health anytime, anywhere. However, to enable this on-the-spot data collection, current wearable devices generally use dry electrodes. Compared to dry electrodes, wet electrodes provide more stable signals and a higher signal-to-noise ratio, but they are only suitable for single-use data collection because conductive gel needs to be applied after each collection. The advantage of dry electrodes is their ability to collect signals anytime, anywhere, but the signal strength is correspondingly slightly lower than that of wet electrodes.
[0005] Dry electrode data acquisition is susceptible to interference from many factors. Noise can be categorized into three main types: 1. Static noise, specifically interference from the electronic components themselves, such as oxidation of the measuring electrode material. 2. Non-static noise caused by movement, such as breathing or exercise. 3. Power frequency interference, specifically interference caused by the power system. The frequency is generally 50Hz or 60Hz, depending on the AC power frequency. It mainly manifests as a sine wave or the superposition of other signals with a sine wave during signal measurement. Physiological information in a signal with a very low signal-to-noise ratio or a signal completely submerged in noise will be severely damaged. Therefore, results obtained from such signals are inaccurate or unacceptable, not only failing to aid diagnosis but also providing incorrect information. Therefore, assessing the signal quality of ECG signals is essential to reduce misdiagnosis using ECG signals for diagnosis and treatment.
[0006] Several methods and techniques have been proposed for assessing the quality of electrocardiogram (ECG) signals to improve the reliability of the final results. A common method involves first performing an S-transform on the signal to obtain a time-frequency plot, then using a deep learning network (CNN) or its variants for deep feature extraction and signal quality assessment. This method uses deep learning, which consumes significant computational resources and has high hardware requirements. Some existing technologies combine the calculation of a two-dimensional time-frequency plot of the ECG signal with convolutional neural networks for feature extraction, achieving good results. This requires complex time-frequency conversion, significant computation time and resources, and high hardware requirements. The feature extraction by convolutional neural networks is relatively abstract, making it difficult to explain the specific functions of these features. Another existing technology calculates the slope of the signal baseline and compares it with a slope threshold to determine signal quality. However, this method has a drawback: when applied to wearable devices, baseline drift is common in dry electrode ECG signals, leading to a large number of invalid ECG signals acquired by wearable devices. Furthermore, many hard threshold judgments were used on the data, such as slope threshold and RR interval threshold. The judgment criteria were not rich enough, and it was impossible to fully extract useful information from the signal, making the signal quality assessment results inaccurate and unscientific.
[0007] In summary, current technologies suffer from inaccurate ECG signal quality assessment results and failure to provide quantitative assessments. They also have drawbacks such as excessive memory usage and computation time, poor real-time performance, and limited applicability to various scenarios. Summary of the Invention
[0008] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method, system, terminal and medium for judging the quality of electrocardiogram signals, so as to solve the above-mentioned problems of the prior art.
[0009] To achieve the above and other related objectives, the present invention provides a method for judging the quality of electrocardiogram (ECG) signals. The method includes: preprocessing the acquired ECG signals to remove power frequency interference and baseline; performing feature extraction processing on data of a predetermined length extracted from the preprocessed ECG signals to obtain corresponding feature data; obtaining a quality classification result corresponding to a quality category based on the input feature data according to a constructed signal quality classification model; and performing score mapping on the quality classification result to obtain a signal quality score corresponding to the ECG signal for judging the quality of the ECG signal.
[0010] In one embodiment of the present invention, the construction method of the signal quality classification model includes: preprocessing each electrocardiogram (ECG) signal in the dataset that is labeled with a quality classification result to remove power frequency interference and baseline in the ECG signal; performing feature extraction processing on data of a set length extracted from each preprocessed ECG signal to obtain corresponding feature data; training a classification model based on the feature data of each ECG signal and the quality classification result label to obtain the signal quality classification model, which is used to input the feature data of the ECG signal and output the quality classification result corresponding to a quality category; wherein, the quality classification result includes: probability values of a first signal quality category, probability values of a second signal quality category, and probability values of a third signal quality category; the signal quality of the second signal quality category is worse than the signal quality of the first signal quality category but better than the signal quality of the third signal quality category; wherein, the type of the quality classification result label includes: a quality classification result label corresponding to the first signal quality category, a quality classification result label corresponding to the second signal quality category, and a quality classification result label corresponding to the third signal quality category.
[0011] In one embodiment of the present invention, the feature extraction process includes: normalizing data of a predetermined length extracted from the preprocessed electrocardiogram signal, and performing waveform and statistical feature calculations on the normalized data to obtain corresponding feature data; wherein, the feature data includes: signal skewness, kurtosis, standard deviation, mean, root mean square, mean absolute error, mean absolute value, impulse factor, coefficient of variation, waveform factor, signal length, peak-to-valley value, peak factor, number of small peaks, upper outlier, and lower outlier.
[0012] In one embodiment of the present invention, a network model trained using a semi-supervised learning algorithm and multiple electrocardiogram (ECG) signals labeled with quality classification results is used to determine the quality classification result labels that need to be labeled for ECG signals of difficult-to-distinguish categories in the dataset.
[0013] In one embodiment of the present invention, the step of performing a score mapping on the quality classification result to obtain a signal quality score corresponding to the electrocardiogram signal includes: calculating a signal quality score within the score interval of the corresponding quality category based on the mapping function corresponding to the determined quality category and the calculated value obtained from the probability values of the other two categories in the quality classification result besides the determined quality category.
[0014] In one embodiment of the present invention, the mapping function is a combination of a sigmoid function or a multi-fold linear function approximating a sigmoid function; wherein, the sigmoid function includes: Furthermore, α, β, and b are sigmoid parameters, x is the calculated input obtained from the probability values of the other two categories, and y is the mapped output value of the sigmoid function; the linear function includes: y score =k×x score +c; where k and c are the slope and intercept of the linear function, x is the output value of the sigmoid function, and y is the signal quality score.
[0015] In one embodiment of the present invention, the method further includes: after obtaining the corresponding feature data, performing an initial judgment on the feature data; if the judgment fails, directly determining it as a poor signal quality category and setting the signal quality score to zero; if the judgment passes, inputting the corresponding feature data into the corresponding signal quality classification model.
[0016] In one embodiment of the present invention, the set length is within the time range of 1.5S to 5S.
[0017] In one embodiment of the present invention, the signal quality classification model adopts a tree classification model with hyperparameter constraints.
[0018] To achieve the above and other related objectives, this invention provides an electrocardiogram (ECG) signal quality discrimination system. The system includes: a preprocessing module for preprocessing the acquired ECG signal to remove power frequency interference and baseline; a feature extraction module connected to the preprocessing module for extracting features from a predetermined length of data extracted from the preprocessed ECG signal to obtain corresponding feature data; a signal quality classification module connected to the feature extraction module for obtaining a quality classification result corresponding to a quality category based on the input feature data and a scoring module connected to the signal quality classification module for performing a score mapping on the quality classification result to obtain a signal quality score corresponding to the ECG signal, for use in judging the quality of the ECG signal.
[0019] To achieve the above and other related objectives, the present invention provides an electrocardiogram (ECG) signal quality discrimination terminal, comprising: one or more memories and one or more processors; the one or more memories are used to store a computer program; the one or more processors are connected to the memories and are used to run the computer program to execute the ECG signal quality discrimination method.
[0020] To achieve the above and other related objectives, the present invention provides a computer-readable storage medium storing a computer program, which is executed by one or more processors to perform the electrocardiogram signal quality discrimination method.
[0021] As described above, this invention provides a method, system, terminal, and medium for judging the quality of electrocardiogram (ECG) signals, which has the following beneficial effects: This invention preprocesses the acquired ECG signals to remove power frequency interference and baseline, and extracts features from a predetermined length of data extracted from the preprocessed ECG signals. The feature data is then input into a signal quality classification model to obtain the corresponding quality classification result. A score mapping is then performed to obtain the signal quality score for the corresponding ECG signal, which is used for subsequent quality judgment of the ECG signal. This invention not only reduces algorithm complexity and significantly saves computation time, but also ensures real-time signal recognition while maintaining good recognition results. Therefore, it can adapt to more scenarios and more devices, and can also meet the needs of different applications and algorithms for more accurate signal quality threshold judgment. Attached Figure Description
[0022] Figure 1 The diagram shown is a flowchart illustrating an electrocardiogram (ECG) signal quality discrimination method according to an embodiment of the present invention.
[0023] Figure 2 The diagram shown is a flowchart illustrating an electrocardiogram (ECG) signal quality discrimination method according to an embodiment of the present invention.
[0024] Figure 3 The diagram shows an electrocardiogram signal of the good signal quality category in one embodiment of the present invention.
[0025] Figure 4 The diagram shows an electrocardiogram signal of a general quality category according to an embodiment of the present invention.
[0026] Figure 5 The diagram shows an electrocardiogram signal of poor signal quality category in one embodiment of the present invention.
[0027] Figure 6 The diagram shown is a schematic representation of an electrocardiogram (ECG) signal quality discrimination system according to an embodiment of the present invention.
[0028] Figure 7 The diagram shown is a structural schematic of an electrocardiogram signal quality discrimination terminal according to an embodiment of the present invention. Detailed Implementation
[0029] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0030] It should be noted that in the following description, reference is made to the accompanying drawings, which illustrate several embodiments of the invention. It should be understood that other embodiments may also be used, and changes in mechanical composition, structure, electrical system, and operation may be made without departing from the spirit and scope of the invention. The following detailed description should not be considered limiting, and the scope of the embodiments of the invention is defined only by the claims of the published patents. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. Spatially related terms, such as “upper,” “lower,” “left,” “right,” “below,” “below,” “lower part,” “above,” “upper part,” etc., may be used herein to illustrate the relationship between one element or feature shown in the figures and another element or feature.
[0031] Throughout this specification, when it is said that a part is "connected" to another part, this includes not only "direct connection" but also "indirect connection" by placing other elements in between. Furthermore, when it is said that a part "includes" a certain constituent element, unless otherwise stated otherwise, this does not exclude other constituent elements, but rather means that other constituent elements may also be included.
[0032] The terms "first," "second," and "third," etc., used herein are for the purpose of describing various parts, components, regions, layers, and / or segments, but are not limiting. These terms are used only to distinguish one part, component, region, layer, or segment from others. Therefore, the "first part," "component," "region," "layer," or "segment" described below may refer to a "second part," "component," "region," "layer," or "segment" without departing from the scope of this invention.
[0033] Furthermore, as used herein, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context indicates otherwise. It should be further understood that the terms “comprising,” “including,” indicate the presence of the stated feature, operation, element, component, item, kind, and / or group, but do not preclude the presence, occurrence, or addition of one or more other features, operations, elements, components, items, kinds, and / or groups. The terms “or” and “and / or” as used herein are interpreted as inclusive, or mean any one or any combination thereof. Thus, “A, B, or C” or “A, B, and / or C” means “any one of: A; B; C; A and B; A and C; B and C; A, B, and C.” Exceptions to this definition arise only when combinations of elements, functions, or operations are inherently mutually exclusive in some manner.
[0034] This invention provides a method for judging the quality of electrocardiogram (ECG) signals. The method involves preprocessing the acquired ECG signals to remove power frequency interference and baseline. Then, feature extraction is performed on a predetermined length of data extracted from the preprocessed ECG signal. This feature data is input into a signal quality classification model to obtain the corresponding quality classification result. Finally, a score mapping is performed to obtain a signal quality score for the corresponding ECG signal, which is then used for subsequent quality judgment. This invention not only reduces algorithm complexity and significantly saves computation time, but also ensures real-time signal recognition while maintaining good recognition performance. Therefore, it can adapt to more scenarios and devices, and can meet the needs of different applications and algorithms for more accurate signal quality threshold judgment.
[0035] The present invention will now be described in detail with reference to the accompanying drawings, so that those skilled in the art can readily implement it. The present invention can be embodied in many different forms and is not limited to the embodiments described herein.
[0036] like Figure 1 A schematic diagram illustrating the structure of an electrocardiogram signal quality discrimination method according to an embodiment of the present invention is shown.
[0037] The method includes:
[0038] Step S1: Preprocess the acquired ECG signal to remove power frequency interference and baseline from the ECG signal.
[0039] In detail, the electrocardiogram (ECG) signal can be the raw ECG signal collected by the wearable device, or it can be the ECG signal input by any input device.
[0040] The main task completed in the preprocessing stage is to filter out the irrelevant frequency bands of the ECG signal. The preprocessing methods for the acquired ECG signal can be any method to remove power frequency interference and baseline in the ECG signal, such as filters. Alternatively, smoothing can be used to filter out baseline and noise, or other frequency boundaries can be used in combination with appropriate filter orders to achieve the filtering purpose.
[0041] In a preferred embodiment, the 50Hz power frequency interference is first filtered out by a 50Hz notch filter, and then the baseline is removed by a 2Hz-40Hz bandpass filter.
[0042] Step S2: Perform feature extraction processing on the data of a set length extracted from the preprocessed electrocardiogram signal to obtain the corresponding feature data.
[0043] In detail, a set length of data is extracted from the preprocessed ECG signal. This set length is chosen to allow for judgment of signal quality without being too large, in order to meet more needs and scenarios, and is characterized by speed and low latency. The extracted data is then subjected to feature extraction processing to obtain corresponding feature data, ensuring recognition effectiveness.
[0044] In one embodiment, the set length is within the range of 1.5S to 5S, which ensures at least one complete cycle of electrocardiogram signal. Preferably, the set length is 2S.
[0045] In a preferred embodiment, since the slowest heart rate is 40 bpm, which is 1.5 seconds per cycle, a 2-second data length ensures at least one complete ECG cycle. Therefore, the preferred data length is 2 seconds. Using a 2-second ECG signal as input ensures the real-time nature of the judgment result and is better suited for various wearable devices and different usage scenarios.
[0046] Preferably, using a 2-second window to capture data allows for the assessment of signal quality. A 2-second window ensures real-time signal recognition while maintaining good recognition accuracy, meeting a wider range of needs and scenarios, and offering speed and low latency. It should be noted that while signal quality assessment can also be performed using a window longer than 2 seconds, longer windows will impact the algorithm's real-time performance, resulting in higher latency. Therefore, a trade-off should be made based on the specific needs of the project.
[0047] In one embodiment, feature extraction, also known as feature engineering, primarily involves identifying features highly correlated with signal quality and calculating their values to improve classifier performance. Therefore, this stage is crucial to the final performance and reliability of the classifier. There are two main types of features extracted: waveform features and statistical features. Methods for feature extraction from electrocardiogram (ECG) signals include:
[0048] Data of a set length extracted from the preprocessed electrocardiogram signal is normalized, and the normalized data is then subjected to waveform and statistical feature calculations to obtain the corresponding feature data.
[0049] Specifically, the signal is first standardized. Because of differences in equipment and individual characteristics, signals can vary. Therefore, the signal is normalized to a range of 0 and 1 to minimize the impact of these individual differences. Then, the normalized data undergoes waveform and statistical characteristic calculations to obtain the corresponding feature data.
[0050] The characteristic data includes: skewness, kurtosis, standard deviation, mean, root mean square, mean absolute error, mean absolute value, impulse factor, coefficient of variation, waveform factor, signal length, peak-to-valley value, peak factor, number of small peaks, upper outlier, and lower outlier of the time-domain signal.
[0051] The signal length is calculated by calculating the difference (X) of the time-domain signal. i –X i-1(i=1~n) The absolute value of the difference is taken, and then the average is taken. Therefore, this feature describes the length of a segment of the time-domain signal; its calculation formula is:
[0052] mean((abs(X i –X i-1 (1)
[0053] Where n is the number of data points, which is calculated by multiplying the time window by the sampling rate.
[0054] It is understandable that a normal electrocardiogram (ECG) signal, after differential processing, will have a relatively large value at the QRS complex, because the QRS complex represents the heartbeat. Signals that have not been collected or have been interfered with will deviate from this value range. By utilizing the characteristics of the tree model, we can effectively distinguish between good and bad signals.
[0055] Peak-valley values are calculated by subtracting the amplitude difference between the maximum value (max(S)) and the minimum value (min(S)) within a given signal range. In an ideal ECG waveform, the QRS complex appears when the difference between the maximum and minimum values is at its largest. However, for a single device, the differences between multiple individuals exist within a certain range. Signals exceeding this range can be considered to have been interfered with, resulting in exceptionally large differences, or to have been completely ignored, resulting in exceptionally small ECG signals.
[0056] The peak factor is calculated by subtracting the previous characteristic peak value from the root mean square value (max(S) - min(S)). One of the results is used as a feature. This is a combined feature, which can also help to better distinguish signals. The formula for calculating the peak factor is:
[0057]
[0058] The number of small peaks is determined by counting when the current value is higher than the values of the two signals to the left and right (i.e., count++ if i>i-1 and i>i+1). If i>i-1 and i>i+1, then it is considered a small peak, and so on, summing up the total number of small peaks. 90% of the energy in an ECG signal is concentrated below 40Hz. When the signal quality is poor, many small peaks resembling spikes will appear on the ECG waveform. Ideally, an ECG signal should only have five small peaks, appearing on the P wave, T wave, and QRS complex. An increase in the number of small peaks indicates interference from high-frequency signals. The signal contains many high-frequency signals, leading to an increase in the number of small peaks. Conversely, when a signal is entirely noise, the number of small peaks will also increase dramatically. This feature is specifically designed for this characteristic of time-domain signal waveforms and can significantly improve the accuracy of the classifier.
[0059] Outlier detection is a method for detecting the presence of outliers in data. As is well known, electrocardiogram (ECG) waveforms reflect the state of the heart. When abnormal ECG waveforms appear, these abnormal waveforms refer to the actual heart condition reflected in the data. Pathological ECG waveforms will certainly differ significantly from standard ECG waveforms. Relying solely on previous statistical features might misclassify some good pathological waveforms as poor signal quality. The significance of this feature lies in its ability to assist previous statistical features in distinguishing pathological ECG waveforms that are not contaminated by noise, ensuring their correct identification.
[0060] Preferably, the detection condition for upper outliers is up_count++if val>μ+3σ; the detection condition for lower outliers is down_count++if val<μ-3σ; where μ refers to the mean and σ refers to the standard deviation.
[0061] Here, the upper boundary is represented by the mean plus three standard deviations. If a data point is greater than the upper boundary, it is considered an outlier, and up_count is incremented by 1. The lower boundary is represented by the mean minus three standard deviations. If a data point is less than the lower boundary, it is considered an outlier, and down_count is incremented by 1.
[0062] Furthermore, the formulas for calculating characteristics such as kurtosis, skewness, mean, and standard deviation are similar to existing formulas. The formula for calculating kurtosis is:
[0063]
[0064] The formula for calculating skewness is:
[0065]
[0066] The formula for calculating the mean is:
[0067]
[0068] The formula for calculating the standard deviation is:
[0069]
[0070] It should be noted that in the above formula, all Xi can represent the i-th data point based on the range of values for i. The mean is denoted by S; S represents the data signal of the entire window. Taking a 2s window as an example, S represents all the signal data within the 2s window, and n is the total number of data points. A 2s window has 2 * 125 = 250 points. This is the average of 250 points within a 2s window.
[0071] The features mentioned above are key features derived after extensive screening and rigorous correlation analysis. The main factors considered include memory usage, recognition accuracy, computation time, and interpretability. In time-domain digital signal analysis, many other features can be selected, such as margin factors, Shannon entropy, and sample entropy, which can reflect important information and characteristics of the signal. However, their calculation processes are complex, resulting in long computation times and high computational resource consumption, especially in embedded devices with limited resources. Furthermore, there are many frequency-domain features, such as power spectral density, but these require Fast Fourier Transform calculations, which often consume significant time and resources. Therefore, the feature extraction method provided in this embodiment can extract multiple effective features in a single loop, greatly saving computation time. The selected features are all extracted based on time-domain digital signals. Compared to other features of time-domain and frequency-domain signals, the features provided in this embodiment are highly interpretable, easy to understand, and can effectively identify the quality of data signals.
[0072] In one embodiment, in addition to features extracted from the time domain of the signal, feature extraction can also achieve good results by calculating the first and second derivatives of the signal and then extracting useful signal features.
[0073] Step S3: Based on the constructed signal quality classification model, obtain the quality classification result corresponding to a quality category according to the input feature data.
[0074] In one embodiment, the signal quality classification model is constructed in the following ways:
[0075] Step 1: Preprocess each ECG signal in the dataset that is labeled with the quality classification result to remove power line interference and baseline from the ECG signal;
[0076] Specifically, the dataset used for model training is a single-channel ECG signal dataset with a sampling rate of 125Hz. The data collection subjects cover individuals of different ages and genders. All labels are annotated by professionals. The data labels are preferably divided into three categories: quality classification labels corresponding to the first signal quality category, the second signal quality category, and the third signal quality category. The signal quality of the second signal quality category is worse than that of the first signal quality category but better than that of the third signal quality category. In one embodiment, one category is "good signal quality," which is labeled with a quality classification label corresponding to the "good signal quality" category. The numerical label can be defined as "0." The evaluation criterion is that if the signal is relatively smooth and the QRS wave, P wave, and T wave are clearly visible, it is considered good. One category is "moderate signal quality," which is a quality classification result labeled as "moderate." The numerical label can be defined as "1." The criterion is that if the P and T waves are affected by high-frequency noise, but the QRS complex is still clear and does not affect the calculation of some physiological information, then it is considered "moderate." The last category is "poor signal quality," which is a quality classification result labeled as "moderate." The numerical label can be defined as "2." The criterion is that if the QRS complex cannot be clearly identified and cannot be used for calculation, then it is considered "poor." In this embodiment, the criteria for good, moderate, and poor signal quality can be set according to actual needs. For example, such as... Figure 3 The data quality label indicates high-quality 2S window data, showing that the data is very smooth and almost free of interference; for example... Figure 4 The data quality label indicates 2S window data of average quality. It can be seen that there are many small peaks outside the QRS wave, indicating signal interference. However, this data can still be used to calculate some physiological indicators. For example... Figure 5The data quality label indicates poor quality 2S window data, meaning the data is completely unrecognizable and unusable for analysis.
[0077] Furthermore, the preprocessing method for each ECG signal labeled with quality classification results in the dataset is exactly the same as the previously described S1 step, so it will not be repeated here.
[0078] Step 2: Perform feature extraction processing on the data of a set length extracted from each of the preprocessed ECG signals to obtain the corresponding feature data.
[0079] It should be noted that the feature extraction process here is exactly the same as that in step S2 above, so it will not be described again here.
[0080] Step 3: Train a classification model based on the feature data of each ECG signal and the quality classification result label to obtain the signal quality classification model, which is used to input the feature data of the ECG signal and output the corresponding quality classification result judged as a quality category.
[0081] The quality classification results include: probability values for the good signal quality category, probability values for the average signal quality category, and probability values for the poor signal quality category. The category determined depends on the category with the highest probability.
[0082] It should be noted that the classification model trained in this embodiment is a tree model, specifically XGBoost (eXtremeGradient Boosting), AdaBoost (Adaptive Boosting), LightGBM (Light Gradient Boosting Machine), etc. Other machine learning models can also be used, such as SVM (Support Vector Machine) and MLP (Multilayer Perceptron). Under the premise of using the signal features extracted in this embodiment, a good result can still be achieved.
[0083] In one embodiment, a network model trained using a semi-supervised learning algorithm and multiple electrocardiogram (ECG) signals labeled with quality classification results is used to determine the quality category corresponding to the quality classification result labels that need to be labeled for ECG signals in the dataset that are difficult to distinguish.
[0084] In other words, when encountering data that is difficult to distinguish between good and bad, a semi-supervised learning method is used to train the model using a small portion of labeled data to label signals that are difficult to distinguish. Through repeated iterative training, a model with strong generalization ability is finally obtained, reducing the workload of data labeling.
[0085] In one embodiment, the signal quality classification model employs a tree classification model with hyperparameter constraints.
[0086] Specifically, during training, considering the issue of model deployment resources, the hyperparameter settings are quite strict, especially the depth of the tree model is limited to within 5; in addition, other model parameters such as "min_child_weight", "Gamma", and "eta" are also strictly limited to ensure that there is no risk of overfitting while guaranteeing training effectiveness and accuracy.
[0087] This invention uses a tree classification model for training, which makes the model more robust and has low hardware resource requirements. Tree models are characterized by fast training speed and good results.
[0088] Step S4: Perform score mapping on the quality classification results to obtain the signal quality score corresponding to the ECG signal, so as to judge the quality of the ECG signal.
[0089] In one embodiment, step S4 includes:
[0090] Based on the mapping function corresponding to the selected quality category, the signal quality score located within the score interval of the corresponding quality category is calculated according to the calculated values obtained from the probability values of the other two categories besides the determined quality category in the quality classification result. This mapping method can map the quality classification result to the range of [0, 100] points.
[0091] Specifically, each quality category corresponds to a set of mapping functions. The final result of each mapping function corresponds to the signal quality score within the score range of that quality category. The score is obtained based on the probabilities of the other two categories. The smaller the total probability of the other two categories, the greater the probability of belonging to that signal quality category, and the higher or lower the score, and vice versa.
[0092] It should be noted that the score range for each quality category can be determined according to requirements, and there is no limitation on it.
[0093] For example, the quality classification result yields the probability of being assigned to each category, with a sum of 1. For instance, if a signal segment is classified as having good signal quality, the probability vector might be [0:0.99, 1:0.005, 2:0.005]. When assigned to the first signal quality category, its score range is [76, 100]. At this point, based on the sum of the probabilities of the other two categories, the smaller the total probability of the other two categories, the higher the probability of belonging to the good signal quality category, and the higher the score, and vice versa. When assigned to the third signal quality category, its score range is [0, 25]. At this point, the score can be mapped based on the total probability of the other two categories. The smaller the total probability of the other two categories, the higher the probability of the signal being poor, and the lower the score, and vice versa. When assigned to the second signal quality category, the score range is [26, 75]. The score is determined by the difference in probabilities between the other two categories. When the probability of good is greater than the probability of poor, the score should be closer to 75, and vice versa.
[0094] Preferably, the mapping function is a combination of a sigmoid function or a multi-fold linear function that approximates a sigmoid function.
[0095] Specifically, the sigmoid function can be directly used for score mapping. To accommodate more devices and speed up computation, an N-fold linear function combination can be used instead of the sigmoid function to obtain the final signal quality score. This N-fold linear function combination includes multiple linear functions, each used to fit a straight line; and the combination of these linear functions can fit a non-linear sigmoid function, meaning that multiple straight lines can be used to fit the curve fitted by the sigmoid function.
[0096] For example, in order to adapt to fixed-point computing devices, a 5-fold linear function was used to approximate the sigmoid function to achieve the mapping purpose.
[0097] The sigmoid function is as follows:
[0098]
[0099] In this equation, α, β, and b are the parameters of the sigmoid function, x is the sum of the probabilities of the other two input categories, and y is the output of the sigmoid function. The range of the output value varies depending on the category, and the final score is obtained after interval mapping. It should be noted that the sigmoid function parameters α, β, and b are different for each quality category.
[0100] For example, if the probability of the first quality category is higher and the probability of the second and third quality categories is lower, it means that the signal quality is better. Since the sum of the probability values is positive, we can shift it to the right using α and β to achieve a better mapping effect. b is used to control the range of the sigmoid output.
[0101] The output of the sigmoid function is input into a linear interval mapping function that uses a linear function to obtain the final score; the mapping function includes:
[0102] y score =k×x score +c; (8)
[0103] Where k and c are the slope and intercept of the linear function, respectively, and x score The output value of sigmoid, y score The signal quality is scored.
[0104] The parameters k and c in the linear function are related to the mapped score interval. For example, for the first signal quality category, when b is 0, the sigmoid output is in [0,1]. Mapping [0,1] to the score interval [76,100] determines the mapped linear function, and thus the values of k and c. If the score interval changes, the corresponding k and c also change accordingly. Thus, the sigmoid parameters of the mapping function, as well as the slope and intercept of the linear function, can be set according to the selected score interval, thereby enabling the mapping of signal quality classification results to signal quality scores within that score interval.
[0105] Specifically, the sigmoid function y1 corresponding to the first signal quality category:
[0106]
[0107] Where α1, β1, and b1 are sigmoid parameters, x1 is the sum of the probability values of the second and third signal quality categories, and y1 is the output value of the sigmoid function. For example, when the classification model outputs a category corresponding to good signal quality, x1 is the sum of the probability values of the average and poor signal quality categories. Substituting this into the sigmoid function yields y1, and then substituting the result of y1 into the interval mapping formula, the final output score interval is [76, 100].
[0108] The sigmoid function y2 corresponding to the second signal quality category:
[0109]
[0110] In this model, α2, β2, and b2 are sigmoid parameters. x2 is the probability of the first signal quality category minus the probability of the third signal quality category. When the probability of the first signal quality category is greater, x2 is positive; otherwise, it is negative. y2 is the output value of the sigmoid function. For example, when the classification model outputs a category corresponding to the general signal quality category, x2 is the probability of the good signal quality category minus the probability of the poor signal quality category. When the probability of the good signal quality category is greater, x2 is positive; otherwise, it is negative. Substituting this into the sigmoid function yields y2. Substituting the result of y2 into the interval mapping formula, the final score interval is [26, 75].
[0111] The sigmoid function y3 corresponding to the third signal quality category:
[0112]
[0113] In this model, α3, β3, and b3 are sigmoid parameters, x3 is the sum of the probability values of the first and second signal quality categories, and y3 is the output value of the sigmoid function. For example, when the classification model outputs the category of poor signal quality, x3 is the sum of the probability values of the good and average signal quality categories. Substituting this into the sigmoid function yields y3, and then substituting the result of y3 into the interval mapping formula, the final score interval is [0, 25].
[0114] In one embodiment, such as Figure 5 As shown, the method further includes:
[0115] After obtaining the corresponding feature data, an initial judgment is made on the feature data. Specifically, after executing step S2, the feature data is initially judged based on the set initial judgment conditions. If the conditions are met, the judgment fails; if the conditions are not met, the judgment passes. For example, the set initial judgment conditions can adopt a threshold judgment method for certain feature data. For instance, if the number of calculated small peaks is too large, it can be directly judged as poor. For some large abrupt change signals, because the number of spikes is not large, and some features are very similar to some signals with good signal quality, it will cause classification errors. Therefore, for this type of signal, a judgment can be made after extracting the standard deviation feature. If it exceeds the set threshold, it can be directly judged as poor signal quality.
[0116] If the judgment fails, it will be directly classified as the third signal quality category and the signal quality score will be set to zero.
[0117] If the judgment is successful, the corresponding feature data is input into the corresponding signal quality classification model to execute the subsequent step S3.
[0118] Similar in principle to the above embodiments, the present invention provides an electrocardiogram signal quality discrimination system.
[0119] The following specific embodiments are provided in conjunction with the accompanying drawings:
[0120] like Figure 6 A schematic diagram of the structure of an electrocardiogram signal quality discrimination system according to an embodiment of the present invention is shown.
[0121] The system includes:
[0122] The preprocessing module 61 is used to preprocess the acquired electrocardiogram (ECG) signal to remove power frequency interference and baseline from the ECG signal.
[0123] The feature extraction module 62 is connected to the preprocessing module 61 and is used to perform feature extraction processing on data of a set length extracted from the preprocessed electrocardiogram signal to obtain corresponding feature data.
[0124] The signal quality classification module 63 is connected to the feature extraction module 62 and is used to obtain a quality classification result corresponding to a quality category based on the input feature data according to the constructed signal quality classification model.
[0125] The scoring module 64 is connected to the signal quality classification module 63 and is used to perform score mapping on the quality classification results to obtain the signal quality score corresponding to the electrocardiogram signal, so as to judge the quality of the electrocardiogram signal.
[0126] Since the implementation principle of this ECG signal quality discrimination system has been described in the foregoing embodiments, it will not be repeated here.
[0127] In one embodiment, the construction of the signal quality classification model includes: preprocessing each electrocardiogram (ECG) signal in the dataset that is labeled with a quality classification result to remove power frequency interference and baseline in the ECG signal; performing feature extraction processing on data of a set length extracted from each preprocessed ECG signal to obtain corresponding feature data; training a classification model based on the feature data of each ECG signal and the quality classification result label to obtain the signal quality classification model, which is used to input the feature data of the ECG signal and output the quality classification result corresponding to a quality category; wherein, the quality classification result includes: probability values of a first signal quality category, probability values of a second signal quality category, and probability values of a third signal quality category; the signal quality of the second signal quality category is worse than the signal quality of the first signal quality category but better than the signal quality of the third signal quality category; wherein, the type of the quality classification result label includes: a quality classification result label corresponding to the first signal quality category, a quality classification result label corresponding to the second signal quality category, and a quality classification result label corresponding to the third signal quality category.
[0128] In one embodiment, the feature extraction process includes: normalizing data of a predetermined length extracted from the preprocessed electrocardiogram signal, and performing waveform and statistical feature calculations on the normalized data to obtain corresponding feature data; wherein, the feature data includes: signal skewness, kurtosis, standard deviation, mean, root mean square, mean absolute error, mean absolute value, impulse factor, coefficient of variation, waveform factor, signal length, peak-to-valley value, peak factor, number of small peaks, upper outlier, and lower outlier.
[0129] In one embodiment, a network model trained using a semi-supervised learning algorithm and multiple electrocardiogram (ECG) signals labeled with quality classification results is used to determine the quality classification result labels that need to be labeled for ECG signals of difficult-to-distinguish categories in the dataset.
[0130] In one embodiment, the step of performing a score mapping on the quality classification result to obtain a signal quality score corresponding to the electrocardiogram signal includes: calculating a signal quality score within the score interval of the corresponding quality category based on the mapping function corresponding to the determined quality category and the calculated values obtained from the probability values of the other two categories in the quality classification result besides the determined quality category.
[0131] In one embodiment, the mapping function employs a sigmoid function or a combination of multiple fold linear functions approximating the sigmoid function, plus a linear function mapping; when the mapping function employs the sigmoid function, the sigmoid function includes:
[0132]
[0133] And where α, β, and b are sigmoid parameters, x is the calculated input obtained from the probability values of the other two categories, and y is the output value of the sigmoid function; the linear function includes:
[0134] y score =k×x score +c; (8)
[0135] Where k and c are the slope and intercept of the linear function, respectively, and x score The output value of sigmoid, y score The signal quality is scored.
[0136] In one embodiment, the method further includes: after obtaining the corresponding feature data, performing an initial judgment on the feature data; if the judgment fails, directly determining it as a third signal quality category and setting the signal quality score to zero; if the judgment passes, inputting the corresponding feature data into the corresponding signal quality classification model.
[0137] In one embodiment, the set length is within the time range of 1.5S to 5S.
[0138] In one embodiment, the signal quality classification model employs a tree classification model with hyperparameter constraints.
[0139] like Figure 7 A schematic diagram of the structure of the electrocardiogram signal quality discrimination terminal 70 in an embodiment of the present invention is shown.
[0140] The electrocardiogram signal quality discrimination terminal 70 includes a memory 71 and a processor 72. The memory 71 stores computer programs; the processor 72 runs the computer programs to implement, for example... Figure 1 The method for judging the quality of electrocardiogram signals described above.
[0141] Optionally, the number of memories 71 can be one or more, and the number of processors 72 can be one or more. Figure 7 Each example is taken as an instance.
[0142] Optionally, the processor 72 in the ECG signal quality discrimination terminal 70 will perform the following according to... Figure 1 The steps described involve loading one or more instructions corresponding to the process of an application into memory 71, and having the processor 72 run the application stored in the first memory 71, thereby achieving the following: Figure 1 The various functions in the electrocardiogram signal quality discrimination method.
[0143] Optionally, the memory 71 may include, but is not limited to, high-speed random access memory and non-volatile memory. For example, one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices; the processor 72 may include, but is not limited to, a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0144] Optionally, the processor 72 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0145] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed, implements as follows: Figure 1 The method for judging the quality of electrocardiogram signals is shown. The computer-readable storage medium may include, but is not limited to, floppy disks, optical disks, CD-ROMs (Read-Only Optical Disk Memory), magneto-optical disks, ROMs (Read-Only Memory), RAMs (Random Access Memory), EPROMs (Erasable Programmable Read-Only Memory), EEPROMs (Electrically Erasable Programmable Read-Only Memory), magnetic cards or optical cards, flash memory, or other types of media / machine-readable media suitable for storing machine-executable instructions. The computer-readable storage medium may be a product not connected to a computer device or a component used in a computer device.
[0146] In summary, the ECG signal quality discrimination method, system, terminal, and medium of the present invention preprocess the acquired ECG signal to remove power frequency interference and baseline, extract features from a predetermined length of data extracted from the preprocessed ECG signal, input the feature data into a signal quality classification model to obtain the corresponding quality classification result, and then perform score mapping to obtain the signal quality score of the corresponding ECG signal for subsequent quality discrimination. The present invention solves the problems of inaccurate results, excessive memory consumption and computation time, and poor real-time performance in existing ECG signal quality assessment technologies. It not only reduces algorithm complexity and significantly saves computation time, but also ensures real-time signal recognition while maintaining good recognition results. This allows it to adapt to more scenarios and devices, and also meets the needs of different applications and algorithms for more accurate signal quality threshold judgment. Therefore, the present invention effectively overcomes the various shortcomings of the prior art and has high industrial application value.
[0147] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method of electrocardiosignal quality discrimination, characterized in that, The method comprises: Pretreating the collected electrocardio signals to remove power frequency interference and baseline in the electrocardio signals; Performing feature extraction processing on data of a set length intercepted in the pretreated electrocardio signals to obtain corresponding feature data; Based on the constructed signal quality classification model, obtaining a quality classification result corresponding to a quality category according to the input feature data; Performing score mapping on the quality classification result to obtain a signal quality score corresponding to the electrocardio signals for discriminating the quality of the electrocardio signals; The construction of the signal quality classification model comprises: pretreating each electrocardio signal in a data set labeled with a quality classification result label to remove power frequency interference and baseline in the electrocardio signals; performing feature extraction processing on data of a set length respectively intercepted in each pretreated electrocardio signal to obtain corresponding feature data; training a classification model based on the feature data and the quality classification result label of each electrocardio signal to obtain the signal quality classification model for inputting the feature data of an electrocardio signal and outputting a quality classification result corresponding to a quality category; wherein the quality classification result comprises: a probability value of a first signal quality category, a probability value of a second signal quality category, and a probability value of a third signal quality category; the signal quality of the second signal quality category is worse than that of the first signal quality category and better than that of the third signal quality category; wherein the types of the quality classification result label include: a quality classification result label corresponding to a first signal quality category, a quality classification result label corresponding to a second signal quality category, and a quality classification result label corresponding to a third signal quality category The score mapping of the quality classification result to obtain the signal quality score corresponding to the electrocardio signals comprises: based on the mapping function corresponding to the judged quality category, calculating the signal quality score within the score interval of the corresponding quality category according to the calculation value obtained from the probability values of the other two categories in the quality classification result except the judged quality category.
2. The method of claim 1, wherein the quality of the electrocardiosignal is determined by: The feature extraction processing comprises: The data of a set length intercepted in the pretreated electrocardio signals is normalized, and the normalized data is subjected to waveform and statistical feature calculation to obtain corresponding feature data; The feature data comprises: signal skewness, kurtosis, standard deviation, mean value, root mean square, mean absolute error, average absolute value, pulse factor, coefficient of variation, waveform factor, signal length, peak valley value, peak value factor, small peak number, upper abnormal value, and lower abnormal value.
3. The method of claim 1, wherein the quality of the electrocardiosignal is determined by: Based on a network model obtained by training using a semi-supervised learning algorithm and a plurality of electrocardio signals labeled with quality classification result labels, the quality classification result labels to be labeled for the electrocardio signals of difficult-to-distinguish categories in the data set are discriminated.
4. The method of claim 1, wherein the quality of the electrocardiosignal is determined by: The mapping function adopts a sigmoid function or a combination of multiple piecewise linear functions similar to the sigmoid function, plus a linear function mapping; When the mapping function adopts the sigmoid function, the sigmoid function comprises: ; And wherein, a, b and b are sigmoid parameters, x is an input calculated value obtained by probability values of the other two categories, and y is an output value of the sigmoid function; The linear function comprises: ; where k and c are the slope and intercept of the linear function, sigmoid is the output value, and y score is the signal quality score.
5. The method of claim 1, wherein the quality of the electrocardiosignal is determined by: The method further comprises: After obtaining the corresponding feature data, the feature data is initially judged; If the judgment fails, it is directly determined as the third signal quality category and the signal quality score is set to zero; If the judgment is passed, the corresponding feature data is input into the signal quality classification model.
6. The method of claim 1, wherein the step of determining the quality of the electrocardiosignal is performed by a method comprising: The set length is within a time length range of 1.5S to 5S.
7. The method of claim 1, wherein the quality of the electrocardiosignal is determined by: The signal quality classification model adopts a tree classification model limited by hyperparameters.
8. A system for discriminating quality of electrocardiosignal, characterized by, The system comprises: A preprocessing module for preprocessing the collected electrocardio signals to remove power frequency interference and baseline in the electrocardio signals; A feature extraction module connected to the preprocessing module for performing feature extraction processing on data of a set length intercepted in the preprocessed electrocardio signals to obtain corresponding feature data; A signal quality classification module connected to the feature extraction module for obtaining a quality classification result corresponding to a quality category based on the constructed signal quality classification model according to the input feature data; A scoring module connected to the signal quality classification module for performing score mapping on the quality classification result to obtain a signal quality score corresponding to the electrocardio signal for discriminating the quality of the electrocardio signal; The construction of the signal quality classification model comprises: preprocessing each electrocardio signal in the data set labeled with a quality classification result label to remove power frequency interference and baseline in the electrocardio signals; performing feature extraction processing on data of a set length respectively intercepted in each preprocessed electrocardio signal to obtain corresponding feature data; training a classification model based on the feature data and the quality classification result label of each electrocardio signal to obtain the signal quality classification model for inputting the feature data of the electrocardio signal and outputting the quality classification result corresponding to a quality category; wherein the quality classification result comprises: probability values of the first signal quality category, probability values of the second signal quality category, and probability values of the third signal quality category; the signal quality of the second signal quality category is worse than that of the first signal quality category and better than that of the third signal quality category; wherein the types of the quality classification result label include: a quality classification result label corresponding to the first signal quality category, a quality classification result label corresponding to the second signal quality category, and a quality classification result label corresponding to the third signal quality category The score mapping of the quality classification result to obtain the signal quality score corresponding to the electrocardio signal comprises: based on the mapping function corresponding to the judged quality category, calculating the signal quality score within the score interval of the corresponding quality category according to the calculated value obtained by the probability values of the other two categories in the quality classification result except the judged quality category.
9. A terminal for discriminating quality of electrocardiosignal, characterized by, Comprise: One or more memories and one or more processors; The one or more memories are configured to store a computer program. The one or more processors, connected to the memories, are configured to run the computer program to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored, which, when run by one or more processors, performs the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Electrocardiosignal quality evaluation method
CN112971795A
Portable dynamic electrocardiograph monitor-based arrhythmia detection method
CN113349753A