# An ECG Denoising Method Based on the Generative Adversarial Residual Network

Authors: Bingxin Xu; Ruixia Liu; Minglei Shu; Xiaoyi Shang; Yinglong Wang
Journal: Computational and Mathematical Methods in Medicine
 (2021)

---

## Abstract

High-quality and high-fidelity removal of noise in the Electrocardiogram (ECG) signal is of great significance to the auxiliary diagnosis of ECG diseases. In view of the single function of traditional denoising methods and the insufficient performance of signal details after denoising, a new method of ECG denoising based on the combination of the Generative Adversarial Network (GAN) and Residual Network is proposed. The method adopted in this paper is based on the GAN structure, and it restructures the generator and discriminator. In the generator network, residual blocks and Skip-Connecting are used to deepen the network structure and better capture the in-depth information in the ECG signal. In the discriminator network, the ResNet framework is used. In order to optimize the noise reduction process and solve the lack of local relevance considering the global ECG problem, the differential function and overall function of the maximum local difference are added in the loss function in this paper. The experimental results prove that the method used in this article has better performance than the current excellent S-Transform (S-T) algorithm, Wavelet Transform (WT) algorithm, Stacked Denoising Autoencoder (S-DAE) algorithm, and Improved Denoising Autoencoder (I-DAE) algorithm. Experiments show that the Root Mean Square Error (RMSE) of this method in the Massachusetts Institute of Technology and Beth Israel Hospital (MIT-BIH) noise pressure database is 0.0102, and the Signal-to-Noise Ratio (SNR) is 40.8526 dB, which is compared with that of the most advanced experimental methods. Our method improves the SNR by 88.57% on average. Besides the three noise intensities for comparison experiments, additional noise reduction experiments are also performed under four noise intensities in our paper. The experimental results verify the scientific nature of the model, which is that our method can effectively retain the important information conveyed by the original signal.


---

## Body

## 1. Introduction

As one of the main components of cardiovascular diseases, heart disease is extremely harmful, affecting patients’ normal life, and can be fatal. Electrocardiogram (ECG) is one of the main techniques for heart disease diagnosis [1, 2], which mainly reflects the electrical activity of the heart. When the heart is in good condition, it will show a regular ECG signal curve. Doctors can make a quick judgment on the heart condition by observing the shape, amplitude, and interval of continuous heartbeats of the waveform. This is the most effective and quickest method of monitoring [3, 4], classification [5, 6], and treatment of heart diseases. In practical application, we find that the collected ECG signal is often mixed with a lot of noise, which is not conducive to signal analysis. Therefore, the most important step in data processing is to denoise the collected signal so as to improve the usability of the signal.Traditional noise removal methods do have certain limitations in practical applications. The noise reduction methods and the types of noise removal are often in a one-to-one relationship, which cannot meet the actual needs of ECG signal noise reduction. For example, the Fourier Transform method [7] is usually used in the overall analysis of the signal. This method can reveal the correlation between the time domain and frequency domain signals. But at the same time, there are some requirements that cannot meet the local detailed analysis of the ECG signal. This Filtering method [7] can eliminate noise to a certain extent, but sometimes, the results of the Filtering effect are not satisfactory because the denoised ECG signal loses its medical value. Traditional ECG noise reduction methods include Spectrum Decomposition [8–10], Fourier Decomposition [11, 12], Filtering [13–15], Empirical Mode Decomposition [16], and Wavelet Transform (WT) [17, 18]. Obviously, the traditional noise reduction methods have poor adaptability to the type of noises, and their ability to capture local signals is also weak. Compared with other technologies, Filtering technology has a simpler noise reduction capability [19]. For example, a low-pass filter can only allow waveforms below a certain frequency to pass, and its true noise reduction capability is relatively simple.Deep learning has attracted more and more in-depth research studies in the field of ECG noise reduction. The representative ones are the Functional Link Neural Network (FLNN) [20], Wavelet Neural Network (WNN) [21], and Denoising Autoencoder (DAE) [22]. Among them, FLNN and WNN are the most widely used, but they can remove only one type of ECG signal. The Improved Wavelet Neural Network and WT have improved the single problem of the abovementioned noise reduction function and can remove the three kinds of noises of the ECG signal. However, through the observation of the experimental images, we found this method will make the ECG signal lose its medical value, thus not worth further studies. In addition, the Three-Hidden-Layer Feedforward Neural Network has achieved good results since the adaptability of the network to other noises is not discussed, but the experiment is only conducted on the electrocardiographic signal containing electromagnetic noise.We know through research that the current adversarial denoising is mainly applied in the direction of image noise reduction [23–25]. The more mature methods include the Conditional Generative Adversarial Network (CGAN) [26], Wasserstein Generative Adversarial Network (WGAN) [27], and Cyclic Generative Adversarial Network (Cycle-GAN) [28]. Research institutions adopt the adversarial idea to establish the image noise model. What is representative is that Divakar and Babu have a lot of thought on the image denoising work of GAN [29, 30]. Based on GAN, Fu et al. [31] and Zhao et al. [32] conducted in-depth research studies on image superresolution, which has been studied many times in recent years. Through experimental analysis, the advantages and disadvantages of different networks have been summarized, and a lot of work on visual images was done. DAE is an Autoencoder (AE) [33] input that imposes sparse constraints on hidden units. The advantage of the deep learning method is that it can learn features from the data itself without manual intervention, which is worth learning from.The Residual Network was proposed by He et al. [34] through the use of residual blocks to successfully train 152 layers of neural networks. The main idea of ResNet is to add a direct connection channel which is named Skip-Connecting [35]. Skip-Connecting can solve the problem of gradient disappearance in the case of a deep network layer and, at the same time, help the backpropagation of the gradient and speed up the training process. The entire model is trained with an end-to-end method, which simplifies the difficulties of model training.In terms of current research, the existing noise reduction methods have achieved satisfactory results, but there are still three shortcomings. One is the single function of the existing denoising methods, and their adaptability to various noises is not good enough. Second, the existing denoising methods tend to treat pathological information as noise in the denoising process, which may lose a lot of useful information and cause serious signal distortion. Third, the existing noise reduction network ignores the importance of the local correlation and global correlation of the ECG signal.This article is organized as follows. The second part lists the contributions. The third part describes the related work. In the fourth part, the denoising methods of ECG signals are discussed. The fifth part introduces the Generative Adversarial Residual Network denoising method in detail, and the sixth part shows the summary of this paper.


## 2. Contributions of This Article

This article summarizes the three shortcomings of current noise reduction technology and uses this as a research point to conduct the following research studies.Contributions of this paper are as follows.Firstly, a new method of ECG noise reduction is proposed. Based on the ability of adversarial networks to learn differences, we propose a method to use adversarial methods to establish a new ECG noise reduction view. The network designed with Residual Network in this paper can greatly improve the computing speed of GAN, and the Skip-Connecting structure in the residual block is used to promote the gradient disappearance during GAN training.Secondly, we have designed a new model that can remove multiple mixed noises, which overcomes the problem of the single function of traditional denoising methods. The proposed model has strong adaptability to various noises. It can remove the three common noise interferences and mixed noises in the ECG signal.Finally, in view of the shortcomings of the existing denoising methods that it is easy to treat pathological information as noises in the denoising process, the global difference function and maximum difference function are added to the loss function to improve the current situation. The local difference function can greatly capture the original local characteristics of the signal so that the medical features of the signal to be reduced can be preserved by adding the maximum difference function to capture the global features with good performance.


## 3. Problem

The performance of a complete heartbeat cycle on the ECG is shown in Figure1. The ECG signal contains six different types of waveforms: P, Q, R, S, T, and U [36]. However, noises are often included in the process of ECG signal acquisition, which will affect doctors’ diagnosis.Figure 1
A complete heartbeat cycle diagram.Common ECG noises include Electrode Motion Artifacts (EM), Muscle Artifacts (MA), and Baseline Wander (BW) [37, 38]. Figure 2 is a waveform diagram of a normal ECG signal (signal 213 in the MIT-BIH database as an example). Figure 3 shows the ECG signal image after adding three common noises.Figure 2
Normal clean ECG signal graph.Figure 3
ECG after adding EM, BW, and MA noise, respectively. (a) MA. (b) EM. (c) BW.
(a)(b)(c)We know that the problem of one-dimensional signal noise reduction can be described as(1)Xi=Si+Ni,i≥0,inspired by [39], where Xi represents a noisy signal, Si is a clean signal, and Ni represents a noise. The purpose of noise reduction is to suppress noise Ni so that the signal component in Xi tends to be Si. Since the ECG signal is a one-dimensional signal, we can derive the following equation:
(2)Si=Xi−Ni,i=0,1,2,⋯,where Xi=x1,x2,⋯,xk, Si=s1,s2,⋯,sk, and Ni=n1,n2,⋯,nk. They represent the noisy signal, clean signal, and noise represented by a one-dimensional vector. i represents the number of samples, and k represents the length of a sample. The idea of ECG noise reduction in this paper is to obtain high-quality clean signals Si from noisy signals Xi.


