A robust electrocardiogram denoising method based on autoregressive induced residual generation
By employing a two-stage ECG denoising method based on autoregressive induced residual generation, the temporal structure and residual details of the ECG signal are decoupled, solving the problems of insufficient generalization and fidelity in existing ECG denoising technologies. This method achieves high-fidelity ECG signal recovery in complex noise environments and is suitable for clinical diagnosis using wearable devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAZHONG UNIV OF SCI & TECH
- Filing Date
- 2026-02-14
- Publication Date
- 2026-06-05
AI Technical Summary
Existing ECG denoising techniques are insufficient in terms of generalization, fidelity, and interpretability. They are unable to effectively preserve key clinical diagnostic features such as QRS complexes and ST segments in complex noise environments. Furthermore, traditional methods cannot adapt to nonlinear and non-stationary noise, resulting in the loss or distortion of ECG waveform details.
A two-stage ECG denoising method based on autoregressive induced residual generation is adopted. By decoupling the temporal structure learning and residual detail recovery of ECG signals, the low-frequency temporal structure is extracted using an autoregressive prediction network, and high-frequency details are generated by combining a conditional flow matching network, thus achieving high-fidelity denoising.
It achieves high-fidelity denoising of ECG signals in complex noise environments, balancing morphological fidelity and noise suppression capabilities. It is suitable for uncontrolled scenarios in wearable devices and provides reliable clinical diagnostic data support.
Smart Images

