A hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method
By employing a hierarchical Bayesian wavelet adaptive thresholding method, the adaptiveness and uncertainty issues of traditional wavelet thresholding methods are resolved, achieving high-quality denoising and interpretable reconstruction of ECG signals, improving the signal-to-noise ratio and reducing errors, making it suitable for long-term ECG signal monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING UNIV OF INFORMATION SCI & TECH
- Filing Date
- 2026-03-30
- Publication Date
- 2026-06-30
AI Technical Summary
Traditional wavelet thresholding methods lack coefficient-level adaptability and uncertainty quantification, resulting in poor denoising of ECG signals and difficulty in maintaining high quality and interpretability during long-term continuous monitoring.
A hierarchical Bayesian wavelet adaptive thresholding method is adopted. By generating pure electrocardiogram signals and noise under different physiological states, and combining a sparse prior distribution model and variational Bayesian inference, the threshold is adaptively selected to achieve coefficient-level signal denoising.
It significantly improves the signal-to-noise ratio, reduces the root mean square error and percentage root mean square error, and enhances the denoising quality and interpretability of ECG signals, especially performing excellently in high-noise environments.
Smart Images

Figure CN122309920A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of biological signal processing technology, specifically to a hierarchical Bayesian wavelet adaptive threshold electrocardiogram signal denoising method. Background Technology
[0002] Electrocardiogram (ECG) signals, as a non-invasive method for measuring cardiac electrical activity, provide crucial information about cardiac electrophysiological function and serve as an important tool in motion monitoring and physiological indicator monitoring. However, in actual monitoring environments, the acquisition and processing of ECG signals are inevitably contaminated by various noise sources. Common noise interferences are mainly divided into three categories: (1) Baseline drift (BW), caused by low-frequency activities such as body movement and breathing of the monitored subject; (2) Muscle artifact (MA), originating from the contraction and relaxation of muscles other than the myocardium; and (3) Electrode motion artifact (EM), generated by changes in electrode-skin impedance caused by movement. These noise components can mask the key morphological features of the signal, impair interpretability, and easily introduce false positives and false negatives into automated analysis algorithms, potentially leading to misjudgments.
[0003] In recent years, deep learning methods have demonstrated powerful feature learning capabilities in electrocardiogram (ECG) analysis, with architectures such as Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) achieving remarkable results. However, the performance of deep learning models is highly dependent on the quality of the input data; noise contamination can severely reduce the model's generalization ability and predictive reliability. More importantly, in scenarios requiring long-term continuous monitoring (lasting for hours or even tens of hours), high-quality preprocessing is not only a prerequisite for improving the performance of downstream AI models but also the foundation for ensuring the interpretability and credibility of decisions.
[0004] Wavelet Transform (WT), due to its superior time-frequency localization properties, has become one of the most widely used nonlinear techniques in ECG signal denoising and feature extraction. Unlike traditional Fourier methods, which only provide global frequency information, wavelet transform offers a multi-resolution analysis framework that can adaptively decompose signals at different time scales. This framework aligns with the physiological hierarchical structure of ECG signals, where mid-to-high frequency components correspond to the sharp features of the QRS complex, while low-frequency components reflect slower changes such as the P wave, T wave, and baseline drift.
[0005] The core of wavelet denoising lies in the choice of threshold, which determines the balance between noise suppression and signal preservation. Donoho et al. proposed three representative methods: the Universal thresholding method using a globally fixed threshold, the Minimax thresholding method based on minimizing the maximum mean square error criterion, and the SureShrink method based on Stein's unbiased risk estimation. Within the Bayesian framework, Chang et al.'s BayesShrink method uses a generalized Gaussian distribution to model wavelet coefficients and derives a closed-form threshold. While the above methods improve denoising performance to some extent, they all use global or scale-level thresholds, lack coefficient-level adaptability, and lack uncertainty quantification and theoretical optimality guarantees, which can easily lead to over- or under-denoising of local features. Summary of the Invention
[0006] The purpose of this invention is to provide a hierarchical Bayesian wavelet adaptive thresholding method for ECG signal denoising. This method solves the problems of traditional wavelet thresholding methods lacking coefficient-level adaptability and being unable to quantify uncertainty, thereby achieving high-quality denoising and interpretable signal reconstruction of ECG signals.
[0007] To achieve the above functions, this invention designs a hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method, which executes the following steps S1-S7 to complete the target ECG signal denoising:
[0008] Step S1: Generate pure ECG signals under different physiological states and acquire real physiological noise to generate Gaussian noise; superimpose the Gaussian noise with each pure ECG signal according to different signal-to-noise ratio levels to obtain each noisy ECG signal.
[0009] Step S2: For each noisy ECG signal, perform discrete wavelet decomposition with a preset number of layers to obtain low-frequency approximation coefficients and detail coefficients of each layer. Model the detail coefficients observed in each layer as a superposition of the real signal coefficients and Gaussian noise.
[0010] Step S3: Based on the sparse prior distribution model, construct an ECG signal denoising model and perform mixed priors on the real signal coefficients of each layer;
[0011] Step S4: For the highest frequency detail coefficients, estimate the noise variance using the median absolute deviation (MAD) method;
[0012] Step S5: Using the mean field approximation, the ECG signal denoising model is iteratively optimized through the method of maximizing the lower bound of evidence until convergence;
[0013] Step S6: Based on the posterior mean estimation, calculate the estimated values of the coefficients of the denoised real signal;
[0014] Step S7: Use the estimated values of the coefficients of the denoised real signal to perform wavelet reconstruction, output the denoised ECG signal, evaluate the output denoised ECG signal using preset indicators, and apply a convergent ECG signal denoising model to complete the denoising of the target ECG signal.
[0015] Beneficial effects: Compared with existing technologies, this invention is the first to apply Spike-and-Slab variational inference to wavelet denoising threshold selection, accurately characterizing the sparse structure of wavelet coefficients that simultaneously contain noise and signal. This provides a rigorous theoretical basis for coefficient-level adaptation, and the posterior probability provides an interpretable coefficient-level confidence metric, supporting risk assessment and reliability analysis in practical decision-making. Furthermore, under real noise conditions in the synthetic Gaussian noise and MIT-BIH noise stress test databases, this invention significantly outperforms traditional thresholding algorithms in terms of SNR, RMSE, and PRD. Attached Figure Description
[0016] Figure 1 This is a flowchart of a hierarchical Bayesian wavelet adaptive threshold electrocardiogram signal denoising method provided by an embodiment of the present invention;
[0017] Figure 2 These are six pure electrocardiogram signals synthesized in the experiment according to an embodiment of the present invention;
[0018] Figure 3 These are time-domain waveforms and spectrum analysis diagrams of three types of real noise provided according to embodiments of the present invention;
[0019] Figure 4 This is a five-level detail coefficient distribution feature map of a pure electrocardiogram signal after db3 wavelet decomposition according to an embodiment of the present invention;
[0020] Figure 5 This is a wavelet coefficient amplitude distribution histogram provided according to an embodiment of the present invention;
[0021] Figure 6 This is a schematic diagram of multi-level signal decomposition and relative frequency bandwidth distribution provided according to an embodiment of the present invention. Detailed Implementation
[0022] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0023] This invention provides a hierarchical Bayesian wavelet adaptive threshold electrocardiogram signal denoising method, referring to... Figure 1 Perform the following steps S1-S7 to complete the denoising of the target ECG signal:
[0024] Step S1: Generate pure ECG signals under different physiological states and acquire real physiological noise to generate Gaussian noise; superimpose the Gaussian noise with each pure ECG signal according to different signal-to-noise ratio levels to obtain each noisy ECG signal.
[0025] In step S1, an ECGSYN generator is downloaded from PhysioNet. This generator simulates the spatiotemporal evolution of cardiac electrical activity through three coupled sets of ordinary differential equations. The ECGSYN generator is used to generate pure electrocardiogram signals for different physiological states.
[0026] ;
[0027] ;
[0028] ;
[0029] in, The z-axis represents the phase plane coordinates, and z represents the amplitude of the electrocardiogram signal. It is the angular frequency (determined by the RR interval). Indicates the attractor strength; These represent the amplitude, width, and phase angle of the i-th wave in the electrocardiogram signal, respectively, and t represents time. Baseline control parameters; , , , , These represent low average heart rate rhythm signal, high RR interval fluctuation amplitude signal, low RR interval fluctuation amplitude signal, T wave morphology parameter perturbation signal, and baseline amplitude offset signal, respectively. , , , , Waveform is determined by parameters Heart rate variability is controlled through adaptive regulation of angular frequency, reflecting the balance between the activities of the sympathetic and parasympathetic nervous systems.
[0030] The generated pure ECG signals under different physiological states were sampled at a rate of 360 Hz, with each signal segment containing 650,000 data points. Real physiological noise was acquired from the MIT-BIH database. In this embodiment, the real physiological noise consisted of baseline drift (BW), electrode motion artifacts (EM), muscle artifacts (MA), and generated Gaussian noise. The Gaussian noise was superimposed on each pure ECG signal at different signal-to-noise ratio (SNR) levels. In this embodiment, the SNR range was set from -10 dB to 10 dB, with 5 dB intervals, to obtain the noisy signal.
[0031] Figure 2These are the six pure electrocardiogram signals synthesized in the experiment. Figure 3 Time-domain waveform and spectrum analysis for three types of real noise. Figure 3 In the figure, (a) and (b) are the time-domain waveform and spectral analysis of baseline drift (BW), respectively; (c) and (d) are the time-domain waveform and spectral analysis of electrode motion artifact (EM), respectively; and (e) and (f) are the time-domain waveform and spectral analysis of muscle artifact (MA), respectively. The clean ECG signal is superimposed with real physiological noise and Gaussian noise to obtain the noisy signal.
[0032] Step S2: For each noisy ECG signal, perform discrete wavelet decomposition with a preset number of layers to obtain low-frequency approximation coefficients and detail coefficients of each layer. Model the detail coefficients observed in each layer as a superposition of the real signal coefficients and Gaussian noise.
[0033] The discrete wavelet decomposition uses the Daubechies wavelet basis function db3, and the decomposition level is [number missing]. The optimal number of decomposition layers suitable for different signals was determined through experiments.
[0034] according to Figure 4 The distribution characteristics of the five detail coefficients (D1 to D5) after db3 wavelet decomposition of the pure ECG signal clearly verify the inherent sparse structure of the ECG signal data. The highest frequency detail coefficient D1 exhibits an extremely sparse pulse-like pattern, with most coefficients close to zero, and a significant spike only appearing at the time position corresponding to the QRS complex. As the number of decomposition layers increases, D2 and D3 maintain high sparsity, while D4 and D5 begin to contain more continuous information, corresponding to the slowly changing P and T waves.
[0035] according to Figure 5 The wavelet coefficient amplitude distribution histogram (using logarithmic coordinates) exhibits a typical heavy-tailed distribution characteristic, conforming to a power-law decay pattern. The vast majority of coefficients cluster near zero, and their frequency decreases exponentially with increasing coefficient amplitude. This distribution pattern indicates that the ECG signal energy is highly concentrated in a few large-amplitude coefficients, fully conforming to the sparsity assumption in compressed sensing theory, and providing a theoretical basis for the threshold-based wavelet denoising strategy of this invention.
[0036] The specific steps of step S2 are as follows:
[0037] Step S2.1: According to Figure 6 The noisy ECG signal is decomposed by a series of low-pass and high-pass filters to obtain the low-frequency approximation coefficients CA and detail coefficients at each level. Where J represents the decomposition level; the noisy ECG signal is represented as a weighted sum of wavelet basis functions using discrete wavelet transform:
[0038] ;
[0039] In the formula, This represents the noisy ECG signal at time t, where j and i represent the decomposition layer index and the translation parameter index, respectively. This represents the i-th detail coefficient at the j-th layer. This represents the i-th wavelet basis function of the j-th layer at time t;
[0040] Step S2.2: Model the detail coefficients observed at each layer as a superposition of the true signal coefficients and Gaussian noise:
[0041] ;
[0042] Where L represents the total number of detail coefficients in the current layer. This represents the i-th detail coefficient observed in the current layer. This represents the actual signal coefficients when the current layer is noise-free. It is Gaussian noise. Represents a normal probability distribution. This represents the noise variance.
[0043] Step S3: Based on the sparse prior distribution model, construct an ECG signal denoising model and perform mixed priors on the real signal coefficients of each layer;
[0044] In step S3, an ECG signal denoising model is constructed, and the actual signal coefficients corresponding to the noise-free current layer are calculated. A mixed prior is adopted, as shown in the following formula:
[0045] ;
[0046] in, This represents a sparsity parameter that controls the overall sparsity of the actual signal coefficients. The smaller the value, the higher the prior sparsity. For Dirac delta function, Represents a normal probability distribution. It represents the variance of the electrocardiogram signal and describes the amplitude distribution of the non-zero coefficients.
[0047] For the ECG signal denoising model constructed in step S3, binary latent variables are introduced to facilitate computational processing and interpretability of the inference. Indicates whether the i-th detail coefficient contains a valid signal:
[0048] ;
[0049] In the example, the posterior probability can be defined. ;when At that time, the coefficient of the i-th real signal A value of zero, originating from the Spike component, signifies the i-th detail coefficient observed at the current layer. If it consists purely of noise, then the posterior probability is... The value will be 0, representing the estimated value of the true signal coefficients after denoising. When it is 0, it is completely suppressed; when At that time, the coefficient of the i-th real signal Non-zero values originate from the Slab component, indicating the i-th detail coefficient observed in the current layer. It contains meaningful signals.
[0050] Step S4: Due to the sparsity of ECG signals in the wavelet domain, the noise variance is estimated using the median absolute deviation (MAD) method for the highest frequency detail coefficients.
[0051] Under the Gaussian noise assumption, MAD and noise variance There is a theoretical calibration relationship between them, and the noise variance is estimated using the following formula:
[0052] ;
[0053] The above formula ensures that, under pure Gaussian noise conditions, the MAD estimate is the noise variance. The unbiased, consistent estimator. This noise variance estimate is used as a fixed parameter in the variational inference process and is not iteratively updated. Calibration factor; For noise variance, Represents the highest frequency detail coefficient. The absolute deviation of the median is expressed by the following formula:
[0054] ;
[0055] In the formula, Represents the median operator. L represents the i-th detail coefficient observed in the current layer, and L represents the total number of detail coefficients in the current layer.
[0056] Step S5: Using the mean field approximation, the ECG signal denoising model is iteratively optimized through the method of maximizing the lower bound of evidence until convergence;
[0057] The goal of variational Bayesian inference is to quantify the true signal coefficients. The degree to which thresholding should be reduced depends on the posterior probability that the detail coefficients contain a meaningful signal. :
[0058] ;
[0059] In the formula, This indicates that the i-th detail coefficient observed in the current layer is... In this case, The probability of that, i.e., the probability without noise.
[0060] Because the Spike-and-Slab model includes discrete variables and continuous variables Direct calculation is not feasible. Therefore, variational Bayesian inference is used to approximate the posterior distribution. Within the variational distribution family Q, the optimal distribution that approximates the true posterior is sought. :
[0061] ;
[0062] In the formula, The KL divergence is used to measure the approximate posterior distribution. and the true posterior distribution The difference between them; Q represents the family of variational distributions, and q represents the distribution in the family of variational distributions;
[0063] We employ the mean field approximation, assuming that the variational distribution can be decomposed into the product of its components and optimized by maximizing the lower bound of evidence (ELBO).
[0064] The specific steps of step S5 are as follows:
[0065] Step S5.1: Initialize hyperparameters The adaptive settings are based on the prior statistical properties of the signal, requiring no manual parameter tuning. Initial sparsity parameters. Based on the proportion of the significance coefficient, the initial signal variance Using the sample variance estimation with significance coefficients, set the initial sparsity parameter. Initial ECG signal variance As shown in the following formula:
[0066] ;
[0067] ;
[0068] in, This indicates an indicator function that equals 1 if a certain condition is met, and 0 otherwise. Expressing expectations, Indicates variance;
[0069] Step S5.2: Based on Bayes' theorem and logarithmic transformation, The update formula is:
[0070] ;
[0071] ; in, Represents the Sigmoid function; Represents an exponential function;
[0072] Observing the above formula, we can see that, The update depends only on the sparsity parameter ECG signal variance With noise variance and detail coefficient ;
[0073] Step S5.3: Based on the principle of variational inference, The update formula is the mean of the posterior probabilities, which updates the sparsity parameters. and ECG signal variance As shown in the following formula:
[0074] ;
[0075] in, This represents the posterior probability of the i-th detail coefficient after the nth iteration; when most coefficients have a large probability... When the value is, Increase accordingly in this round of iteration; The sparsity parameter is represented by L after the nth iteration; L represents the total number of detail coefficients in the current layer.
[0076] ECG signal variance The update formula for characterizing the amplitude distribution of non-zero wavelet coefficients is as follows:
[0077] ;
[0078] in, Represents the posterior mean. This represents the posterior variance, indicating... It equals the weighted second moment of all coefficients, with the weights being their posterior probabilities. , Indicates the noise variance. This represents the i-th detail coefficient observed in the current layer. Indicates the number of iterations. This represents the variance of the electrocardiogram signal after the nth iteration;
[0079] Step S5.4: Based on the maximum change in non-zero posterior probability, set the convergence criterion:
[0080] ;
[0081] Set a threshold for the maximum change in posterior probability. and the threshold for the number of iterations ,when Or the number of iterations exceeds the threshold. The iteration terminates at the specified time. This represents the maximum change in the posterior probability after the nth iteration; This represents the posterior probability of the i-th detail coefficient after the (n-1)-th iteration; in the embodiment, it is set as follows: , .
[0082] The convergence criterion based on the maximum change in posterior probability is equivalent to maximizing the lower bound of evidence convergence, and there exists a constant. , so that:
[0083] ;
[0084] in, , represents the increment of the lower bound of evidence in the nth iteration. This represents the maximum lower bound of evidence in the nth iteration. Let represent the lower bound of the evidence maximized in the (n-1)th iteration. This double bound guarantees... If and only if .
[0085] Step S6: Based on the posterior mean estimation, calculate the estimated values of the coefficients of the denoised real signal;
[0086] The estimated values of the true signal coefficients after denoising are calculated as follows:
[0087] ;
[0088] in, This represents the estimated value of the coefficients of the true signal after denoising.
[0089] A dual adaptive contraction mechanism is achieved by using posterior mean estimation:
[0090] Sparse contraction: Sparse contraction is implemented based on the probability of signal existence to effectively suppress the influence of noise during weak observations;
[0091] Amplitude contraction: Amplitude contraction based on signal-to-noise ratio (SNR) will result in a more pronounced contraction toward zero under low SNR conditions.
[0092] This method enables the estimator to adaptively distinguish between real signals and noise, while minimizing the mean square error within a Bayesian framework, thus achieving statistical optimality. Finally, the denoised ECG signal is reconstructed using an inverse wavelet transform on the denoised coefficients.
[0093] Step S7: Use the estimated values of the coefficients of the denoised real signal to perform wavelet reconstruction, output the denoised ECG signal, evaluate the output denoised ECG signal using preset indicators, and apply a convergent ECG signal denoising model to complete the denoising of the target ECG signal.
[0094] The following metrics were used to evaluate the output denoised ECG signal:
[0095] Signal-to-noise ratio :
[0096] ;
[0097] Root Mean Square Error (RMSE):
[0098] ;
[0099] Percentage Root Mean Square Error (PRD):
[0100] ;
[0101] in, For pure electrocardiogram signals, The signal is the denoised ECG signal, where M is the length of a single ECG signal and m is the number of sampling points.
[0102] Table 1 provides Figure 5 Table 2 provides the average performance comparison of various threshold selection methods after 50 experiments under different signal-to-noise ratios and Gaussian noise levels, and Table 3 provides the performance comparison of each threshold selection method under the real physiological noise conditions of MIT-BIH.
[0103] Table 1. Parameter configuration and generation results of synthesized electrocardiogram signals
[0104]
[0105] HR Range indicates the heart rate range, measured in heart rate beats per minute. The standard deviation of heart rate variability reflects the degree of heart rate fluctuation; the larger the value, the more irregular the heart rate changes. The LF / HF ratio is the ratio of low-frequency to high-frequency power, reflecting the balance state of the autonomic nervous system. P-wave QRS is the phase angle of the P wave, which controls the timing and position of the P wave within the cardiac cycle. T-wave refers to the amplitude of the R-wave in a QRS complex. It is the phase angle of the T-wave, which controls the timing of the T-wave. It is the amplitude of the T-wave. , , , , The waves correspond to low average heart rate rhythm signal, high RR interval fluctuation amplitude signal, low RR interval fluctuation amplitude signal, T wave morphological parameter perturbation signal, and baseline amplitude offset signal, respectively.
[0106] Table 2. Comparison of denoising performance of various algorithms under Gaussian noise at different signal-to-noise ratio levels.
[0107]
[0108] in, Indicates the input signal-to-noise ratio. The output signal-to-noise ratio (SNR) is represented by Universal, Minimax, BayesShrink, and ACF, which are traditional denoising methods. In a high-noise environment (-10dB), the SNR of the method in this invention is improved by 74.1% compared to the traditional Universal method. In terms of signal fidelity, the percentage root mean square error (PRD) is improved by 8.9% compared to the BayesShrink method and by 27.9% compared to the Universal method. At the same time, the method in this invention achieves the lowest root mean square error (RMSE) in all test scenarios, realizing the optimal balance between noise suppression and signal detail preservation.
[0109] Table 3. Performance comparison of various denoising algorithms under real noise conditions
[0110]
[0111] in, Indicates the input signal-to-noise ratio. SNR represents the signal-to-noise ratio difference. Universal, Minimax, BayesShrink, and ACF are traditional noise reduction methods.
[0112] The method of this invention demonstrates superior performance in three real-world noise environments: baseline drift (BW), electromyographic interference (MA), and electrode motion artifacts (EM). In BW and MA noise, the method achieves optimal signal-to-noise ratio (SNR), RMSE, and PRD, with an SNR improvement of 30%–40% compared to traditional methods. In EM noise, the waveform reconstruction quality differs from the optimal method by only approximately 0.0001–0.0002, indicating significantly better overall performance than existing methods.
[0113] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A hierarchical Bayesian wavelet adaptive threshold electrocardiogram signal denoising method, characterized in that, Perform the following steps S1-S7 to complete the denoising of the target ECG signal: Step S1: Generate pure ECG signals under different physiological states and acquire real physiological noise to generate Gaussian noise; superimpose the Gaussian noise with each pure ECG signal according to different signal-to-noise ratio levels to obtain each noisy ECG signal. Step S2: For each noisy ECG signal, perform discrete wavelet decomposition with a preset number of layers to obtain low-frequency approximation coefficients and detail coefficients of each layer. Model the detail coefficients observed in each layer as a superposition of the real signal coefficients and Gaussian noise. Step S3: Based on the sparse prior distribution model, construct an ECG signal denoising model and perform mixed priors on the real signal coefficients of each layer; Step S4: For the highest frequency detail coefficients, estimate the noise variance using the median absolute deviation (MAD) method; Step S5: Using the mean field approximation, the ECG signal denoising model is iteratively optimized through the method of maximizing the lower bound of evidence until convergence; Step S6: Based on the posterior mean estimation, calculate the estimated values of the coefficients of the denoised real signal; Step S7: Use the estimated values of the coefficients of the denoised real signal to perform wavelet reconstruction, output the denoised ECG signal, evaluate the output denoised ECG signal using preset indicators, and apply a convergent ECG signal denoising model to complete the denoising of the target ECG signal.
2. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 1, characterized in that, In step S1, the following generator model is used to generate pure electrocardiogram signals for different physiological states: ; ; ; in, The z-axis represents the phase plane coordinates, and z represents the amplitude of the electrocardiogram signal. Angular frequency, Indicates the attractor strength; These represent the amplitude, width, and phase angle of the i-th wave in the electrocardiogram signal, respectively, and t represents time. Baseline control parameters; , , , , These represent low average heart rate rhythm signal, high RR interval fluctuation amplitude signal, low RR interval fluctuation amplitude signal, T wave morphology parameter perturbation signal, and baseline amplitude offset signal, respectively.
3. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 2, characterized in that, The discrete wavelet decomposition described in step S2 uses the Daubechies wavelet basis function db3, and the decomposition level is [number missing]. .
4. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 3, characterized in that, The specific steps of step S2 are as follows: Step S2.1: The noisy ECG signal is decomposed by a low-pass filter and a high-pass filter to obtain the low-frequency approximation coefficients CA and the detail coefficients of each layer. Where J represents the decomposition level; the noisy ECG signal is represented as a weighted sum of wavelet basis functions using discrete wavelet transform: ; In the formula, This represents the noisy ECG signal at time t, where j and i represent the decomposition layer index and the translation parameter index, respectively. This represents the i-th detail coefficient at the j-th layer. This represents the i-th wavelet basis function of the j-th layer at time t; Step S2.2: Model the detail coefficients observed at each layer as a superposition of the true signal coefficients and Gaussian noise: ; Where L represents the total number of detail coefficients in the current layer. This represents the i-th detail coefficient observed in the current layer. This represents the actual signal coefficients when the current layer is noise-free. It is Gaussian noise. Represents a normal probability distribution. This represents the noise variance.
5. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 4, characterized in that, In step S3, an ECG signal denoising model is constructed, and the actual signal coefficients corresponding to the noise-free current layer are calculated. A mixed prior is adopted, as shown in the following formula: ; in, Represents the sparsity parameter. For Dirac delta function, Represents a normal probability distribution. This represents the variance of the electrocardiogram (ECG) signal.
6. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 5, characterized in that, For the ECG signal denoising model constructed in step S3, binary latent variables are introduced. Indicates whether the i-th detail coefficient contains a valid signal: ; when At that time, the coefficient of the i-th real signal A value of zero means that the i-th detail coefficient observed in the current layer is zero. Purely composed of noise; when At that time, the coefficient of the i-th real signal Non-zero indicates that the i-th detail coefficient observed in the current layer is... It contains meaningful signals.
7. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 6, characterized in that, In step S4, the noise variance is estimated using the following formula: ; in, Calibration factor; For noise variance, Represents the highest frequency detail coefficient. The absolute deviation of the median is expressed by the following formula: ; In the formula, Represents the median operator. L represents the i-th detail coefficient observed in the current layer, and L represents the total number of detail coefficients in the current layer.
8. The hierarchical Bayesian wavelet adaptive threshold ECG signal denoising method according to claim 7, characterized in that, The specific steps of step S5 are as follows: Step S5.1: Set initial sparsity parameters Initial ECG signal variance As shown in the following formula: ; ; in, This indicates an indicator function that equals 1 if a certain condition is met, and 0 otherwise. Expressing expectations, Indicates variance; Step S5.2: Update the posterior probability As shown in the following formula: ; in, Represents the Sigmoid function; Represents an exponential function; Step S5.3: Update sparsity parameters and ECG signal variance As shown in the following formula: ; ; in, Represents the posterior mean. This represents the posterior variance. Indicates the noise variance. This represents the i-th detail coefficient observed in the current layer. Indicates the number of iterations; This represents the posterior probability of the i-th detail coefficient after the n-th iteration; This represents the sparsity parameter after the nth iteration. This represents the variance of the electrocardiogram signal after the nth iteration; Step S5.4: Based on the maximum change in posterior probability, set the convergence criterion: ; Set a threshold for the maximum change in posterior probability. and the threshold for the number of iterations ,when Or the number of iterations exceeds the threshold. The iteration terminates at the specified time. This represents the maximum change in the posterior probability after the nth iteration; Let represent the posterior probability of the i-th detail coefficient after the (n-1)-th iteration; The convergence criterion based on the maximum change in posterior probability is equivalent to maximizing the lower bound of evidence convergence, and there exists a constant. , so that: ; in, , represents the increment of the lower bound of evidence in the nth iteration. This represents the maximum lower bound of evidence in the nth iteration. This represents the maximum lower bound of evidence in the (n-1)th iteration.
9. A hierarchical Bayesian wavelet adaptive threshold electrocardiogram signal denoising method according to claim 8, characterized in that, In step S6, the estimated values of the coefficients of the denoised real signal are calculated as follows: ; in, This represents the estimated value of the coefficients of the true signal after denoising.
10. A hierarchical Bayesian wavelet adaptive threshold electrocardiogram signal denoising method according to claim 1, characterized in that, In step S7, the following metrics are used to evaluate the output denoised ECG signal: Signal-to-noise ratio : ; Root Mean Square Error (RMSE): ; Percentage Root Mean Square Error (PRD): ; in, For pure electrocardiogram signals, The signal is the denoised ECG signal, where M is the length of a single ECG signal and m is the number of sampling points.