## 4. Methodology

In this section, we will introduce the experimental ideas of this article in three parts. Section4.1 describes the overall network framework used in this article. Section 4.2 introduces the loss function of this article. Section 4.3 systematically introduces the Generative Adversarial Residual Network used in this article. Table 1 is summarized for references.Table 1
Important mathematical symbols and their meanings in this paper.
Mathematical symbolDescriptionXiA signal containing noiseSiClean signalNiNoiseXiA signal with noise represented by a one-dimensional vectorSiA clean signal represented by a one-dimensional vectorNiNoise represented by a one-dimensional vectoriNumber of sampleskThe length of a samplePdataDistribution of the original clean dataPgThe distribution of the generated data for the generatorSOriginal clean signalS′The signal generated by the generatorXA signal containing noiseNNoiseGXThe signal generated by the generatorDGXThe discriminator network determines the probability that theGX signal comes from the original clean signal rather than the signal generated by the generatorLoriginalGenerate the original loss function of the networkLdistThe global difference function represents the global difference between the generated signal and the original signalLdist−maxThe local maximum difference function represents the maximum difference between the generated signal and the original clean signal to represent the local differenceαCoefficient ofLdistβCoefficient ofLdist−maxDSThe probability that the signalS is the original clean signal is obtained from the discriminator networkLGThe loss function of the generator networkLDThe loss function of the discriminator networkHxThe underlying mapping value of the expected outputFxResidualxThe input of the residual blockWConvolved with1∗1 operation, to adjust the dimensions of xSiOriginal clean signalS′iThe signal generated by the generatorINumber of samplesNormalizedMin-Max scalingXmaxThe maximum value ofxXminThe minimum value ofx


### 4.1. Overall Structure

GAN is proposed by Goodfellow [39]. It consists of a generator network and a discriminator network [37]. With noise from the signal generator into the network, the generator generates pseudorandom samples from close to the true input. The action discriminator is generated by the generator to distinguish true and false. The overall structure is shown in Figure 4. Like the original GAN paper [39], the green line represents the distribution of the denoised ECG data, the black dashed line represents the distribution of the original clean ECG data, and the blue dashed line represents the discriminator.Figure 4
The adversarial learning process of the GAN model. This figure can be understood as (a) an adversarial pair close to convergence, similar toPg and Pdata. The discriminator is used to judge whether the two distributions are the same. Then, the discriminator is trained. As shown in (b), the discriminator is continuously improving the ability to identify a clean ECG signal and denoising the raw ECG signal. In (c), as the adversarial progresses, the signal generated by the generator gradually approaches the original clean signal received in the discrimination. In (d), through enough feedback, the generator has the ability to compete with the discriminator.
(a)(b)(c)(d)We use the figure (Figure2) in [39] to explain the principle of signal noise reduction in this article. S is the original clean signal. S′ is the denoising ECG data generated by the generator. We will define the distributionPg of the generated data and the distribution Pdata of the clean raw data.In Figure5, we show this article’s proposed method. In this article, we add the residual block structure to the generator network, and in the discriminator network, we use the full ResNet architecture.Figure 5
The overall structure of the method in this paper.


### 4.2. Loss Function

The smaller the difference between the original clean signalS and the signal S′ obtained after noise reduction by the generator, the more similar the denoised signal is to the original clean signal, which can be expressed as
(3)GX=S′→a.c.a.pS=X−N.X is the signal with noise, S is the original clean signal, N is the noise, and S′ is the signal generated by the generator. According to the characteristics of the adversarial network, the generator and the discriminator learn the distribution of ECG noise through continuous games. The denoising of the ECG signal is completed through adversarial training. Then, the above formula is rewritten as
(4)GX=S′→a.c.a.pS=X−N.The original loss function of the generator is expressed as(5)Loriginal=log1−DGX.GX means that the noisy signal X is used as the input signal. DGX represents the probability that the discriminator network will determine the GX signal that comes from the original clean signal instead of the generator denoised signal.Considering that the difference between the signal generated by the generator network and the original clean signal reflects the noise reduction effect, it can be added to the loss function. UseLdist to represent the overall difference between the generated signal and the original signal. The overall difference function formula can be expressed as
(6)Ldist=∑i=1IS′k−Sk2.Local features play an important factor in measuring the effectiveness of denoising. Define the maximum generated difference signal with the original clean signal to a partial difference. The local maximum difference function is represented byLdist−max to be added to the loss function of the generating network. When Ldist−max is smaller, it means that the denoising ECG signal retains more original useful information. The formula is
(7)Ldist−max=maxS1′−S1,S2′−S2,⋯,Sk′−Sk.Therefore, the loss functionLG of the generator is defined as
(8)LG=Loriginal+αLdist+βLdist−max,where α=0.7 and β=0.2. The discriminator network is used to classify the generated signal from the original signal. Therefore, the definition uses the crossover loss function to represent the loss function of the discriminator network, which is expressed as
(9)LD=log11+DS+log1−11+DGX.DS represents the probability that the signal S obtained by the discriminator is the original clean signal. In the generator network loss function, by joining the local difference function to capture the signal local features and save useful medicine and by joining the overall difference functions to capture the performance of good stable global features and use the training process, the noise reduction of ECG signal partial correlation is solved and the noncomprehensive global correlation problem is considered. The generator may better understand the overall distribution of noise in the signal and local noise. Meanwhile, the ECG denoised signal is kept as the original clean signal as much as possible.


### 4.3. Generative Adversarial Residual Network

Figures6 and 7, respectively, describe the network structure of the generator and the discriminator. In this article, ten original clean signals are added to the SNR of 0 dB, 1.25 dB, and 5 dB to generate the noisy data needed for our experiment. For the entire Residual Network of the discriminator, the first layer of convolution uses a 3∗3 size template, the step size is 2, the padding is 3, and then Batch Normalization (BN), Rectified Linear Unit (ReLU), and Max pooling are performed. These constitute the first part of the convolution plate. From the first floor to the fourth floor, each floor is different, which is shown in detail in Figure 6. From Figure 8, we can see the residual Skip-Connecting structure in the Residual Network, some of which are solid lines and a small part are dashed lines. The solid line connection part means the number of channels is the same; that is, the figures are 3∗3∗64 feature maps. Since the number of channels is the same, the calculation method can be used as follows:
(10)Hx=Fx+x.Figure 6
The overall structure of the generator network.Figure 7
The overall structure of the discriminator network.Figure 8
The four-layer expansion structure of the discriminator network. (a) Schematic diagram of the layer 1 structure. (b) Schematic diagram of the layer 2 structure. (c) Schematic diagram of the layer 3 structure. (d) Schematic diagram of the layer 4 structure.
(a)(b)(c)(d)The dashed link part indicates that the number of channels is different. The feature map is connected from3∗3∗64 to 3∗3∗128. Since the number of channels is different, the calculation method is
(11)Hx=Fx+Wx.What is particularly important here is that the input of the residual block isx. After the first layer is linearly changed and activated, the residual Fx is the output. After the second layer is linearly changed, before activation, Fx is added to the input value x of this layer, and then the output is activated after activation. The path added to x before the activation of the second layer output is what we call Skip-Connecting. The underlying mapping value of the expected output is Hx. When the network has learned a more saturated accuracy, the so-called residual Fx=Hx−x. Then, we can say that the input x is similar to the output Hx, and the learning goal of this phenomenon is transformed into identity mapping learning. In formulas with different numbers of channels, W is a convolution operation with 1∗1, which is used to adjust the dimension of x.The Residual Network forms a basic residual block by adding Skip-Connecting on the original convolutional layer so that the learning ofHx is expressed as Hx=Fx+Wx. At the same time, the accumulation of the residual block structure solves the problem of small gradients or gradient explosions to a certain extent. The Skip-Connecting in the Residual Network breaks the layer-by-layer transfer characteristic of the traditional network. It is about learning the error rate for the entire model by superimposing a multilayer network problem rather than fall, but rise provides a new direction.


## 4.1. Overall Structure

GAN is proposed by Goodfellow [39]. It consists of a generator network and a discriminator network [37]. With noise from the signal generator into the network, the generator generates pseudorandom samples from close to the true input. The action discriminator is generated by the generator to distinguish true and false. The overall structure is shown in Figure 4. Like the original GAN paper [39], the green line represents the distribution of the denoised ECG data, the black dashed line represents the distribution of the original clean ECG data, and the blue dashed line represents the discriminator.Figure 4
The adversarial learning process of the GAN model. This figure can be understood as (a) an adversarial pair close to convergence, similar toPg and Pdata. The discriminator is used to judge whether the two distributions are the same. Then, the discriminator is trained. As shown in (b), the discriminator is continuously improving the ability to identify a clean ECG signal and denoising the raw ECG signal. In (c), as the adversarial progresses, the signal generated by the generator gradually approaches the original clean signal received in the discrimination. In (d), through enough feedback, the generator has the ability to compete with the discriminator.
(a)(b)(c)(d)We use the figure (Figure2) in [39] to explain the principle of signal noise reduction in this article. S is the original clean signal. S′ is the denoising ECG data generated by the generator. We will define the distributionPg of the generated data and the distribution Pdata of the clean raw data.In Figure5, we show this article’s proposed method. In this article, we add the residual block structure to the generator network, and in the discriminator network, we use the full ResNet architecture.Figure 5
The overall structure of the method in this paper.


