ECG signal denoising method based on generative adversarial network
Through adversarial training of the generative adversarial network model, the generator and discriminator learn alternately, which solves the diagnostic interference problem of ECG signals under noise pollution and achieves high-precision denoising and low-cost intelligent ECG signal processing.
Patent Information
- Application Number
- CN202211178303.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-09-26
AI Technical Summary
ECG signals are easily contaminated by noise during the acquisition process, especially in remote monitoring scenarios. Noise interferes with diagnostic results, causing the signal to lose its medical value.
A generative adversarial network model is adopted. Through adversarial training of the generator and the discriminator, the generator generates denoised ECG signals, and the discriminator distinguishes between clean and denoised ECG signals. A fully convolutional mask denoising autoencoder and a convolutional neural network structure are used to retain local feature information and reduce the number of parameters.
The accuracy and intelligence of ECG signal denoising are improved, maintenance costs are reduced, the signal generated by the generator is close to the original clean signal, and the discrimination ability of the discriminator is enhanced.
Smart Images

Figure CN115429285B_ABST
Abstract
Description
Technical Field
[0001] The present invention is an electrocardiogram signal denoising method based on a generator and a discriminator. Background Art
[0002] The electrocardiogram (ECG) is an efficient, non-invasive, and low-cost indicator that is widely used for the effective analysis and diagnosis of cardiac arrhythmias. More than a century has passed since the Dutch physiologist Einthoven published a description of the human electrocardiogram recorded using a chord oscilloscope. The basic principles of the technology remain unchanged, and it has revolutionized the diagnosis and management of cardiac pathology. With the development of telemedicine, it is now possible to use remote ECG monitoring systems to monitor patients remotely in real time, providing information for the diagnosis and treatment of cardiovascular diseases. Specifically, remote ECG monitoring systems can monitor the patient's heart health in real time at home or other remote environments, and transmit sensor data to doctors in the hospital, improving the accuracy of early diagnosis of cardiovascular diseases and also having important reference value for the qualitative and quantitative analysis of arrhythmias.
[0003] However, ECG signals are weak bioelectric signals with low frequency and small amplitude. This makes them susceptible to various types of noise during actual acquisition, which can cause distortions in the ECG waveform. This is especially true in remote ECG monitoring scenarios, where the complex acquisition environment makes ECG signals more susceptible to noise compared to the strictly regulated medical environments of modern hospitals. This noise can interfere with doctors' diagnostics and potentially render the ECG signals ineffective. Medical value refers to the characteristic information contained in the signal itself, which doctors can use to diagnose heart health. Therefore, denoising the raw ECG signal is essential. Summary of the Invention
[0004] The implementation of the ECG signal denoising method based on the generative adversarial network includes the following steps:
[0005] Step 1: Perform generator training;
[0006] Step 2: Perform discriminator training;
[0007] Step 3: Conduct adversarial training;
[0008] Step 4: Generate signal.
[0009] Each step is explained in detail as follows.
[0010] 1. Generator training: The input signal passes through the generator, and the generator parameters are optimized by reducing the loss function. The generator loss function first uses a distance function. At the same time, because the local features of the ECG signal itself may contain some important medical information, these local features must be preserved as much as possible. Therefore, a local feature difference function is added to the generator loss function. Then, the generator's adversarial loss function is added. Finally, the three are combined to form the generator's loss function.
[0011] 2. The ECG signal generated by the generator and the clean ECG signal are used as the discriminator input, and the discriminator parameters are optimized by reducing the loss function. For the loss function of the discriminator, the original loss function of the generative adversarial network is used.
[0012] 3. Using adversarial training, the generator and discriminator are trained alternately until their loss functions stabilize. This creates an adversarial relationship between the generator and the discriminator. The generator hopes to deceive the discriminator with its generated ECG signals, while the discriminator hopes to accurately determine whether the input ECG data is pristine and clean. The two learn alternately to improve their capabilities.
[0013] 4. Finally, the generator generates a denoised ECG signal. Through adversarial training between the generator and the discriminator, the generator continuously learns the differences between the noisy input ECG signal and the original clean ECG signal. These differences are the characteristics of noise. The discriminator continuously learns and improves its ability to distinguish the original clean ECG signal. When the loss functions of the generator and discriminator gradually converge to a reasonable range, the generator has acquired the ability to denoise.
[0014] This invention utilizes a relatively novel ECG signal denoising model, and the proposed solution achieves the following: 1) By constructing a generator network and a discriminator network, sufficient preparation is provided for adversarial training. 2) The use of a structure based on a fully convolutional masked denoising autoencoder significantly reduces the number of parameters while preserving adjacent local spatial information. 3) The use of a discriminator based on a convolutional neural network helps distinguish between the denoised ECG signal generated by the generator and the original clean ECG signal, improving model accuracy. 4) This invention offers a high degree of intelligence and low maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 Flowchart of ECG signal denoising based on generative adversarial network.
[0016] Figure 2 Schematic diagram of the ECG signal denoising structure based on generative adversarial network.
[0017] Figure 3This is the generator structure diagram based on the fully convolutional mask denoising autoencoder.
[0018] Figure 4 This is the structure diagram of the discriminator based on convolutional neural network. DETAILED DESCRIPTION
[0019] In order to better highlight the advantages of the present invention, the research scheme of the present invention will be described in detail below in conjunction with the accompanying drawings.
[0020] Figure 2 As shown in the figure, the basic process of ECG signal denoising is demonstrated, and the main steps are introduced in detail as follows.
[0021] S1: The generator structure is as follows Figure 3 As shown, the overall structure is based on a fully convolutional multi-layer mask denoising autoencoder. The entire generator network consists of 11 layers and can be considered as two parts: the encoder and the decoder. In the encoder, the size of the ECG signal is reduced and encoded into low-dimensional features, while the decoder attempts to reconstruct the output based on these low-dimensional features. The following strategies are primarily adopted for this network.
[0022] S11: Based on the structure of a fully convolutional neural network (FCN), an FCN is a special CNN model. Unlike general CNN models, FCN removes the fully connected layers in CNN, reducing the number of parameters while allowing each output sample to retain local spatial information from adjacent input regions. Fully connected layers, on the other hand, cannot well preserve this information from previous layers. The generator uses a masked autoencoder structure to enhance network accuracy and robustness by randomly masking a section of the signal. Deep supervision is also used for loss calculation to improve network accuracy.
[0023] S12: The PReLU function is used as the activation function for the hidden layer in the network. The PReLU activation function can effectively avoid the vanishing gradient problem during training and reduce the amount of computation. However, the output layer of the fully convolutional model does not have an activation function.
[0024] S13: Batch normalization is performed before the activation function of each layer in the neural network. This ensures that the data output of each layer is uniformly distributed, improves network training efficiency, and makes the generated ECG signal closer to the original clean ECG signal.
[0025] S14: Each layer in the encoder includes a convolution layer, a batch normalization layer, and an activation layer. The initial input ECG signal size is 1024x1. After that, 20 convolution kernels of size 3x1 are used in the first and second layers with a stride of 2. Because of the early signal features, using smaller convolution kernels can minimize the information loss of the signal. The third and fourth layers both use 40 convolution kernels of size 6x1 with a stride of 2. Because the features in the later stages are high-level signal features, using larger convolution kernels can more effectively extract their features. The last layer uses a convolution kernel of size 6x1 with a stride of 1 because it uses a fully convolutional network without the fully connected layers in general convolutional neural networks.
[0026] S15: In the decoder, the convolution operation in the encoder that connects multiple input activations to a single activation is reversed, and a deconvolution layer is used to map a single input activation to multiple outputs. Finally, in the output layer, a convolution layer with a size of 3x1 and a stride of 1 is used to generate the output signal.
[0027] S2: The discriminator structure is as follows Figure 4 As shown, the discriminator network, based on a convolutional neural network, is designed to distinguish between the denoised ECG signals generated by the generator and the original clean ECG signals. The discriminator network consists of six layers, the first five of which are convolutional layers, and the last layer is a fully connected layer. Each of the first five layers in the discriminator includes a convolutional layer, a batch normalization layer, and an activation layer. The activation layer uses the PReLU activation function, which also prevents the vanishing gradient problem during training. The final fully connected layer uses a sigmoid activation function to output a probability value representing the probability that the input data is the original clean ECG signal rather than the denoised ECG signal generated by the generator.
[0028] S3: In the generative adversarial network model, the generator and discriminator continuously compete with each other, optimizing their respective network parameters through cross-training, and ultimately achieving convergence. To achieve better denoised ECG signals generated by the generator, even if the denoised ECG signals are closer to the original clean ECG signals, the discriminator must be able to better distinguish between the denoised ECG signals generated by the generator and the original clean ECG signals. If the discriminator's ability to distinguish is weak, the signal generated by the generator will also be poor. A pre-trained model is used for the discriminator, providing it with a set of optimized initial parameters to better define its task.
[0029] S4: Finally, the generator generates a denoised ECG signal. Through adversarial training between the generator and the discriminator, the generator continuously learns the differences between the noisy input ECG signal and the original clean ECG signal. These differences are the characteristics of noise. The discriminator continuously learns and improves its ability to distinguish the original clean ECG signal. When the loss functions of the generator and the discriminator gradually converge to a reasonable range, the generator has acquired the ability to denoise.
Claims
1. The denoising method of ECG signal includes the following steps: Step 1: Train the generator A deep neural network is formed by stacking multiple denoising mask encoders. First, the input signal is trained to obtain the first hidden layer according to the basic principles of denoising autoencoders, and the decoding part is discarded. Then, using the trained hidden layer as the input signal, the working principle of denoising autoencoders is used again to train a second hidden layer, and the decoding part is discarded again, until the stacked autoencoders are completed to form a multi-layer denoising autoencoder. The generator uses a masked autoencoder structure to enhance the network's accuracy and robustness by randomly masking a section of the signal, and uses deep supervision methods for loss calculation to improve network accuracy. The input signal passes through the generator and optimizes the generator parameters by reducing the loss function. A distance function is first used for the generator's loss function. The distance function components corresponding to L1~L6 are l d1 ~l d6 ,y k(di) represents the reference value (original clean signal) corresponding to the distance component of the kth round Li layer, and y′ represents the denoised signal generated by the generator: At the same time, since the local features of the ECG signal itself may contain some important medical information, in order to retain these local features as much as possible, the following formula is added to the generator's loss function: This formula represents the local feature difference between the denoised ECG signal and the original clean ECG signal; the local feature function components corresponding to L1~L6 are l m1 ~l m6 , according to the principle of generative adversarial networks, we define the adversarial loss of the generator as follows: l r =log(1-D γ (G θ (X))) Where G θ (X) represents the denoised ECG signal generated by the generator when the input is X and the parameter is θ, and D r (G θ (X)) indicates that the discriminator evaluates G when the parameter is γ. θ (X) is the probability that it comes from the original clean ECG signal rather than the generator’s result; Therefore, we define the generator's loss function as consisting of the following three parts, where α and β are weight parameters. Based on the optimization experiment of the loss function, the values of the two are finally determined: L G =l r +αl d +βl m Step 2: Perform discriminator training The ECG signal generated by the generator and the clean ECG signal are used as the discriminator input, and the discriminator parameters are optimized by reducing the loss function. For the discriminator loss function, the original loss function of the generative adversarial network is used: L D =-[log(D γ (s))+log(1-D γ (G θ (X)))] Among them D γ (Y) represents the probability that the discriminator evaluates that the input Y comes from the original clean ECG signal when the parameter is γ; Step 3: Conduct adversarial training The generator and discriminator are trained alternately using the idea of adversarial training until the loss functions of both are stable. The generator and the discriminator form an adversarial relationship. The generator hopes that the ECG signal it generates can deceive the discriminator, while the discriminator hopes to accurately determine whether the input ECG signal data is the original and clean ECG signal. The two learn alternately to improve their own abilities. Step 4: Generate a signal Finally, the generator generates a denoised ECG signal. Through adversarial training between the generator and the discriminator, the generator continuously learns the differences between the input noisy ECG signal and the original clean ECG signal, and these differences are the characteristics of the noise. The discriminator improves its ability to distinguish the original clean ECG signal through continuous learning. When the loss functions of the generator and the discriminator gradually converge to a reasonable range, the generator also acquires the denoising ability.
Citation Information
Patent Citations
Electrocardiosignal denoising method based on generative adversarial network and policy gradient
CN111067507A
Electroencephalogram signal denoising method based on residual generative adversarial network
CN113723171A