Figure CN122153257A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electrocardiogram (ECG) signal denoising, and more specifically, relates to a robust ECG denoising method based on autoregressive induced residual generation. Background Technology
[0002] ECG, or electrocardiogram, is an electrical signal generated by monitoring cardiac physiological activity through electrodes attached to the skin. As one of the routine clinical examination results, it is the "gold standard" for diagnosing cardiovascular diseases. With the widespread use of wearable medical devices (such as Holter monitors and wristband ECG monitors), ECG signals can be continuously acquired in everyday life scenarios, making long-term monitoring and early screening of cardiovascular diseases possible. However, wearable devices are susceptible to various interferences during acquisition, mainly including baseline drift (BW), electrode motion noise (EM), and muscle artifacts (MA). These noises are nonlinear and non-stationary, and their frequency spectra highly overlap with the inherent frequency range of ECG signals, severely distorting key morphological features such as the P wave, QRS complex, and T wave, leading to a significantly increased risk of clinical misdiagnosis. To achieve reliable analysis of ECG signals in uncontrolled scenarios, ECG denoising technology in complex noise environments has become one of the core research areas. Currently, the main methods used in ECG signal denoising include noise suppression based on traditional time-frequency analysis and end-to-end signal reconstruction using deep learning. However, both methods suffer from problems such as excessive smoothing of waveform details, weak generalization ability in unknown noise scenarios, and difficulty in fully preserving key clinical diagnostic features such as QRS complexes and ST segments. Traditional methods for denoising include Finite Impulse Response (FIR) filters, Infinite Impulse Response (IIR) filters, and Wavelet Transform (WT). These methods rely on pre-defined mathematical models and prior knowledge of the signal, offering low computational complexity and ease of implementation. However, limited by the expressive power of fixed parameters and basis functions, they cannot effectively adapt to complex and varied noise patterns, exhibit poor suppression of nonlinear and non-stationary noise, and are prone to causing loss or distortion of ECG waveform details. Other methods utilize latent feature learning models such as Denoising Autoencoders (DAEs) and generative models such as Generative Adversarial Networks (GANs) and diffusion models. DAE achieves end-to-end denoising through an encoder-decoder architecture, but the dimensionality reduction process is prone to causing excessive waveform smoothing and loss of key diagnostic information such as ST segment and QT interval. Although generative models can retain more high-frequency details, they require multi-step iterative sampling starting from Gaussian noise, resulting in high computational overhead, poor real-time performance, and a tendency to overfit noise-signal correlations to specific datasets, with weak generalization ability in unknown noise scenarios. Summary of the Invention
[0003] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a robust ECG denoising method based on autoregression-induced residual generation. Its technical objective is to overcome the shortcomings of existing ECG denoising techniques in terms of generalization, fidelity, and interpretability. This method employs a two-stage ECG denoising approach based on autoregression-induced residual generation (AriReGen). By decoupling the temporal structure learning of ECG signals from residual detail recovery, it achieves high-fidelity denoising in complex noise environments while ensuring the robustness and clinical interpretability of the model in unknown scenarios.
[0004] To achieve the above objectives, according to a first aspect of the present invention, an electrocardiogram (ECG) signal denoising system is provided, comprising: The preprocessing module is used to sequentially filter, normalize, and trim the length of the input noisy ECG signal, and then process the trimmed noisy ECG signal segments. Perform discrete wavelet transform to obtain the filtered proxy signal. ; The semantic structure extraction module includes: an encoding unit, used to extract semantic structures from the semantic structure. Mapped to latent feature sequences Autoregressive prediction networks with causal masks are used to predict... Predict features at the next time step that are no later than the current time step, and output the latent feature sequence after autoregressive prediction. Decoding unit, used to determine the decoding process based on the given information. Reconstructing semantic structure signals ; The residual signal generation and denoising module includes: a noise injection unit, used to inject noise based on noisy ECG signal segments. With semantic structure signals Constructing noisy residual signals To the noisy residual signal Injecting Gaussian noise Obtain the disturbance residual signal , Weighting coefficients; time coding units, used to convert random sampling time scalars. Mapped to temporal embedding vector Conditional flow matching network, used to match based on and Output conditional velocity prediction Integrating unit, used for... Integrating the signals yields the target residual signal. ;in, ; ; ; The reconstruction module is used to convert the semantic structure signal With the target residual signal The denoised ECG signal is obtained by adding them together. , and output.
[0005] According to a second aspect of the present invention, a training method for an electrocardiogram signal denoising system as described in the first aspect is provided, comprising: The training will focus on pairs of noisy ECG signal segments. Corresponding clean electrocardiogram signal segments Input the ECG signal denoising system; To minimize the loss function The semantic structure extraction module is trained for the target; wherein, This represents the mean square error. The hyperparameters used to adjust the weights of the reconstruction loss and the autoregressive loss; The target residual signal is constructed using a noise injection unit. Constructing from the perturbation residual signal using path construction units To the target residual signal continuous transmission path And calculate the analytical velocity field To minimize the flow matching loss The conditional flow matching network is trained for the target; wherein, According to and Output conditional velocity prediction, for When it follows a uniform distribution on the interval [0,1] The expectation.
[0006] According to a third aspect of the present invention, a method for denoising electrocardiogram (ECG) signals is provided, comprising: inputting a noisy ECG signal into a system as described in any one of claims 1-3 to obtain a denoised ECG signal.
[0007] According to a fourth aspect of the present invention, an electronic device is provided, comprising: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the method described in the second or third aspect.
[0008] According to a fifth aspect of the invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to perform the method as described in the second or third aspect.
[0009] According to a sixth aspect of the invention, a computer program product is provided, comprising a computer program or instructions that, when executed by a processor, implement the method as described in the second or third aspect.
[0010] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: ECG signals possess both stable low-frequency morphological structures and relatively fragile high-frequency detail information. Traditional one-off end-to-end denoising methods often struggle to achieve a balance between restoring the overall waveform and detailed texture, easily leading to over-smoothing of the waveform or the introduction of residual noise. To address this, the ECG signal denoising system provided in this invention employs a phased modeling approach of semantic structure reconstruction and residual signal generation, decoupling the modeling of the ECG's low-frequency structure from its high-frequency details, thus balancing morphological fidelity and noise suppression. Through this two-stage decoupling design, the low-frequency temporal structure of the ECG is first extracted, followed by high-frequency detail recovery of the residual. Utilizing the efficient generation capabilities of time-frequency guidance and flow matching provided by the autoregressive output, the system accurately preserves key clinical physiological features while ensuring generalization, achieving robust ECG denoising. It is particularly suitable for processing noisy ECG signals acquired by wearable devices in uncontrolled environments, converting interfered ECG signals into high-fidelity signals that meet clinical diagnostic requirements, providing reliable data support for cardiovascular disease monitoring and diagnosis. Attached Figure Description
[0011] Figure 1This is one of the flowcharts of the electrocardiogram signal denoising system provided in the embodiments of the present invention.
[0012] Figure 2 This is the second flowchart of the electrocardiogram signal denoising system provided in the embodiments of the present invention.
[0013] Figure 3 In the figure, (a) and (b) are the denoising result diagram and power spectrum diagram provided by the embodiment of the present invention, respectively.
[0014] Figure 4 This is a diagram showing the location of the R peak calculated using the Pan-Tompkins algorithm.
[0015] Figure 5 The images show the results before and after denoising using the ECG signal denoising method provided in this embodiment of the invention.
[0016] Figure 6 (a) and (b) in the figure are data distribution diagrams of QT and SimEMG database samples visualized using the t-SNE algorithm.
[0017] Figure 7 In the figures (a) and (b), the process of dynamic denoising evolution using the ECG signal denoising method provided in the embodiments of the present invention is visualized. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0019] Noise in ECG signals not only alters the detailed morphology of the ECG waveform but also introduces significant high-frequency components and spurious peaks in the frequency domain, causing substantial interference to subsequent tasks such as R-peak detection and disease classification. The core deficiency of existing ECG signal denoising methods lies in their inability to simultaneously balance noise suppression effectiveness, waveform detail fidelity, and generalization ability in unknown scenarios. Furthermore, they lack targeted modeling of the ECG signal's temporal structure and physiological semantics, resulting in denoised signals that fail to meet the requirements of structural integrity and semantic interpretability for clinical diagnosis.
[0020] Based on this, this invention provides a robust ECG denoising method based on autoregressive induced residual generation. To improve the generalization and physiological fidelity of ECG denoising, the AriReGen method provided in this invention introduces a temporal structure decoupling mechanism, performing two-stage precoding processing on noisy ECG signals. Considering the temporal correlation of clinically important regions such as the P wave, QRS complex, and ST segment in the ECG signal, the first stage extracts the low-frequency temporal structure of the signal through an autoregressive model, providing physiological semantic guidance for subsequent feature optimization, enabling the model to fully capture the inherent time dependence of cardiac electrical activity. Subsequently, the input signal and the residual features output from the first stage are decomposed in the frequency domain to separate high-frequency noise and physiological detail information. After the residuals are directionally generated and transformed using a flow matching algorithm, they are fused to finally output a denoised ECG signal, accurately preserving multi-scale physiological feature information relevant to clinical diagnosis.
[0021] Specifically, embodiments of the present invention provide an electrocardiogram signal denoising system, comprising: The preprocessing module sequentially filters, normalizes, and trims the length of the input noisy ECG signal, thereby dividing the noisy ECG signal into noisy ECG signal segments of a preset length. For each noisy ECG signal segment after cropping Perform Discrete Wavelet Transform (DWT) to obtain the filtered proxy signal. .
[0022] Specifically, the preprocessing module performs bandpass filtering and normalization on the input noisy ECG signal to remove baseline drift and power frequency interference. It also divides the continuously recorded signal into several ECG signal segments according to a preset number of sampling points (e.g., each segment contains 512 sampling points to facilitate subsequent phased modeling). Then, it performs discrete wavelet transform on each ECG signal segment and performs multi-scale time-frequency decomposition based on Daubechies wavelets to suppress high-frequency noise and retain the main morphological information, thus obtaining a filtered proxy signal.
[0023] The preprocessing module includes: a filtering unit, a partitioning unit, and a continuous wavelet transform unit; The filtering unit is used to perform bandpass filtering and baseline drift correction on the original acquired electrocardiogram signal; The segmentation unit is used to evenly divide the filtered electrocardiogram signal into multiple electrocardiogram signal segments by a fixed number of sampling points. The continuous wavelet transform unit is used to perform continuous wavelet transform on the ECG signal segment using a preset wavelet basis to generate the filtered proxy signal. .
[0024] In one alternative implementation, to enhance the system's robustness to different noise scenarios, the preprocessing module can also adaptively adjust the cutoff frequency of the bandpass filter and the length of the segment based on the differences between the acquisition device and the application scenario.
[0025] The semantic structure extraction module includes an encoding unit for extracting semantic structures. Mapped to latent feature sequences Autoregressive prediction networks with causal masks are used to predict... Predict features at the next time step that are no later than the current time step, and output the latent feature sequence after autoregressive prediction. Decoding unit, used to determine the decoding process based on the given information. Reconstructing semantic structure signals .
[0026] Specifically, the filtered proxy signal is input to a non-hop-connected encoder-decoder U-Net structure to obtain a latent feature sequence at the bottleneck layer. The latent feature sequence is then predicted for the next time step using an autoregressive prediction network with causal masking, and the semantic structure signal is obtained after decoding. The semantic structure signal is used to characterize the low-frequency timing structure of the P-QRS-T group.
[0027] The encoding unit is an encoder of a U-Net without skip connections, used to map the filtered proxy signal into a latent feature sequence. ; Let be the number of channels in the potential feature sequence. represents the dimension of each channel in the potential feature sequence.
[0028] The autoregressive prediction network with causal masking is a Transformer encoder with time-step masking, used for feature sequence-based prediction. Predict features at the next time step based on features no later than the current time step, and output the latent feature sequence after autoregressive prediction. ; The decoding unit is a decoder of a U-Net without hop connections, used to reconstruct semantic structure signals based on latent feature sequences. .
[0029] The semantic structure extraction module uses the following first-stage loss function during training:
[0030] in, This represents the mean square error. The hyperparameters are used to adjust the weights of the reconstruction loss and the autoregressive loss.
[0031] The residual signal generation and denoising module includes: a noise injection unit, used to inject noise based on noisy ECG signal segments. With semantic structure signals Constructing noisy residual signals To the noisy residual signal Injecting Gaussian noise Obtain the disturbance residual signal , Weighting coefficients; time coding units, used to convert random sampling time scalars. Mapped to temporal embedding vector Conditional flow matching network, used to match based on and Output conditional velocity prediction Integrating unit, used for... Integrating the signals yields the target residual signal. .
[0032] Depend on It can be seen that the conditional velocity prediction of the output of the conditional flow matching network... Time scalar of random sampling exist Integrating over the interval yields the result. .in, , .
[0033] Specifically, in the residual signal generation and denoising module, the conditional flow matching network uses the time embedding vector output by the time coding unit. The semantic structure signal output by the semantic structure extraction module and Output conditional velocity prediction Integrating unit Integrating the signals yields the target residual signal. .
[0034] The training process of the conditional flow matching network is as follows: The noisy residual signal is calculated by the noise injection unit based on the original noisy ECG signal and semantic structure signal, and the target residual signal is constructed by combining it with the corresponding clean signal during training. The target residual signal is used to centrally represent the high-frequency details and residual noise components that need to be repaired. Then, according to the preset weighting coefficients... Noise that follows a zero-mean, unit-variance Gaussian distribution Injected into noisy residual signal In the process, the disturbance residual signal is obtained. ; That is, the noise injection unit is based on noisy ECG signal segments. With semantic structure signals Constructing noisy residual signals To the noisy residual signal Gaussian noise was injected to obtain the perturbed residual signal. And during training, the target residual signal is constructed by combining the corresponding clean signal. ; A path construction unit is set up, which is used to determine the upper limit of the noise scale. and lower limit definition
[0035] And calculate the analytical velocity field
[0036] Conditional flow matching networks construct continuous transmission paths and analytical velocity fields based on noisy residual signals, target residual signals, and randomly sampled time scalars. Under the conditional constraints of semantic structure signals and temporal embedding, they learn the generation process from the perturbed residual signal to the target residual signal through flow matching loss. In other words, conditional flow matching networks are based on semantic structure signals... For conditional flow matching generation networks, the velocity field along the continuous transmission path is learned. To convert the disturbed residual signal Stepwise transformation into the target residual signal .
[0037] The conditional flow matching network uses flow matching loss during training. Update the network parameters to make its predicted velocity field approximate the analytical velocity field.
[0038] It should be noted that the conditional flow matching network can be implemented using various structures, such as the U-Net network based on one-dimensional convolution, the Transformer network, and the temporal convolutional network, etc., without any limitation here.
[0039] Understandably, during the training phase, the input to the conditional flow matching network is a concatenation of data along the channel dimension. With time embedding The output is During the inference phase, the input to the conditional flow matching network is a concatenation of data along the channel dimension. With time embedding The output is .
[0040] Preferably, the conditional flow matching network adopts a one-dimensional U-Net structure with time-adaptive normalization and self-attention mechanism: in each residual block, time embedding is utilized. Scaling and bias parameters are generated by a multilayer perceptron to scale the features, enabling the network to adaptively adjust the generation process according to different time steps. A self-attention module is set in the bottleneck layer to enhance the modeling ability of long-term dependencies and global context relationships.
[0041] That is, the conditional flow matching network is a U-Net structure; within each residual block of the conditional flow matching network, the time embedding vector is used as the basis for the operation. Perform adaptive normalization, including: Scaling factor obtained by multilayer perceptron mapping With bias and intermediate features Modulation is performed according to the following formula:
[0042] in, For weighted normalized convolution or deconvolution operations, For group normalization function, For activation function, For residual mapping used for channel alignment, For the autoregressive prediction network, the first... Layer output.
[0043] The conditional flow matching network has a self-attention module in the bottleneck layer, used for query matrix-based... Key matrix AND-value matrix Calculate self-attention value To enhance semantic structural signals Guided long-term time-dependent modeling capabilities.
[0044] The reconstruction module is used to convert the semantic structure signal With the target residual signal The denoised ECG signal is obtained by adding them together. , and output.
[0045] It should be noted that the specific implementation of each module in this invention is not limited to the examples described above. For example, the encoder-decoder network in the semantic structure extraction module can be replaced with other network structures with multi-scale modeling capabilities, such as attention-based encoder-decoder networks, convolutional networks with residual connections, etc.; temporal encoding can take the form of sinusoidal positional encoding, learnable embeddings, etc.; the conditional flow matching generation network can also be combined with other generation paradigms (such as diffusion models, generative adversarial networks). As long as the residual signal can be modeled under the conditional constraints of the semantic structure signal, it should be considered to fall within the protection scope of this invention.
[0046] In summary, the workflow of the ECG signal denoising system provided by this invention is as follows: With a fixed length The original noisy ECG signal recording is taken as input, and after bandpass filtering and normalization, it is divided into several ECG signal segments according to a preset number of sampling points. For each segment, a proxy signal is obtained through wavelet transform (preferably a discrete wavelet transform based on the Daubechies wavelet db6) and an encoder-decoder network unit. and the corresponding latent feature sequences Using autoregressive prediction units to Causal modeling is performed to learn electrocardiogram rhythm information in the time dimension, resulting in a predicted feature sequence. Then, the semantic structure signal is obtained through decoding. .at this time The waveform structure is already quite good, but it still lacks high-frequency details. Subsequently, calculations are performed using the residual signal construction module. and The noisy residual signal and semantic structure signal are then fed into the conditional flow matching generation module for training and inference, and finally the denoised result is generated in the reconstruction module. Experiments show that this embodiment can significantly improve the signal-to-noise ratio and waveform fidelity on multiple public databases, and its performance in R-peak detection and disease classification tasks is also superior to the comparison methods.
[0047] This invention provides a training method for an electrocardiogram signal denoising system as described in any of the above embodiments, comprising: The training will focus on pairs of noisy ECG signal segments. Corresponding clean electrocardiogram signal segments Input the ECG signal denoising system; To minimize the loss function The semantic structure extraction module is trained for the target; wherein, This represents the mean square error. The hyperparameters used to adjust the weights of the reconstruction loss and the autoregressive loss; The target residual signal is constructed using a noise injection unit. Constructing from the perturbation residual signal using path construction units To the target residual signal continuous transmission path And calculate the analytical velocity field To minimize the flow matching loss The conditional flow matching network is trained for the target; wherein, According to and Output conditional velocity prediction, for When it follows a uniform distribution on the interval [0,1] The expectation.
[0048] Specifically, when training the aforementioned ECG signal denoising system, the training set consists of pairs of noisy ECG signal segments. Corresponding clean electrocardiogram signal segments The ECG signal denoising system is input; in the first stage, the noisy ECG signal segment is input into the preprocessing module, based on the filtered proxy signal. With semantic structure signals According to the first-stage loss function The encoder-decoder U-Net and the autoregressive prediction network (i.e., the semantic structure extraction module) are trained; in the second stage, the semantic structure signal obtained from the first stage training is used. Construct a noisy residual signal and a target residual signal, and perform random sampling at a time. Calculate the analytical velocity field And based on flow matching loss The conditional flow matching network is trained; after training, the trained network parameters at each stage are used to denoise unknown noisy ECG signals.
[0049] In the first stage, the semantic structure extraction module was self-supervised and trained using only noisy ECG signal segments and the time-frequency proxy signal obtained through wavelet transform: Loss function in the first stage The joint loss, including time-domain and time-frequency domain reconstruction, is used to train the semantic structure extraction module. This represents the mean square error. To adjust the hyperparameters of the reconstruction loss and autoregressive loss weights, we minimize... This makes the semantic structure signal It can approximate the filtered proxy signal in the time-frequency domain and maintain rhythmic consistency in the time dimension.
[0050] In one alternative implementation, the semantic structure extraction module can incorporate contrastive loss or self-supervised constraints during training to improve its representation capabilities on unlabeled data.
[0051] In the second stage, the conditional flow matching network was trained in a supervised manner using both noisy and clean ECG signals: In the second stage, the first step is based on the noisy residual signal. Target residual signal and the time scalar of random sampling Constructing a continuous transmission path and its analytical velocity field Then Semantic structural signals and time embedding The input conditional flow matching network is used together. The flow matching loss is minimized. This allows the predicted velocity field to approximate the analytical velocity field, thus learning the generation process from the perturbation residual signal to the target residual signal. After training, during the inference phase, only a noisy ECG signal segment needs to be input, and the system can output the denoised result.
[0052] The training process of the ECG signal denoising system provided by this invention will be described below with a specific example.
[0053] (1) Signal preprocessing and dataset construction: QT database is used as the ground true ECG signal source. Combined with the noise components such as baseline drift, electrode motion noise, and muscle artifacts from the MIT-BIH noise stress test database, noisy ECG training samples with different signal-to-noise ratios (range -6dB to 18dB) are synthesized.
[0054] Specifically, the QT database signal was resampled to 360Hz and segmented into 512 non-overlapping segments. Noise components were randomly combined and their intensities adjusted to match the target signal-to-noise ratio. Finally, additive noise was synthesized by randomly selecting and linearly combining noise components from the MIT-BIH noise dataset, along with synthetic electric field interference from a sinusoidal noise model superimposed on Gaussian noise. The test datasets covered seven public datasets, including SimEMG, MIT-BIH arrhythmia, and Icentia11k, all uniformly resampled to 360Hz and segmented into 512-segment long samples, preserving the original noise characteristics to simulate real-world scenarios.
[0055] (2) such as Figure 2 The first stage in the upper left corner: Autoregressive temporal relationship extraction. A self-supervised learning model is adopted, using discrete wavelet transform to construct a pre-denoised proxy signal. Based on the Daubechies wavelet (db6), an 8-level decomposition is performed, retaining level 1-5 detail components, effectively suppressing high-frequency interference and preserving the key P-QRS-T wavelet morphology. The core of this stage is the Latent Autoregressive Autoencoder (LAR-AE), which consists of an encoder, an autoregressive prediction block, and a decoder. The specific process is as follows: First, the noisy ECG signal... DWT filtering is performed to obtain the proxy signal. via encoder Compression into latent features ,Right now Subsequently, an autoregressive module based on the Transformer encoder... Temporal prediction is performed in the latent space, causal constraints are implemented through attention masks, and features at time t+1 are predicted using only features from the previous time t. Finally, the decoder Predicted latent features Reconstructed as the first stage output This stage captures the time-series dependencies of the low-frequency spectrum of ECG. The model parameters are optimized using a dual loss function, with a total loss... The calculation formula is:
[0056] in, This measures the similarity between the proxy signal and the reconstructed output. Constraining the temporal prediction accuracy of latent features; The balance coefficient was set to 2 based on experiments.
[0057] (3) Conditional residual generation and denoising, calculation of noisy signal The residual with the output of the first stage The goal is to transform it into the target residual using a flow matching algorithm. The first phase output As a time-frequency guide. The specific process is as follows: 1) Enhanced residual perturbation. This affects the noisy residual. Injecting a controllable Gaussian perturbation into the signal can improve the robustness of the model, as shown in the formula: ,
[0058] in These are random weighting coefficients that control the intensity of the disturbance. It follows a mean of 0 and a variance of . The Gaussian distribution.
[0059] 2) Flow matching path construction. Definition and Continuous transmission path between: , , The analytical velocity field of this path is given the maximum and minimum values of the noise intensity scheduling. As the target field for flow matching.
[0060] 3) Conditional velocity field learning. U-Net is used as the backbone network. The input is the tensor after channel concatenation. With temporal embedding The network uses adaptive normalization to process time-series information. The intermediate features, integrated into each convolutional block, are calculated as follows:
[0061]
[0062] in, , For mapping by multiple perception layers The resulting scaling factor and bias For group normalization function, This is the residual mapping function. The U-Net bottleneck layer introduces a self-attention mechanism to capture long-term dependencies; the attention calculation is as follows:
[0063] in, Let be the feature dimension of a single attention head. The training objective in this stage is to minimize the squared error between the predicted velocity field and the analytical velocity field, and the loss function is as follows:
[0064] 4) Residual transformation and signal reconstruction. During the inference phase, the velocity field learned through integration using a numerical ODE solver is... Obtain the estimated target residual ,in, = , , The final denoised ECG signal is the sum of the two-stage outputs: .
[0065] Understandably, the above training process can be implemented using end-to-end joint training or phased alternating training; the optimization algorithm can employ stochastic gradient descent, , etc., no specific limit is specified here.
[0066] This invention provides a method for denoising electrocardiogram (ECG) signals, wherein a noisy ECG signal is input into an ECG signal denoising system as described in any of the above embodiments to obtain a denoised ECG signal.
[0067] Specifically, a noisy electrocardiogram (ECG) signal to be processed is acquired, and the noisy ECG signal is input into an ECG signal denoising system as described in any of the above embodiments. A semantic structure signal is obtained through a preprocessing module and a semantic structure extraction module, and a target residual signal is obtained through a residual signal generation and denoising module. The two signals are then fused in a reconstruction module to generate a denoised ECG signal. This denoised ECG signal can be further used for downstream tasks such as R-peak detection, arrhythmia identification, and myocardial ischemia screening. This invention provides an electronic device, including: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is used to read executable instructions stored in the computer-readable storage medium and execute the training method or denoising method as described in any of the above embodiments.
[0068] This invention provides a computer-readable storage medium storing computer instructions for causing a processor to execute a training method or a noise reduction method as described in any of the above embodiments.
[0069] This invention provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the training method or denoising method as described in any of the above embodiments.
[0070] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A denoising system for electrocardiogram (ECG) signals, characterized in that, include: The preprocessing module is used to sequentially filter, normalize, and trim the length of the input noisy ECG signal, and then process the trimmed noisy ECG signal segments. Perform discrete wavelet transform to obtain the filtered proxy signal. ; The semantic structure extraction module includes: an encoding unit, used to extract semantic structures from the semantic structure. Mapped to latent feature sequences Autoregressive prediction networks with causal masks are used to predict... Predict features at the next time step that are no later than the current time step, and output the latent feature sequence after autoregressive prediction. Decoding unit, used to determine the decoding process based on the given information. Reconstructing semantic structure signals ; The residual signal generation and denoising module includes: a noise injection unit, used to inject noise based on noisy ECG signal segments. With semantic structure signals Constructing noisy residual signals To the noisy residual signal Injecting Gaussian noise Obtain the disturbance residual signal , Weighting coefficients; time coding units, used to convert random sampling time scalars. Mapped to temporal embedding vector Conditional flow matching network, used to match based on and Output conditional velocity prediction Integrating unit, used for... Integrating the signals yields the target residual signal. ;in, ; ; ; The reconstruction module is used to convert the semantic structure signal With the target residual signal The denoised ECG signal is obtained by adding them together. , and output.
2. The system as described in claim 1, characterized in that, The conditional flow matching network is a U-Net structure; within each residual block of the conditional flow matching network, time embedding vectors are used as the basis for the operation. Perform adaptive normalization, including: Scaling factor obtained by multilayer perceptron mapping With bias and intermediate features Modulation is performed according to the following formula: in, For weighted normalized convolution or deconvolution operations, For group normalization function, For activation function, For residual mapping used for channel alignment, For the autoregressive prediction network, the first... Layer output.
3. The system as described in claim 1 or 2, wherein the conditional flow matching network has a self-attention module at the bottleneck layer, used for based on the query matrix. Key matrix AND-value matrix Calculate self-attention value To enhance semantic structural signals Guided long-range time dependency modeling capabilities; among which, The feature dimension of a single attention head.
4. A training method for an electrocardiogram signal denoising system as described in any one of claims 1-3, characterized in that, include: The training will focus on pairs of noisy ECG signal segments. Corresponding clean electrocardiogram signal segments Input the ECG signal denoising system; To minimize the loss function The semantic structure extraction module is trained for the target; wherein, This represents the mean square error. The hyperparameters used to adjust the weights of the reconstruction loss and the autoregressive loss; The target residual signal is constructed using a noise injection unit. Constructing from the perturbation residual signal using path construction units To the target residual signal continuous transmission path And calculate the analytical velocity field To minimize the flow matching loss The conditional flow matching network is trained for the target; wherein, According to and Output conditional velocity prediction, for When it follows a uniform distribution on the interval [0,1] The expectation.
5. The method as described in claim 4, characterized in that, ; ; in, , , These are the upper and lower limits of the noise scale, respectively.
6. A method for denoising electrocardiogram (ECG) signals, characterized in that, include: The noisy ECG signal is input into the system as described in any one of claims 1-3 to obtain a denoised ECG signal.
7. An electronic device, characterized in that, include: Computer-readable storage media and processors; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the training method as described in claim 4 or 5 or the denoising method as described in claim 6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a processor to perform the training method as described in claim 4 or 5, or the denoising method as described in claim 6.
9. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the training method as described in claim 4 or 5, or the denoising method as described in claim 6.