## 4.2. Loss Function

The smaller the difference between the original clean signalS and the signal S′ obtained after noise reduction by the generator, the more similar the denoised signal is to the original clean signal, which can be expressed as
(3)GX=S′→a.c.a.pS=X−N.X is the signal with noise, S is the original clean signal, N is the noise, and S′ is the signal generated by the generator. According to the characteristics of the adversarial network, the generator and the discriminator learn the distribution of ECG noise through continuous games. The denoising of the ECG signal is completed through adversarial training. Then, the above formula is rewritten as
(4)GX=S′→a.c.a.pS=X−N.The original loss function of the generator is expressed as(5)Loriginal=log1−DGX.GX means that the noisy signal X is used as the input signal. DGX represents the probability that the discriminator network will determine the GX signal that comes from the original clean signal instead of the generator denoised signal.Considering that the difference between the signal generated by the generator network and the original clean signal reflects the noise reduction effect, it can be added to the loss function. UseLdist to represent the overall difference between the generated signal and the original signal. The overall difference function formula can be expressed as
(6)Ldist=∑i=1IS′k−Sk2.Local features play an important factor in measuring the effectiveness of denoising. Define the maximum generated difference signal with the original clean signal to a partial difference. The local maximum difference function is represented byLdist−max to be added to the loss function of the generating network. When Ldist−max is smaller, it means that the denoising ECG signal retains more original useful information. The formula is
(7)Ldist−max=maxS1′−S1,S2′−S2,⋯,Sk′−Sk.Therefore, the loss functionLG of the generator is defined as
(8)LG=Loriginal+αLdist+βLdist−max,where α=0.7 and β=0.2. The discriminator network is used to classify the generated signal from the original signal. Therefore, the definition uses the crossover loss function to represent the loss function of the discriminator network, which is expressed as
(9)LD=log11+DS+log1−11+DGX.DS represents the probability that the signal S obtained by the discriminator is the original clean signal. In the generator network loss function, by joining the local difference function to capture the signal local features and save useful medicine and by joining the overall difference functions to capture the performance of good stable global features and use the training process, the noise reduction of ECG signal partial correlation is solved and the noncomprehensive global correlation problem is considered. The generator may better understand the overall distribution of noise in the signal and local noise. Meanwhile, the ECG denoised signal is kept as the original clean signal as much as possible.


## 4.3. Generative Adversarial Residual Network

Figures6 and 7, respectively, describe the network structure of the generator and the discriminator. In this article, ten original clean signals are added to the SNR of 0 dB, 1.25 dB, and 5 dB to generate the noisy data needed for our experiment. For the entire Residual Network of the discriminator, the first layer of convolution uses a 3∗3 size template, the step size is 2, the padding is 3, and then Batch Normalization (BN), Rectified Linear Unit (ReLU), and Max pooling are performed. These constitute the first part of the convolution plate. From the first floor to the fourth floor, each floor is different, which is shown in detail in Figure 6. From Figure 8, we can see the residual Skip-Connecting structure in the Residual Network, some of which are solid lines and a small part are dashed lines. The solid line connection part means the number of channels is the same; that is, the figures are 3∗3∗64 feature maps. Since the number of channels is the same, the calculation method can be used as follows:
(10)Hx=Fx+x.Figure 6
The overall structure of the generator network.Figure 7
The overall structure of the discriminator network.Figure 8
The four-layer expansion structure of the discriminator network. (a) Schematic diagram of the layer 1 structure. (b) Schematic diagram of the layer 2 structure. (c) Schematic diagram of the layer 3 structure. (d) Schematic diagram of the layer 4 structure.
(a)(b)(c)(d)The dashed link part indicates that the number of channels is different. The feature map is connected from3∗3∗64 to 3∗3∗128. Since the number of channels is different, the calculation method is
(11)Hx=Fx+Wx.What is particularly important here is that the input of the residual block isx. After the first layer is linearly changed and activated, the residual Fx is the output. After the second layer is linearly changed, before activation, Fx is added to the input value x of this layer, and then the output is activated after activation. The path added to x before the activation of the second layer output is what we call Skip-Connecting. The underlying mapping value of the expected output is Hx. When the network has learned a more saturated accuracy, the so-called residual Fx=Hx−x. Then, we can say that the input x is similar to the output Hx, and the learning goal of this phenomenon is transformed into identity mapping learning. In formulas with different numbers of channels, W is a convolution operation with 1∗1, which is used to adjust the dimension of x.The Residual Network forms a basic residual block by adding Skip-Connecting on the original convolutional layer so that the learning ofHx is expressed as Hx=Fx+Wx. At the same time, the accumulation of the residual block structure solves the problem of small gradients or gradient explosions to a certain extent. The Skip-Connecting in the Residual Network breaks the layer-by-layer transfer characteristic of the traditional network. It is about learning the error rate for the entire model by superimposing a multilayer network problem rather than fall, but rise provides a new direction.


## 5. Results and Discussion

In this section, we will introduce the experiment in four parts. We explain in Section5.1 that we have an experimental environment, experimental parameters, and experimental datasets. In Section 5.2, we use different types of noise and different intensities to conduct experiments. Section 5.3 is a comparison between the experimental method of this paper and the results of the four most advanced methods. In Section 5.4, we did a verification experiment to prove that our method can achieve denoising efficiently and accurately.


### 5.1. Experimental Environment

#### 5.1.1. Experimental Configuration

This experiment is conducted on a workstation. There are 8 GPU nodes on this workstation, and each node is configured with 1 Tesla V100 (32 GB) and 48 GB of memory. Each node is a Compute Unified Device Architecture (CUDA) 10.1 environment. We are experimenting with code in py3.5-pytorch1.5.1-gpu. The computer model used in the experiment was Lenovo Legion Y7000P2020H. The CPU configuration is Intel i7-10750H 2.60 GHz. GPU is RTX2060. RAM is 16.0 GB. Storage is 1 TB SSD. The battery has 4 cells, and a 64-bit operating system, as well as an x64 processor, is adopted. The operating system is the home version of Windows 10.


#### 5.1.2. Performance Metrics

The evaluation index is based on the Root Mean Square Error (RMSE) and Signal-to-Noise Ratio (SNR), defined as follows:(12)RMSE=1i∑i=1ISi′−Si2,(13)SNR=10lg∑iISi2∑i=1ISi′−Si2.Si represents the original clean signal, S′i is the ECG signal after noise reduction processing, and i represents the number of sample points. RMSE describes the degree of similarity between the two data. The smaller the RMSE value, the smaller the difference between the two. SNR represents the ratio between the signal and the noise contained in the signal. The larger the SNR, the better the noise reduction effect.


#### 5.1.3. Datasets

The ECG signals used in this study are derived from the MIT-BIH arrhythmia database jointly established by the Massachusetts Institute of Technology and Beth Israel Hospital and the MIT-BIH noise stress test database of PhysioBank as the experimental dataset. The MIT-BIH arrhythmia database is the data for diagnosing arrhythmia. The library contains 48 fully labeled two-lead ECG datasets with a duration of 30 minutes. The record is digitized with a sampling frequency of 360 Hz per channel, and its resolution is 11 bits, indicating that the range exceeds 10 mV. This experiment selects EM, BW, and MA noise records from the MIT-BIH noise stress test database as noise data. These three categories represent the three main types of ECG noise. In the experimental part of this article, by setting different Signal-to-Noise Ratios, noise data is added to the original ECG signal for training and testing for subsequent experiments. In this experiment, ten groups of ECG records in MIT-BIH will be selected for the experiment; their numbers are 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230.Taking into account the learning characteristics of the neural network, the ECG signal is normalized by the normalization method:(14)NormalizedXk=Xk−XminXmax−Xmin.Xmax and Xmin represent the maximum and minimum values of x, respectively.According to the periodicity of the ECG signal, we can reasonably divide and use the recording of the ECG signal. Select 10 groups of original ECG signal data; each group of data has2∗650000 data points. In this article, we use the upper signal data for analysis and verification. When dividing samples, we consider that in order to ensure that each sample contains at least one ECG cycle (one ECG cycle has 310 sample points), the data is divided with 512 sample points as a cycle. The segmented data is added to 0 dB, 1.25 dB, and 5 dB noise intensity EM, MA, BW, EM+MA, EM+BW, BW+MA, and BW+EM+MA noise signals to form the training test required for the experiment. A total of 26649 experimental data, according to the trainingsettrainingset+validationset:testset=99:1:1 for the experiment.In the same way, the signal datasets numbered 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230 under EM noise are constructed in sequence.In the same way, construct a dataset of single noise (BW, MA), double noise (EM+MA, BW+MA, and BW+EM), and three noise (EM+MA+BW) superimposed in sequence.


#### 5.1.4. Training Parameters

After each convolutional layer in this article, BN is used before the activation function. The batch size is 64, and the learning rate is set to 0.1. When the training error is not shrinking, reduce the learning rate to one-tenth of the original and continue training. The training process is carried out for 200 rounds. When designing the building block for the residual function, we use a three-layer stack, which uses1∗1, 3∗3, and 1∗1 convolutions. Among them, 1∗1 convolution is used to reduce dimensionality and then increase dimensionality; that is, use 1∗1 convolution to solve problems with different dimensions. 3∗3 corresponds to a bottleneck; that is, fewer input and output dimensions can be achieved. In the experiment, the number of training samples of each type of noise is 23984; the total number of test samples is 2664.


### 5.2. Noise Reduction of Different Noise Types

Select 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230 records in the MIT-BIH arrhythmia database. Select EM, BW, and MA noise signals from the MIT-BIH noise stress test database and add them to each record with a SNR of 0 dB, 1.25 dB, and 5 dB. In addition, considering the mixing of multiple noise types, they are classified and named as EM+BW, EM+MA, BW+MA, and EM+BW+MA.Figure9 is the result of ECG denoising in our Generative Adversarial Residual Network model, including EM noise, BW noise, and MA noise. In the subpicture, the first row is the noisy ECG signal, the second row is the original clean ECG signal, and the third row is the clean signal after noise reduction. For a more intuitive comparison, we stack the effect pictures together, as shown in the fourth row of effect pictures. It can be seen from the figure that the denoised ECG signal can coincide well with the original ECG signal. These results show that our method has a very good effect on removing single noise.Figure 9
The effect of removing three types of single noise in the ECG signal. (a) The effect diagram of the ECG signal to remove MA noise. (b) The effect diagram of the ECG signal to remove BW noise. (c) The effect diagram of the ECG signal to remove EM noise.
(a)(b)(c)Figure10 depicts the result of ECG noise reduction used to remove mixed noise. The ECG signal types of mixed noise are divided into seven types in this article. The top line is the noise signal, the next is the original clean ECG signal, the bottom is the denoised ECG signal, and the last line is the visual superimposition effector graph. As shown in Figure 7, the signal after noise reduction can be highly coincident with the original signal. The experimental results show that our method has a good effect on the denoising of mixed noise.Figure 10
The effect of removing four types of mixed noise in the ECG signal. (a) The effect diagram of the ECG signal to remove BW+EM noise. (b) The effect diagram of the ECG signal to remove BW+MA noise. (c) The effect diagram of the ECG signal to remove EM+MA noise. (d) The effect diagram of the ECG signal to remove BW+EM+MA noise.
(a)(b)(c)(d)Table2 shows the average SNR and RMSE of the denoising results for different noise types. Ten groups of ECG signals are added to the noise reduction effect of 0 dB, 1.25 dB, and 5 dB under 7 kinds of noises. It can be seen from Table 2 that our model has achieved impressive results by adding different intensities of noise to the same noise environment with different types of noises. For a signal containing only one type of noise, our method can achieve a SNR of up to 66.9607 dB. For signals with mixed noises, this method can achieve a SNR of 62.5019 dB. When 0 dB noise is added, the highest SNR after noise reduction can reach 36.4455 dB. When SNR=1.25dB, the noise can reach 33.7478 dB after noise reduction. When SNR=5dB noise is added, the highest SNR after noise reduction can reach 66.9607 dB.Table 2
The average SNR and RMSE of the denoising results of different noise types.
Original SNREMBWMAEM+BWEM+MABW+MAEM+BW+MAAverage0 dBSNR28.426530.875536.445528.368328.340528.627427.863929.8497RMSE0.01760.00580.00870.01320.00370.01320.01280.01071.25 dBSNR32.863233.747831.167031.731031.911332.300931.772632.2134RMSE0.01210.01010.01570.01120.00890.01510.01450.01255 dBSNR60.018566.960757.680758.448059.548262.501958.845360.5719RMSE0.01090.00460.00650.00580.00680.00880.00760.0073


### 5.3. Comparison with Existing Methods

The S-T algorithm [40], WT algorithm [41], S-DAE algorithm, and I-DAE algorithm [22] are compared with our proposed method (P-M). Tables 3–5 show the result of SNR and RMSE of the different noise types (i.e., MA noise, EM noise, and BW noise) of the 10 records mentioned in Section 5.1. We observe that our proposed method achieves the highest SNR and the lowest RMSE average in all cases. The average SNR result of MA and BW can be above 30 dB; for EM noise, the average SNR result is more than 28 dB.Table 3
Noise reduction results of removing MA noise.
D-N103105111116122205213219223230AverageS-T0 dBSNR10.4110.028.218.199.28.328.7910.059.958.79.184RMSE0.3020.3160.3890.3890.3470.3840.3630.3140.3180.3670.34891.25 dBSNR10.8910.428.668.519.678.619.6710.6110.569.019.661RMSE0.2860.3010.3690.3750.3280.3710.3290.2950.2970.3550.33065 dBSNR12.6312.769.949.7511.699.9112.5312.8913.4410.1511.569RMSE0.2340.230.3180.3250.260.320.2360.2270.2130.3110.2674WT0 dBSNR19.6622.0920.0212.446.7121.2311.837.3318.5818.0315.79RMSE0.0440.0400.0500.1000.1820.0440.0960.1490.0550.0660.0831.25 dBSNR16.8722.4919.6914.407.4320.2413.278.6820.3218.8616.23RMSE0.0600.0390.0520.0800.1670.0490.0810.1270.0450.0600.0765 dBSNR15.7924.1118.8119.1511.1416.5118.9414.5521.4121.1418.16RMSE0.0670.0320.0570.0460.1090.0750.0420.0650.0400.0460.058S-DAE0 dBSNR18.9222.9722.9017.9217.9620.0318.1816.1820.2921.1119.65RMSE0.0460.0360.0360.0530.0470.0500.0440.0490.0430.0460.0451.25 dBSNR19.0723.3022.8818.4818.0920.0318.7017.6621.2121.2220.06RMSE0.0450.0350.0360.0490.0420.0500.0410.0440.0390.0450.0435 dBSNR19.3124.1222.9520.6121.7320.1420.1520.0523.6921.3321.41RMSE0.0440.0320.0350.0380.0310.0500.0360.0330.0290.0440.037I-DAE0 dBSNR21.3824.7223.1519.2219.5724.2319.5918.8022.9122.5821.62RMSE0.0340.0300.0350.0450.0400.0310.0380.0390.0320.0380.0361.25 dBSNR22.4124.8623.2720.2220.0224.4919.7819.6323.4122.6022.07RMSE0.0310.0290.0340.0400.0380.0300.0370.0340.0300.0380.0345 dBSNR23.3325.1323.3322.4120.6324.6720.6321.9724.2122.6322.89RMSE0.0270.0280.0340.0310.0360.0300.0340.0270.0280.0380.031P-M0 dBSNR37.205534.051731.819334.903043.203042.872134.210934.086035.687936.405636.4445RMSE0.00520.00330.01380.00520.00090.00760.01040.00900.00850.02270.00871.25 dBSNR32.303629.067326.947029.255439.623031.507033.295429.239429.064531.367831.1670RMSE0.01370.01670.01650.01410.01680.00350.02050.0116001410.02960.01575 dBSNR59.574256.489653.662556.713951.597258.663158.945557.723063.864059.574257.6807RMSE0.01550.00040.00710.00050.00620.00100.00920.00580.00390.01550.0065Table 4
Noise reduction results of removing EM noise.
D-N103105111116122205213219223230AverageS-T0 dBSNR6.416.135.455.475.875.595.836.056.216.295.932RMSE0.4780.4930.5340.5330.5090.5250.510.4980.4890.4840.50531.25 dBSNR7.477.356.46.326.966.477.067.177.457.487.013RMSE0.4230.4290.4780.4830.4490.4750.4440.4380.4240.4230.44665 dBSNR10.3210.48.548.329.608.5510.1210.0410.7410.459.708RMSE0.3050.3020.3740.3840.3310.3740.3120.3150.2900.3000.3287WT0 dBSNR9.5121.479.349.639.7118.2915.0213.1518.1111.9913.62RMSE0.1380.0440.1710.1380.1280.0630.0670.0760.0580.1320.1021.25 dBSNR10.3723.089.6510.569.5120.3015.8013.8521.1012.9314.72RMSE0.1250.0370.1650.1240.1320.0500.0610.0700.0400.1190.092SNR13.0728.3714.9613.778.6521.3619.2016.2021.0515.9117.555 dBRMSE0.0910.0200.0900.0860.1450.0430.0400.0540.0290.0840.068S-DAE0 dBSNR18.9423.4522.3319.1817.8720.0819.2017.5322.6620.7920.20RMSE0.0470.0350.0380.0460.0470.0500.0390.0450.0330.0480.0431.25 dBSNR19.0723.8222.4319.6918.9820.1119.7418.3223.2020.9120.63RMSE0.0460.0330.0380.0430.0420.0490.0370.0410.0310.0470.041SNR19.3024.5622.6621.0021.1620.2420.9820.0821.3921.4021.585 dBRMSE0.0410.0300.0370.0370.0330.0490.0330.0340.0270.0440.037I-DAE0 dBSNR22.7523.7023.390.03421.3417.7023.4719.3318.3823.1722.4021.56RMSE0.0290.0330.0350.0500.0330.0400.0410.0310.0390.0371.25 dBSNR22.9723.9423.5721.8218.7623.5719.7919.0723.5522.5421.96RMSE0.0290.0330.0330.0330.0420.0330.0370.0380.0300.0380.035SNR23.452406623.6523.0820.8123.6620.6921.0124.0022.8122.785 dBRMSE0.0270.0300.0330.0300.0350.0300.0340.0300.0280.0370.031P-M0 dBSNR28.670327.562824.270028.573735.968630.819826.730525.036925.049931.582428.4265RMSE0.01200.03440.02040.01170.01360.00790.03140.01100.01280.02050.01761.25 dBSNR35.461731.244627.082232.893339.538635.522030.236529.823531.058935.770332.8632RMSE0.0085000350.01660.01100.01350.00440.01930.01140.01390.01860.01215 dBSNR62.719453.752257.023659.023664.4991673957958.735860.074655.324260.822760.0185RMSE0.00300.01020.02290.02290.00770.01070.00110.01000.00100.01780.0109Table 5
Noise reduction results of removing BW noise.
D-N103105111116122205213219223230AverageS-T0 dBSNR11.411.569.229.0110.589.3111.5711.5512.1411.6810.802RMSE0.2690.2640.3460.3540.2960.3420.2640.2650.2470.2610.29081.25 dBSNR12.0612.239.619.3511.179.712.2212.2212.9512.3511.38RMSE0.2490.2450.3310.3410.2760.3270.2450.2450.2250.2410.27255 dBSNR13.5413.77104110.0412.3810.4613.7713.6514.813.8912.672RMSE0.210.2050.3020.3150.240.30.2050.20810.1820.2020.2369WT0 dBSNR14.8731.5318.4120.009.1222.6420.8318.6917.3422.2319.57RMSE0.0740.0140.0600.0420.1380.0370.0340.0400.0630.0410.0541.25 dBSNR14.8831.9118.4220.068.5422.7320.4720.2217.4022.2219.69RMSE0.0740.0130.0600.0420.1470.0370.0360.0340.0630.0410.055SNR14.9032.7118.4320.108.2222.9119.1121.4417.5122.1819.755 dBRMSE0.0740.0120.0600.0410.1530.0360.0420.0290.0620.0410.055S-DAE0 dBSNR20.3824.9023.0418.8419.4820.0819.9219.3022.9420.5320.94RMSE0.0380.0290.0350.0470.0400.0500.0360.0370.0310.0490.0391.25 dBSNR20.5523.2723.0719.5319.9020.1220.3219.8323.7420.6721.30RMSE0.0380.0280.0350.0430.0380.0490.0350.0350.0290.0480.0385 dBSNR20.7725.4723.0321.3021.0020.3021.3421.1525.4121.0322.11RMSE0.0370.0270.0350.0340.0340.0480.0310.0300.0240.0460.035I-DAE0 dBSNR23.7825.4023.3123.5120.0720.0721.3023.0224.2522.7222.74RMSE0.0260.0280.0340.0270.0500.0500.0320.0240.0270.0370.0341.25 dBSNR23.8225.4223.3223.5920.0820.0821.3623.3124.4122.7422.81RMSE0.0260.0280.0340.0270.0500.0500.0320.0230.0270.0370.033SNR23.8925.4523.3523.7620.0820.0821.4624.0824.6422.7922.965 dBRMSE0.0250.0270.0340.0260.0500.0500.0310.0210.0260.0040.033P-M0 dBSNR29.768329.666328.379429.795138.254128.508733.087727.309230.173033.813230.8755RMSE0.00430.00330.00930.00290.00310.00640.00670.00880.00670.00660.00581.25 dBSNR36.010534.624831.559333.972941.272628.595633.619430.738732.254534.8294433.7478RMSE0.01350.00320.01110.00870..0147001830.00930.00750.00750.00690.0101SNR67.791262.176663.473662.202469.248470.656470.077964.334768.272971.372566.96075 dBRMSE0.00130.00200.00070.01050.00040.00130.00060.01030.00070.01720.0040In Figures11–13, we assume that the input signal contains MA noise, EM noise, and BW noise, and the SNR is 1.25 dB. From Figures 9, 10, and 14, we can see that our proposed method all achieves the highest SNR. Specifically, most of the average SNR reached 28 dB.Figure 11
Comparison of SNR of different methods for BW noise with a SNR of 1.25 dB.Figure 12
Comparison of SNR of different methods for EM noise with a SNR of 1.25 dB.Figure 13
Comparison of SNR of different methods for MA noise with a SNR of 1.25 dB.Figure 14
ResNet’s residual learning block.In order to verify the network model, the following two sets of verification experiments are carried out. The experimental results are shown in Figures15 and 16. Figure 15 shows the noise reduction effect of different ECG signals with the same noise type under different noise intensity interferences. Figure 16 is a graph of the noise reduction effect for the same ECG signal with different types and different intensities of noises. As shown in Figures 15 and 16, we can see that our network model performs well in removing single noises or mixed noises. It shows good performance for various noises and multiple intensity types of noises. Our model overcomes the singularity of traditional noise reduction functions, and the method proposed in this article can remove multiple noises.Figure 15
The average noise reduction effect of seven kinds of noises in ten groups of ECG signals.Figure 16
The average noise reduction results of ten groups of ECG signals under various noises.


### 5.4. Model Noise Reduction Effect Verification

In addition to adding the traditional 0 dB, 1.25 dB, and 5 dB, this article also has data of 1 dB, 2 dB, 3 dB, and 4 dB for effect verification, and the experimental results are all good. The experimental data is shown in Table6. It can be seen that the model in this article has a good noise reduction effect on noise with different SNR and is applicable to data with different noise types.Table 6
Model experiment results under different noise types and different noise intensities.
SNR/noise typeMAEMBWSNRRMSESNRRMSESNRRMSE0 dB34.39560.000234.40560.000334.18100.00041 dB38.12680.000637.18360.000337.63230.00071.25 dB31.12820.001831.40570.000831.15450.00162 dB40.26120.000939.24380.000840.16730.00093 dB42.26120.000943.56930.000243.65020.00064 dB46.28730.000445.69120.000540.40560.00065 dB51.11280.000953.22460.001152.24590.0010Average40.50790.000740.67050.000541.30080.0009Previous work used the methods of Decomposition, Transformation, and Filtering to denoise the ECG signal. However, these studies have three shortcomings. First, the existing noise reduction methods do not take into account the locality and global correlation of ECG signals. Second, the adaptability to various noises is not good enough. Third, it may trigger severe signal distortion in the course of this research. We have established our experimental methods in accordance with the above three shortcomings. This paper establishes a new point of view with adversarial methods; that is, adversarial methods have the ability to learn the difference between input and output. This view makes it possible to denoise ECG signals with adversarial methods. We addedLdist and Ldist−max to the loss function of the generated network to increase the local and overall grasp of the noise reduction signal. We propose an adversarial ECG signal denoising method, and our method has an excellent denoising effect for all kinds of noisy signals. A large number of experiments verify the superiority of the model’s noise reduction effect. As shown in Table 7, our method improves the SNR by 88.57% on average.Table 7
Compared with the most advanced method, the noise reduction effect of this experimental method is improved by percentage.
SNR/noise typeMA noiseEM noiseBW noise0 dB68.57%31.85%35.77%1.25 dB41.23%49.65%47.95%5 dB151.99%163.47%191.64%Average87.26%86.66%91.79%


## 5.1. Experimental Environment

### 5.1.1. Experimental Configuration

This experiment is conducted on a workstation. There are 8 GPU nodes on this workstation, and each node is configured with 1 Tesla V100 (32 GB) and 48 GB of memory. Each node is a Compute Unified Device Architecture (CUDA) 10.1 environment. We are experimenting with code in py3.5-pytorch1.5.1-gpu. The computer model used in the experiment was Lenovo Legion Y7000P2020H. The CPU configuration is Intel i7-10750H 2.60 GHz. GPU is RTX2060. RAM is 16.0 GB. Storage is 1 TB SSD. The battery has 4 cells, and a 64-bit operating system, as well as an x64 processor, is adopted. The operating system is the home version of Windows 10.


### 5.1.2. Performance Metrics

The evaluation index is based on the Root Mean Square Error (RMSE) and Signal-to-Noise Ratio (SNR), defined as follows:(12)RMSE=1i∑i=1ISi′−Si2,(13)SNR=10lg∑iISi2∑i=1ISi′−Si2.Si represents the original clean signal, S′i is the ECG signal after noise reduction processing, and i represents the number of sample points. RMSE describes the degree of similarity between the two data. The smaller the RMSE value, the smaller the difference between the two. SNR represents the ratio between the signal and the noise contained in the signal. The larger the SNR, the better the noise reduction effect.


### 5.1.3. Datasets

The ECG signals used in this study are derived from the MIT-BIH arrhythmia database jointly established by the Massachusetts Institute of Technology and Beth Israel Hospital and the MIT-BIH noise stress test database of PhysioBank as the experimental dataset. The MIT-BIH arrhythmia database is the data for diagnosing arrhythmia. The library contains 48 fully labeled two-lead ECG datasets with a duration of 30 minutes. The record is digitized with a sampling frequency of 360 Hz per channel, and its resolution is 11 bits, indicating that the range exceeds 10 mV. This experiment selects EM, BW, and MA noise records from the MIT-BIH noise stress test database as noise data. These three categories represent the three main types of ECG noise. In the experimental part of this article, by setting different Signal-to-Noise Ratios, noise data is added to the original ECG signal for training and testing for subsequent experiments. In this experiment, ten groups of ECG records in MIT-BIH will be selected for the experiment; their numbers are 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230.Taking into account the learning characteristics of the neural network, the ECG signal is normalized by the normalization method:(14)NormalizedXk=Xk−XminXmax−Xmin.Xmax and Xmin represent the maximum and minimum values of x, respectively.According to the periodicity of the ECG signal, we can reasonably divide and use the recording of the ECG signal. Select 10 groups of original ECG signal data; each group of data has2∗650000 data points. In this article, we use the upper signal data for analysis and verification. When dividing samples, we consider that in order to ensure that each sample contains at least one ECG cycle (one ECG cycle has 310 sample points), the data is divided with 512 sample points as a cycle. The segmented data is added to 0 dB, 1.25 dB, and 5 dB noise intensity EM, MA, BW, EM+MA, EM+BW, BW+MA, and BW+EM+MA noise signals to form the training test required for the experiment. A total of 26649 experimental data, according to the trainingsettrainingset+validationset:testset=99:1:1 for the experiment.In the same way, the signal datasets numbered 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230 under EM noise are constructed in sequence.In the same way, construct a dataset of single noise (BW, MA), double noise (EM+MA, BW+MA, and BW+EM), and three noise (EM+MA+BW) superimposed in sequence.


### 5.1.4. Training Parameters

After each convolutional layer in this article, BN is used before the activation function. The batch size is 64, and the learning rate is set to 0.1. When the training error is not shrinking, reduce the learning rate to one-tenth of the original and continue training. The training process is carried out for 200 rounds. When designing the building block for the residual function, we use a three-layer stack, which uses1∗1, 3∗3, and 1∗1 convolutions. Among them, 1∗1 convolution is used to reduce dimensionality and then increase dimensionality; that is, use 1∗1 convolution to solve problems with different dimensions. 3∗3 corresponds to a bottleneck; that is, fewer input and output dimensions can be achieved. In the experiment, the number of training samples of each type of noise is 23984; the total number of test samples is 2664.


## 5.1.1. Experimental Configuration

This experiment is conducted on a workstation. There are 8 GPU nodes on this workstation, and each node is configured with 1 Tesla V100 (32 GB) and 48 GB of memory. Each node is a Compute Unified Device Architecture (CUDA) 10.1 environment. We are experimenting with code in py3.5-pytorch1.5.1-gpu. The computer model used in the experiment was Lenovo Legion Y7000P2020H. The CPU configuration is Intel i7-10750H 2.60 GHz. GPU is RTX2060. RAM is 16.0 GB. Storage is 1 TB SSD. The battery has 4 cells, and a 64-bit operating system, as well as an x64 processor, is adopted. The operating system is the home version of Windows 10.


## 5.1.2. Performance Metrics

The evaluation index is based on the Root Mean Square Error (RMSE) and Signal-to-Noise Ratio (SNR), defined as follows:(12)RMSE=1i∑i=1ISi′−Si2,(13)SNR=10lg∑iISi2∑i=1ISi′−Si2.Si represents the original clean signal, S′i is the ECG signal after noise reduction processing, and i represents the number of sample points. RMSE describes the degree of similarity between the two data. The smaller the RMSE value, the smaller the difference between the two. SNR represents the ratio between the signal and the noise contained in the signal. The larger the SNR, the better the noise reduction effect.


## 5.1.3. Datasets

The ECG signals used in this study are derived from the MIT-BIH arrhythmia database jointly established by the Massachusetts Institute of Technology and Beth Israel Hospital and the MIT-BIH noise stress test database of PhysioBank as the experimental dataset. The MIT-BIH arrhythmia database is the data for diagnosing arrhythmia. The library contains 48 fully labeled two-lead ECG datasets with a duration of 30 minutes. The record is digitized with a sampling frequency of 360 Hz per channel, and its resolution is 11 bits, indicating that the range exceeds 10 mV. This experiment selects EM, BW, and MA noise records from the MIT-BIH noise stress test database as noise data. These three categories represent the three main types of ECG noise. In the experimental part of this article, by setting different Signal-to-Noise Ratios, noise data is added to the original ECG signal for training and testing for subsequent experiments. In this experiment, ten groups of ECG records in MIT-BIH will be selected for the experiment; their numbers are 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230.Taking into account the learning characteristics of the neural network, the ECG signal is normalized by the normalization method:(14)NormalizedXk=Xk−XminXmax−Xmin.Xmax and Xmin represent the maximum and minimum values of x, respectively.According to the periodicity of the ECG signal, we can reasonably divide and use the recording of the ECG signal. Select 10 groups of original ECG signal data; each group of data has2∗650000 data points. In this article, we use the upper signal data for analysis and verification. When dividing samples, we consider that in order to ensure that each sample contains at least one ECG cycle (one ECG cycle has 310 sample points), the data is divided with 512 sample points as a cycle. The segmented data is added to 0 dB, 1.25 dB, and 5 dB noise intensity EM, MA, BW, EM+MA, EM+BW, BW+MA, and BW+EM+MA noise signals to form the training test required for the experiment. A total of 26649 experimental data, according to the trainingsettrainingset+validationset:testset=99:1:1 for the experiment.In the same way, the signal datasets numbered 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230 under EM noise are constructed in sequence.In the same way, construct a dataset of single noise (BW, MA), double noise (EM+MA, BW+MA, and BW+EM), and three noise (EM+MA+BW) superimposed in sequence.


## 5.1.4. Training Parameters

After each convolutional layer in this article, BN is used before the activation function. The batch size is 64, and the learning rate is set to 0.1. When the training error is not shrinking, reduce the learning rate to one-tenth of the original and continue training. The training process is carried out for 200 rounds. When designing the building block for the residual function, we use a three-layer stack, which uses1∗1, 3∗3, and 1∗1 convolutions. Among them, 1∗1 convolution is used to reduce dimensionality and then increase dimensionality; that is, use 1∗1 convolution to solve problems with different dimensions. 3∗3 corresponds to a bottleneck; that is, fewer input and output dimensions can be achieved. In the experiment, the number of training samples of each type of noise is 23984; the total number of test samples is 2664.


## 5.2. Noise Reduction of Different Noise Types

Select 103, 105, 111, 116, 122, 205, 213, 219, 223, and 230 records in the MIT-BIH arrhythmia database. Select EM, BW, and MA noise signals from the MIT-BIH noise stress test database and add them to each record with a SNR of 0 dB, 1.25 dB, and 5 dB. In addition, considering the mixing of multiple noise types, they are classified and named as EM+BW, EM+MA, BW+MA, and EM+BW+MA.Figure9 is the result of ECG denoising in our Generative Adversarial Residual Network model, including EM noise, BW noise, and MA noise. In the subpicture, the first row is the noisy ECG signal, the second row is the original clean ECG signal, and the third row is the clean signal after noise reduction. For a more intuitive comparison, we stack the effect pictures together, as shown in the fourth row of effect pictures. It can be seen from the figure that the denoised ECG signal can coincide well with the original ECG signal. These results show that our method has a very good effect on removing single noise.Figure 9
The effect of removing three types of single noise in the ECG signal. (a) The effect diagram of the ECG signal to remove MA noise. (b) The effect diagram of the ECG signal to remove BW noise. (c) The effect diagram of the ECG signal to remove EM noise.
(a)(b)(c)Figure10 depicts the result of ECG noise reduction used to remove mixed noise. The ECG signal types of mixed noise are divided into seven types in this article. The top line is the noise signal, the next is the original clean ECG signal, the bottom is the denoised ECG signal, and the last line is the visual superimposition effector graph. As shown in Figure 7, the signal after noise reduction can be highly coincident with the original signal. The experimental results show that our method has a good effect on the denoising of mixed noise.Figure 10
The effect of removing four types of mixed noise in the ECG signal. (a) The effect diagram of the ECG signal to remove BW+EM noise. (b) The effect diagram of the ECG signal to remove BW+MA noise. (c) The effect diagram of the ECG signal to remove EM+MA noise. (d) The effect diagram of the ECG signal to remove BW+EM+MA noise.
(a)(b)(c)(d)Table2 shows the average SNR and RMSE of the denoising results for different noise types. Ten groups of ECG signals are added to the noise reduction effect of 0 dB, 1.25 dB, and 5 dB under 7 kinds of noises. It can be seen from Table 2 that our model has achieved impressive results by adding different intensities of noise to the same noise environment with different types of noises. For a signal containing only one type of noise, our method can achieve a SNR of up to 66.9607 dB. For signals with mixed noises, this method can achieve a SNR of 62.5019 dB. When 0 dB noise is added, the highest SNR after noise reduction can reach 36.4455 dB. When SNR=1.25dB, the noise can reach 33.7478 dB after noise reduction. When SNR=5dB noise is added, the highest SNR after noise reduction can reach 66.9607 dB.Table 2
The average SNR and RMSE of the denoising results of different noise types.
Original SNREMBWMAEM+BWEM+MABW+MAEM+BW+MAAverage0 dBSNR28.426530.875536.445528.368328.340528.627427.863929.8497RMSE0.01760.00580.00870.01320.00370.01320.01280.01071.25 dBSNR32.863233.747831.167031.731031.911332.300931.772632.2134RMSE0.01210.01010.01570.01120.00890.01510.01450.01255 dBSNR60.018566.960757.680758.448059.548262.501958.845360.5719RMSE0.01090.00460.00650.00580.00680.00880.00760.0073


## 5.3. Comparison with Existing Methods

The S-T algorithm [40], WT algorithm [41], S-DAE algorithm, and I-DAE algorithm [22] are compared with our proposed method (P-M). Tables 3–5 show the result of SNR and RMSE of the different noise types (i.e., MA noise, EM noise, and BW noise) of the 10 records mentioned in Section 5.1. We observe that our proposed method achieves the highest SNR and the lowest RMSE average in all cases. The average SNR result of MA and BW can be above 30 dB; for EM noise, the average SNR result is more than 28 dB.Table 3
Noise reduction results of removing MA noise.
D-N103105111116122205213219223230AverageS-T0 dBSNR10.4110.028.218.199.28.328.7910.059.958.79.184RMSE0.3020.3160.3890.3890.3470.3840.3630.3140.3180.3670.34891.25 dBSNR10.8910.428.668.519.678.619.6710.6110.569.019.661RMSE0.2860.3010.3690.3750.3280.3710.3290.2950.2970.3550.33065 dBSNR12.6312.769.949.7511.699.9112.5312.8913.4410.1511.569RMSE0.2340.230.3180.3250.260.320.2360.2270.2130.3110.2674WT0 dBSNR19.6622.0920.0212.446.7121.2311.837.3318.5818.0315.79RMSE0.0440.0400.0500.1000.1820.0440.0960.1490.0550.0660.0831.25 dBSNR16.8722.4919.6914.407.4320.2413.278.6820.3218.8616.23RMSE0.0600.0390.0520.0800.1670.0490.0810.1270.0450.0600.0765 dBSNR15.7924.1118.8119.1511.1416.5118.9414.5521.4121.1418.16RMSE0.0670.0320.0570.0460.1090.0750.0420.0650.0400.0460.058S-DAE0 dBSNR18.9222.9722.9017.9217.9620.0318.1816.1820.2921.1119.65RMSE0.0460.0360.0360.0530.0470.0500.0440.0490.0430.0460.0451.25 dBSNR19.0723.3022.8818.4818.0920.0318.7017.6621.2121.2220.06RMSE0.0450.0350.0360.0490.0420.0500.0410.0440.0390.0450.0435 dBSNR19.3124.1222.9520.6121.7320.1420.1520.0523.6921.3321.41RMSE0.0440.0320.0350.0380.0310.0500.0360.0330.0290.0440.037I-DAE0 dBSNR21.3824.7223.1519.2219.5724.2319.5918.8022.9122.5821.62RMSE0.0340.0300.0350.0450.0400.0310.0380.0390.0320.0380.0361.25 dBSNR22.4124.8623.2720.2220.0224.4919.7819.6323.4122.6022.07RMSE0.0310.0290.0340.0400.0380.0300.0370.0340.0300.0380.0345 dBSNR23.3325.1323.3322.4120.6324.6720.6321.9724.2122.6322.89RMSE0.0270.0280.0340.0310.0360.0300.0340.0270.0280.0380.031P-M0 dBSNR37.205534.051731.819334.903043.203042.872134.210934.086035.687936.405636.4445RMSE0.00520.00330.01380.00520.00090.00760.01040.00900.00850.02270.00871.25 dBSNR32.303629.067326.947029.255439.623031.507033.295429.239429.064531.367831.1670RMSE0.01370.01670.01650.01410.01680.00350.02050.0116001410.02960.01575 dBSNR59.574256.489653.662556.713951.597258.663158.945557.723063.864059.574257.6807RMSE0.01550.00040.00710.00050.00620.00100.00920.00580.00390.01550.0065Table 4
Noise reduction results of removing EM noise.
D-N103105111116122205213219223230AverageS-T0 dBSNR6.416.135.455.475.875.595.836.056.216.295.932RMSE0.4780.4930.5340.5330.5090.5250.510.4980.4890.4840.50531.25 dBSNR7.477.356.46.326.966.477.067.177.457.487.013RMSE0.4230.4290.4780.4830.4490.4750.4440.4380.4240.4230.44665 dBSNR10.3210.48.548.329.608.5510.1210.0410.7410.459.708RMSE0.3050.3020.3740.3840.3310.3740.3120.3150.2900.3000.3287WT0 dBSNR9.5121.479.349.639.7118.2915.0213.1518.1111.9913.62RMSE0.1380.0440.1710.1380.1280.0630.0670.0760.0580.1320.1021.25 dBSNR10.3723.089.6510.569.5120.3015.8013.8521.1012.9314.72RMSE0.1250.0370.1650.1240.1320.0500.0610.0700.0400.1190.092SNR13.0728.3714.9613.778.6521.3619.2016.2021.0515.9117.555 dBRMSE0.0910.0200.0900.0860.1450.0430.0400.0540.0290.0840.068S-DAE0 dBSNR18.9423.4522.3319.1817.8720.0819.2017.5322.6620.7920.20RMSE0.0470.0350.0380.0460.0470.0500.0390.0450.0330.0480.0431.25 dBSNR19.0723.8222.4319.6918.9820.1119.7418.3223.2020.9120.63RMSE0.0460.0330.0380.0430.0420.0490.0370.0410.0310.0470.041SNR19.3024.5622.6621.0021.1620.2420.9820.0821.3921.4021.585 dBRMSE0.0410.0300.0370.0370.0330.0490.0330.0340.0270.0440.037I-DAE0 dBSNR22.7523.7023.390.03421.3417.7023.4719.3318.3823.1722.4021.56RMSE0.0290.0330.0350.0500.0330.0400.0410.0310.0390.0371.25 dBSNR22.9723.9423.5721.8218.7623.5719.7919.0723.5522.5421.96RMSE0.0290.0330.0330.0330.0420.0330.0370.0380.0300.0380.035SNR23.452406623.6523.0820.8123.6620.6921.0124.0022.8122.785 dBRMSE0.0270.0300.0330.0300.0350.0300.0340.0300.0280.0370.031P-M0 dBSNR28.670327.562824.270028.573735.968630.819826.730525.036925.049931.582428.4265RMSE0.01200.03440.02040.01170.01360.00790.03140.01100.01280.02050.01761.25 dBSNR35.461731.244627.082232.893339.538635.522030.236529.823531.058935.770332.8632RMSE0.0085000350.01660.01100.01350.00440.01930.01140.01390.01860.01215 dBSNR62.719453.752257.023659.023664.4991673957958.735860.074655.324260.822760.0185RMSE0.00300.01020.02290.02290.00770.01070.00110.01000.00100.01780.0109Table 5
Noise reduction results of removing BW noise.
D-N103105111116122205213219223230AverageS-T0 dBSNR11.411.569.229.0110.589.3111.5711.5512.1411.6810.802RMSE0.2690.2640.3460.3540.2960.3420.2640.2650.2470.2610.29081.25 dBSNR12.0612.239.619.3511.179.712.2212.2212.9512.3511.38RMSE0.2490.2450.3310.3410.2760.3270.2450.2450.2250.2410.27255 dBSNR13.5413.77104110.0412.3810.4613.7713.6514.813.8912.672RMSE0.210.2050.3020.3150.240.30.2050.20810.1820.2020.2369WT0 dBSNR14.8731.5318.4120.009.1222.6420.8318.6917.3422.2319.57RMSE0.0740.0140.0600.0420.1380.0370.0340.0400.0630.0410.0541.25 dBSNR14.8831.9118.4220.068.5422.7320.4720.2217.4022.2219.69RMSE0.0740.0130.0600.0420.1470.0370.0360.0340.0630.0410.055SNR14.9032.7118.4320.108.2222.9119.1121.4417.5122.1819.755 dBRMSE0.0740.0120.0600.0410.1530.0360.0420.0290.0620.0410.055S-DAE0 dBSNR20.3824.9023.0418.8419.4820.0819.9219.3022.9420.5320.94RMSE0.0380.0290.0350.0470.0400.0500.0360.0370.0310.0490.0391.25 dBSNR20.5523.2723.0719.5319.9020.1220.3219.8323.7420.6721.30RMSE0.0380.0280.0350.0430.0380.0490.0350.0350.0290.0480.0385 dBSNR20.7725.4723.0321.3021.0020.3021.3421.1525.4121.0322.11RMSE0.0370.0270.0350.0340.0340.0480.0310.0300.0240.0460.035I-DAE0 dBSNR23.7825.4023.3123.5120.0720.0721.3023.0224.2522.7222.74RMSE0.0260.0280.0340.0270.0500.0500.0320.0240.0270.0370.0341.25 dBSNR23.8225.4223.3223.5920.0820.0821.3623.3124.4122.7422.81RMSE0.0260.0280.0340.0270.0500.0500.0320.0230.0270.0370.033SNR23.8925.4523.3523.7620.0820.0821.4624.0824.6422.7922.965 dBRMSE0.0250.0270.0340.0260.0500.0500.0310.0210.0260.0040.033P-M0 dBSNR29.768329.666328.379429.795138.254128.508733.087727.309230.173033.813230.8755RMSE0.00430.00330.00930.00290.00310.00640.00670.00880.00670.00660.00581.25 dBSNR36.010534.624831.559333.972941.272628.595633.619430.738732.254534.8294433.7478RMSE0.01350.00320.01110.00870..0147001830.00930.00750.00750.00690.0101SNR67.791262.176663.473662.202469.248470.656470.077964.334768.272971.372566.96075 dBRMSE0.00130.00200.00070.01050.00040.00130.00060.01030.00070.01720.0040In Figures11–13, we assume that the input signal contains MA noise, EM noise, and BW noise, and the SNR is 1.25 dB. From Figures 9, 10, and 14, we can see that our proposed method all achieves the highest SNR. Specifically, most of the average SNR reached 28 dB.Figure 11
Comparison of SNR of different methods for BW noise with a SNR of 1.25 dB.Figure 12
Comparison of SNR of different methods for EM noise with a SNR of 1.25 dB.Figure 13
Comparison of SNR of different methods for MA noise with a SNR of 1.25 dB.Figure 14
ResNet’s residual learning block.In order to verify the network model, the following two sets of verification experiments are carried out. The experimental results are shown in Figures15 and 16. Figure 15 shows the noise reduction effect of different ECG signals with the same noise type under different noise intensity interferences. Figure 16 is a graph of the noise reduction effect for the same ECG signal with different types and different intensities of noises. As shown in Figures 15 and 16, we can see that our network model performs well in removing single noises or mixed noises. It shows good performance for various noises and multiple intensity types of noises. Our model overcomes the singularity of traditional noise reduction functions, and the method proposed in this article can remove multiple noises.Figure 15
The average noise reduction effect of seven kinds of noises in ten groups of ECG signals.Figure 16
The average noise reduction results of ten groups of ECG signals under various noises.


## 5.4. Model Noise Reduction Effect Verification

In addition to adding the traditional 0 dB, 1.25 dB, and 5 dB, this article also has data of 1 dB, 2 dB, 3 dB, and 4 dB for effect verification, and the experimental results are all good. The experimental data is shown in Table6. It can be seen that the model in this article has a good noise reduction effect on noise with different SNR and is applicable to data with different noise types.Table 6
Model experiment results under different noise types and different noise intensities.
SNR/noise typeMAEMBWSNRRMSESNRRMSESNRRMSE0 dB34.39560.000234.40560.000334.18100.00041 dB38.12680.000637.18360.000337.63230.00071.25 dB31.12820.001831.40570.000831.15450.00162 dB40.26120.000939.24380.000840.16730.00093 dB42.26120.000943.56930.000243.65020.00064 dB46.28730.000445.69120.000540.40560.00065 dB51.11280.000953.22460.001152.24590.0010Average40.50790.000740.67050.000541.30080.0009Previous work used the methods of Decomposition, Transformation, and Filtering to denoise the ECG signal. However, these studies have three shortcomings. First, the existing noise reduction methods do not take into account the locality and global correlation of ECG signals. Second, the adaptability to various noises is not good enough. Third, it may trigger severe signal distortion in the course of this research. We have established our experimental methods in accordance with the above three shortcomings. This paper establishes a new point of view with adversarial methods; that is, adversarial methods have the ability to learn the difference between input and output. This view makes it possible to denoise ECG signals with adversarial methods. We addedLdist and Ldist−max to the loss function of the generated network to increase the local and overall grasp of the noise reduction signal. We propose an adversarial ECG signal denoising method, and our method has an excellent denoising effect for all kinds of noisy signals. A large number of experiments verify the superiority of the model’s noise reduction effect. As shown in Table 7, our method improves the SNR by 88.57% on average.Table 7
Compared with the most advanced method, the noise reduction effect of this experimental method is improved by percentage.
SNR/noise typeMA noiseEM noiseBW noise0 dB68.57%31.85%35.77%1.25 dB41.23%49.65%47.95%5 dB151.99%163.47%191.64%Average87.26%86.66%91.79%


## 6. Conclusion

This article describes a new method for ECG signal denoising. The high-quality noise reduction of the ECG signal is realized, and the characteristic distribution of noise is learned through the adversarial network.First, this article improves the original adversarial network structure, adds the residual block structure to the generation network, and uses the ResNet structure in the discrimination network. All of these improvements accelerate the training process while improving the stability of network optimization and have stronger generalization capabilities than general networks.Second, in the aspect of feature layer normalization, this article carries out batch processing operations. It is convenient to adjust the data distribution in the hidden layer, making the network easier to train.Third, the residual block and Skip-Connecting structure are added to the network model in this paper. The introduction of the improved network structure effectively suppresses the defect that the gradient explodes or disappears easily in the training process of the counter network itself, which greatly reduces the possibility of gradient explosion and dispersion during training, thereby improving the stability of network optimization.Fourth, we have improved the traditional loss function. Through the network model noise reduction effect verification experiment, it is known that the loss function used in this paper has achieved excellent results under different types of noises with different intensities.But for now, the theory of learning differences based on adversarial methods has not been clearly established. The classification operation can be added to the output part after noise reduction to further verify the noise reduction effect of the network model, which will be the focus of our future work.Certain achievements have been made in noise reduction of the ECG signals, yet further research studies are still needed, which will focus on the following aspects:(1)
A good signal noise reduction method performs better in ECG signal classification. Inspired by [42], we will combine the denoising and classification of ECG signals for further research studies. Noise reduction can improve the classification accuracy, and the classification result is used to verify the performance of the noise reduction method(2)
The research results in ECG noise reduction can provide support for the development of other industries. For example, the progress in noise reduction can improve the accuracy of the ECG measurement device. In the next step, the proposed noise reduction method will be applied to the ECG signal acquisition process of the twelve-lead wearable ECG monitor that is actually involved in the research and development. In this way, the practicality and feasibility of the research results can be further verified. Because the ECG signal interaction method collected by the 12-lead wearable ECG monitoring suit developed by our team is a cloud platform, the blockchain-based medical data protection proposed in [43] is also one of the research directions in the future(3)
The data noise reduction method proposed in this paper is not limited to its application in the field of ECG signals. The proposed method can also be applied to other one-dimensional signal noise reduction, such as the processing of noise data in ocean data [44]. Data denoising methods are also applicable in the field of big data preprocessing. For example, as stated in [45], according to different service requirements to expand big data processing, it can provide more accurate valuable data. Such data processing ideas are consistent with the ideas of this article



---

*Source: 5527904-2021-04-20.xml*