# An Efficient ECG Denoising Method Based on Empirical Mode Decomposition, Sample Entropy, and Improved Threshold Function

Authors: Dengyong Zhang; Shanshan Wang; Feng Li; Shang Tian; Jin Wang; Xiangling Ding; Rongrong Gong
Journal: Wireless Communications and Mobile Computing
 (2020)

---

## Abstract

The electrocardiogram (ECG) signal can easily be affected by various types of noises while being recorded, which decreases the accuracy of subsequent diagnosis. Therefore, the efficient denoising of ECG signals has become an important research topic. In the paper, we proposed an efficient ECG denoising approach based on empirical mode decomposition (EMD), sample entropy, and improved threshold function. This method can better remove the noise of ECG signals and provide better diagnosis service for the computer-based automatic medical system. The proposed work includes three stages of analysis: (1) EMD is used to decompose the signal into finite intrinsic mode functions (IMFs), and according to the sample entropy of each order of IMF following EMD, the order of IMFs denoised is determined; (2) the new threshold function is adopted to denoise these IMFs after the order of IMFs denoised is determined; and (3) the signal is reconstructed and smoothed. The proposed method solves the shortcoming of discarding the first-order IMF directly in traditional EMD denoising and proposes a new threshold denoising function to improve the traditional soft and hard threshold functions. We further conduct simulation experiments of ECG signals from the MIT-BIH database, in which three types of noise are simulated: white Gaussian noise, electromyogram (EMG), and power line interference. The experimental results show that the proposed method is robust to a variety of noise types. Moreover, we analyze the effectiveness of the proposed method under different input SNR with reference to improving SNR (SNRimp) and mean square error (MSE), then compare the denoising algorithm proposed in this paper with previous ECG signal denoising techniques. The results demonstrate that the proposed method has a higher SNRimp and a lower MSE. Qualitative and quantitative studies demonstrate that the proposed algorithm is a good ECG signal denoising method.


---

## Body

## 1. Introduction

ECG signals are widely used in the diagnosis of heart disease and are commonly regarded as the most important tool for heart disease diagnosis in clinical practice [1]. Therefore, the analysis and processing of ECG signals is of great significance for heart disease detection. However, various types of noise are introduced during the acquisition of ECG signals; these include baseline drift caused by the patient’s breath, electromyogram noise caused by the contraction and movement of human muscles, motion artifacts arising due to electrode movement [2, 3], channel noise caused by white Gaussian noise introduced during channel transmission, power line interference, and other types of noise pollution. All these types of noise may cause distortion of the ECG waveform, which obscures the tiny features that are most important for diagnosis [4]. Accordingly, various denoising methods have been proposed to maximize the extraction of useful information from the ECG.Researchers have studied a number of such methods, such as directly designing an IIR or FIR filter [5, 6]; however, the amplitude and frequency of the ECG signal obtained by this method are easily distorted, and the noise removal effect is also less than ideal. Huang et al. devised a signal analysis approach based on the time scale of the signal itself and decomposed the signal into a series of intrinsic mode functions (IMFs), which is regarded as empirical mode decomposition (EMD) [7]. Donoho proposed a general threshold method based on discrete wavelet transform (DWT) [8], while [9] proposed a new method that removes ECG signal noise based on both EMD and DWT. Moreover, [10] presents a power line interference removal method based on empirical wavelet transform and adaptive filtering, while in [11], a new method for removing noise from ECG signals was proposed based on EMD, constrained least squares (CLS), and DWT.EMD is an adaptive and efficient decomposition method capable of decomposing any complex signal into finite intrinsic mode functions. It is very suitable for processing nonlinear and nonstationary signals, such as ECG signals [12]. One of the key elements of EMD-based denoising is to determine the noise IMF. Traditional EMD denoising often directly discards the first IMF to achieve the removal of high-frequency noise; however, this method not only discards some important information but also does not completely denoise the signal. Therefore, the question of how to more accurately determine the order of IMF which needs to be denoised remains an active one.Another signal denoising method in widespread use is threshold denoising. The traditional soft and hard threshold functions invented by Donoho and Johnstone [13, 14] are the most commonly used threshold denoising approaches. However, these two functions have some defects in theory that affect the denoising performance. The traditional hard threshold function in the mean square error sense is better than the soft threshold method, because the principle of the hard threshold method involves setting a fixed threshold; however, coefficients higher than the threshold value remain unchanged, while coefficients lower than the threshold value are set to zero. While this processing method can completely retain the information larger than the threshold value, the resulting signal will exhibit additional oscillations and jump points and will not have the smoothness of the original signal. For its part, the soft threshold method proposes to shrink the coefficients that exceed the threshold value and set all coefficients less than the threshold value to zero. The effect after processing is as follows: the coefficients near the threshold value are continuous, and the signal after denoising is smooth, but due to the compression of the signal, some errors will occur, which will affect the degree of approximation between the denoised signal and the original signal.Accordingly, an improved threshold denoising function is presented in the present work, which improves on the existing EMD-based denoising methods. By calculating the sample entropy of each IMF after the decomposition of EMD, it is possible to judge the IMF order that needs to be denoised, after which the new threshold function denoising is carried out for these IMFs. The main contributions are as follows:(1)
Determine the IMF order that needs to be denoised by calculating the sample entropy value of the IMF after EMD(2)
A new threshold denoising function is proposed, which overcomes the large difference between the coefficients processed by the traditional soft threshold function and the coefficient before processing and the shortcomings of the traditional hard threshold function being not continuous(3)
Further smoothing the signal after denoisingThe rest of this work is organized as follows. In Section2, the empirical mode decomposition and sample entropy are introduced. Section 3 then introduces the steps of the algorithm proposed in this work. Section 4 presents the experimental results along with their qualitative and quantitative comparative analyses. Finally, Section 5 summarizes the methods and results of this paper.


## 2. Background Knowledge

### 2.1. Empirical Mode Decomposition

EMD is a new signal analysis method proposed by Huang et al. [7]. EMD is an adaptive and efficient decomposition method capable of decomposing any complex signal into a finite number of intrinsic mode functions and has many advantages when it comes to the processing of nonlinear and nonstationary signals.EMD is actually a method of signal decomposition, which is consistent with the core idea of Fourier transform and wavelet transform, and involves the decomposition of the signal into the superposition of each independent component. However, EMD does not need the basis function but instead decomposes the signal through its own time scale, meaning that it has self-adaptability. Since EMD does not need a basis function, it is suitable for any type of signal and especially for the decomposition of nonlinear and nonstationary signals.The purpose of EMD is to decompose the signal into a finite number of intrinsic mode functions (IMFs). The instantaneous frequency at any point of the intrinsic mode function is meaningful. Huang et al. considered that any signal is composed of several intrinsic mode functions. IMF is a function that satisfies the following two conditions:(1)
The numbers of zeros and poles in the whole data segment are equal or differ by one at most(2)
At each time point, the mean value of the envelope determined by the local maximum value and the envelope determined by the local minimum value is zeroThe steps in the screening process are as follows:(1)
Determine all the maximum and minimum values of the signalSt, then use the cubic spline method to fit the upper envelope Sut and the lower envelope Sdt of the signal St(2)
Subtract the average value of these two envelope lines from the signalm1t=Sut+Sdt/2 and get f1t=St−m1t(3)
Becausef1t is still not an IMF component sequence, we need to repeat the above process until the signal meets IMF standards. In this way, we obtain the first IMF component c1t(4)
The first IMF componentc1t contains the highest frequency component of the signal. Separate c1t from St to obtain a difference signal r1t with the high-frequency components removed, i.e., r1t=St−c1t(5)
Repeat steps (1)-(4) withr1t as the new data until all IMFs have been extracted. The filtering process is terminated when the nth residual signal rnt satisfies a given termination condition (usually making rnt a monotone function). Therefore, the original data St can be represented as the sum of the decomposed IMF and obtained rnt:
(1)St=∑i=1ncit+rnt,where n is the number of IMFs and cit is the ith-order IMF, while rnt is the residual signal.


### 2.2. Sample Entropy

Sample entropy is a method used to measure the complexity of a time series. It is an improvement of approximate entropy. In this study, sample entropy is used to determine the noisy IMF order. The detailed calculation method of sample entropy is as follows.Given the time seriesX=x1,x2,x3,⋯,xn with length N, the entropy calculation process of the sample is as follows:
(1)
Construct a set ofm-dimensional vectors xm1,xm2,⋯,xmN−m+1, where xmi=xi,xi+1,⋯,xi+m−11≤i≤N−m+1(2)
The absolute value of the maximum value of the difference between the corresponding elements ofxmj and xml is defined as the distance between vectors xmj and xml and is set as dxmj,xml. In short dxmj,xml=maxk=0,⋯,m−1xj+k−xl+k(3)
For a givenxmj, count the number of l for which the distance between xmj and xml is less than or equal to r, record this as Bj, and calculate the ratio of Bj to the total distance: Bjmr=1/N−mBj(4)
Calculate the average of allj as Bmr=1/N−m∑j=1N−mBjmr(5)
Increase the dimensionm to m+1 and repeat steps (1) to (4):
(2)Ajm+1r=1N−m+1Aj,Am+1r=1N−m+1∑j=1N−m+1Ajm+1r.(6)
The sample entropy of the time series is thus defined as(3)SampEnN,m,r=limN→∞−lnAm+1rBmr.As the actual signal cannot approach infinity, we estimate the sample entropy as follows:(4)SampEnN,m,r=−lnAm+1rBmr.In this paper, we takem=2 and r=0.25∗stdX, where stdX is defined as the standard deviation of the initial data X.


## 2.1. Empirical Mode Decomposition

EMD is a new signal analysis method proposed by Huang et al. [7]. EMD is an adaptive and efficient decomposition method capable of decomposing any complex signal into a finite number of intrinsic mode functions and has many advantages when it comes to the processing of nonlinear and nonstationary signals.EMD is actually a method of signal decomposition, which is consistent with the core idea of Fourier transform and wavelet transform, and involves the decomposition of the signal into the superposition of each independent component. However, EMD does not need the basis function but instead decomposes the signal through its own time scale, meaning that it has self-adaptability. Since EMD does not need a basis function, it is suitable for any type of signal and especially for the decomposition of nonlinear and nonstationary signals.The purpose of EMD is to decompose the signal into a finite number of intrinsic mode functions (IMFs). The instantaneous frequency at any point of the intrinsic mode function is meaningful. Huang et al. considered that any signal is composed of several intrinsic mode functions. IMF is a function that satisfies the following two conditions:(1)
The numbers of zeros and poles in the whole data segment are equal or differ by one at most(2)
At each time point, the mean value of the envelope determined by the local maximum value and the envelope determined by the local minimum value is zeroThe steps in the screening process are as follows:(1)
Determine all the maximum and minimum values of the signalSt, then use the cubic spline method to fit the upper envelope Sut and the lower envelope Sdt of the signal St(2)
Subtract the average value of these two envelope lines from the signalm1t=Sut+Sdt/2 and get f1t=St−m1t(3)
Becausef1t is still not an IMF component sequence, we need to repeat the above process until the signal meets IMF standards. In this way, we obtain the first IMF component c1t(4)
The first IMF componentc1t contains the highest frequency component of the signal. Separate c1t from St to obtain a difference signal r1t with the high-frequency components removed, i.e., r1t=St−c1t(5)
Repeat steps (1)-(4) withr1t as the new data until all IMFs have been extracted. The filtering process is terminated when the nth residual signal rnt satisfies a given termination condition (usually making rnt a monotone function). Therefore, the original data St can be represented as the sum of the decomposed IMF and obtained rnt:
(1)St=∑i=1ncit+rnt,where n is the number of IMFs and cit is the ith-order IMF, while rnt is the residual signal.


## 2.2. Sample Entropy

Sample entropy is a method used to measure the complexity of a time series. It is an improvement of approximate entropy. In this study, sample entropy is used to determine the noisy IMF order. The detailed calculation method of sample entropy is as follows.Given the time seriesX=x1,x2,x3,⋯,xn with length N, the entropy calculation process of the sample is as follows:
(1)
Construct a set ofm-dimensional vectors xm1,xm2,⋯,xmN−m+1, where xmi=xi,xi+1,⋯,xi+m−11≤i≤N−m+1(2)
The absolute value of the maximum value of the difference between the corresponding elements ofxmj and xml is defined as the distance between vectors xmj and xml and is set as dxmj,xml. In short dxmj,xml=maxk=0,⋯,m−1xj+k−xl+k(3)
For a givenxmj, count the number of l for which the distance between xmj and xml is less than or equal to r, record this as Bj, and calculate the ratio of Bj to the total distance: Bjmr=1/N−mBj(4)
Calculate the average of allj as Bmr=1/N−m∑j=1N−mBjmr(5)
Increase the dimensionm to m+1 and repeat steps (1) to (4):
(2)Ajm+1r=1N−m+1Aj,Am+1r=1N−m+1∑j=1N−m+1Ajm+1r.(6)
The sample entropy of the time series is thus defined as(3)SampEnN,m,r=limN→∞−lnAm+1rBmr.As the actual signal cannot approach infinity, we estimate the sample entropy as follows:(4)SampEnN,m,r=−lnAm+1rBmr.In this paper, we takem=2 and r=0.25∗stdX, where stdX is defined as the standard deviation of the initial data X.


## 3. Proposed Methods

In this paper, the EMD of ECG signals was firstly carried out in order to obtain multiple IMF components. In the next step, the sample entropy of each IMF was used to determine the IMF components requiring denoising; the new and improved threshold denoising function developed in this article was then used to process these IMFs, after which the signal was reconstructed to obtain the denoised ECG signals. Figure1 presents the flow chart of the algorithm proposed in this paper, which will be explained in more detail in the following sections.Figure 1
Flow chart of the proposed algorithm.


### 3.1. EMD of the Signal

First, the ECG signal is decomposed via EMD to obtain multiple IMF components. The decomposed IMFs have the following two characteristics: (1) the mean time scale of the IMF increases with the increase of the IMF order; and (2) the time scale contained in each IMF varies over time (i.e., is not the same throughout). The fundamental principle of noise reduction using EMD involves discarding the part of the IMF that contains noise, then using the sum of the other IMFs to form the denoised signal. Although many methods have been proposed to identify noisy IMF [15], when these are directly applied to ECG denoising, the performance achieved is unsatisfactory. Therefore, there is significant room for improvement regarding how to select IMFs with noise, how to denoise IMFs with noise, and how to improve the quality of the denoised signal.


### 3.2. Judging IMF Components with Noise

The calculation of sample entropy is independent of the length of the sequence; only short data is needed to get a robust estimate. This approach can be used for mixed signals composed of random components and deterministic components; moreover, the analysis effect obtained is superior to that of simple statistical parameters such as mean, variance, and standard deviation [16, 17]. The more complex the sequence, the higher the sample entropy and the lower the self-similarity of the sequence, while, by contrast, the higher the self-similarity of the sequences, the lower the sample entropy [18]. Based on this theory, we judge the noisy IMF component by going through the following steps:
(1)
First, the first-order IMF was taken as the noise seriesX and its sample entropy was calculated, where the order of IMF was m=1(2)
Letm=m+1, after which the mth IMF and noise sequence X are reconstructed. The reconstructed sequence is regarded as a new noise sequence X, and its sample entropy is calculated(3)
If the sample entropy of the noise sequence increases, continue to repeat step (2); if the sample entropy decreases, the judgment is stopped. We regard the IMF before the current orderm as the noisy IMF; that is, IMFkk=1,⋯,m is the noise IMFAs the set noise sequence becomes more and more complex, its sample entropy will gradually increase [19]. Subsequently, if IMFs continue to be added, more useful signals will also be included; this will result in the noise being overwhelmed by the useful signals, meaning that the sample entropy of the noise sequence will be reduced.


### 3.3. New Threshold Function Denoising and Signal Reconstruction

#### 3.3.1. Threshold Denoising for Noisy IMFs

After the noisy IMFs are determined, the next step is to perform threshold denoising on these IMFs. In this paper, improvements are made to the traditional soft and hard threshold methods and a novel, superior threshold denoising function is proposed.Recall that the principle of the hard threshold method involves setting a fixed threshold value, such that coefficients larger than the threshold value remain unchanged, while coefficients smaller than the threshold value are set to zero; this processing method enables information larger than the threshold value to be retained but produces additional oscillations and jump points in the signal so that it lacks the smoothness of the original. Moreover, the soft threshold method proposes shrinking coefficients larger than the threshold value and setting coefficients smaller than the threshold value to zero. The coefficients around the threshold are therefore continuous, while the resulting signal is smooth after denoising; however, some errors will also arise due to the compression of the signal, which will affect the degree of approximation between the denoised signal and the original signal. In order to preserve the original signal to the greatest extent possible, a new threshold processing method is proposed as follows:(5)D=d∗2∗arctand−T∗λπ,d≥T,0,d<T.Here,d is the coefficient that requires threshold processing, T is the threshold, D is the coefficient after threshold processing, λ is the adjustment factor, and λ is used to control the size of D.Whend→±∞, there is D=limd→±∞d∗2∗arctan∞/π=d.Whend→±T, there is D=limd→±Td∗2∗arctan0/π=d.As can be seen from the above, when the absolute value of the coefficient continues to increase, the coefficient after the threshold value treatment will be closer to the coefficient before treatment; this overcomes the problem of the large difference between the coefficients before and after traditional soft threshold function treatment. When the absolute value of the coefficient approaches the threshold value, the coefficient after treatment is close to 0; this indicates that the threshold processing function is continuous at the threshold point, which improves the discontinuity of the traditional hard threshold function.Figure2 presents a comparison between the proposed improved threshold function and the traditional soft and hard threshold functions (for simplicity’s sake, only the first quadrant image is drawn in this figure). Here, the threshold value is set to 3, while λ is 50. As can be seen from the figure, the hard threshold function is nonsequence at the threshold point, and there is a constant difference between D after the soft threshold function processing and the coefficient d before the processing. The improved threshold function is continuous at the threshold point; moreover, as the coefficient d continues to increase, the coefficient D after the threshold continues to be close to d, which eliminates the problem of difference in the soft threshold context.Figure 2
Comparison diagram of the first quadrant image of the threshold function.The threshold selection in this paper uses a fixed threshold. Generally speaking, the fixed threshold value isT=σ2logN, where σ is the standard deviation of the whole noise and N is the signal length. Therefore, the T obtained by this method is of a fixed size. The IMF coefficients of each layer are different, but the threshold T of each layer is the same, meaning that the denoising effect obtained is not good. Therefore, in order to ensure that the threshold is adaptively adjusted depending on the different decomposition levels, this paper adopts the following hierarchical threshold selection method; the formula is as follows:
(6)T=σ2logNlni+1,Here,T is the threshold value, N is the number of samples, i is the current order of IMF, and σ is the standard deviation of noise. Moreover, in order to select different thresholds according to the IMF coefficients of different layers, the noise standard deviation is calculated according to the IMF coefficients of each order:
(7)σ=medianIMFi,k0.6745.IMFi,k represents the coefficient of the ith-order IMF, while median is the median calculation.


#### 3.3.2. Signal Reconstruction

Finally, the processed IMF and the untreated IMF as well as the residual are reconstructed to obtain the denoised ECG.


#### 3.3.3. Signal Smoothing Processing

After the above denoising processing is complete, some noise often remains in the signal. Accordingly, to further eliminate noise, we smooth the reconstructed signal [20]. First, we calculate the maximum value (lmax) in the signal minimum value and the minimum value (upmin) in the maximum value. The signal in this part needs to be smoothed. The reconstructed signal starts from the second point:
(1)
i=2(2)
Determine whether the signal pointsi needs to be smoothed. If yes, go to step (3); if not, go to step (4)(3)
Consider the former pointsi−1 and the latter point si+1 of the signal point si. If the two points are between lmax and upmin at the same time, then si=si−1+si+si+1/3; if only si−1 or si+1 is between lmax and upmin, then si=si−1+si/2 or si=si+si+1/2. Next, go to step (4)(4)
i++, then go to step (2)


## 3.1. EMD of the Signal

First, the ECG signal is decomposed via EMD to obtain multiple IMF components. The decomposed IMFs have the following two characteristics: (1) the mean time scale of the IMF increases with the increase of the IMF order; and (2) the time scale contained in each IMF varies over time (i.e., is not the same throughout). The fundamental principle of noise reduction using EMD involves discarding the part of the IMF that contains noise, then using the sum of the other IMFs to form the denoised signal. Although many methods have been proposed to identify noisy IMF [15], when these are directly applied to ECG denoising, the performance achieved is unsatisfactory. Therefore, there is significant room for improvement regarding how to select IMFs with noise, how to denoise IMFs with noise, and how to improve the quality of the denoised signal.


## 3.2. Judging IMF Components with Noise

The calculation of sample entropy is independent of the length of the sequence; only short data is needed to get a robust estimate. This approach can be used for mixed signals composed of random components and deterministic components; moreover, the analysis effect obtained is superior to that of simple statistical parameters such as mean, variance, and standard deviation [16, 17]. The more complex the sequence, the higher the sample entropy and the lower the self-similarity of the sequence, while, by contrast, the higher the self-similarity of the sequences, the lower the sample entropy [18]. Based on this theory, we judge the noisy IMF component by going through the following steps:
(1)
First, the first-order IMF was taken as the noise seriesX and its sample entropy was calculated, where the order of IMF was m=1(2)
Letm=m+1, after which the mth IMF and noise sequence X are reconstructed. The reconstructed sequence is regarded as a new noise sequence X, and its sample entropy is calculated(3)
If the sample entropy of the noise sequence increases, continue to repeat step (2); if the sample entropy decreases, the judgment is stopped. We regard the IMF before the current orderm as the noisy IMF; that is, IMFkk=1,⋯,m is the noise IMFAs the set noise sequence becomes more and more complex, its sample entropy will gradually increase [19]. Subsequently, if IMFs continue to be added, more useful signals will also be included; this will result in the noise being overwhelmed by the useful signals, meaning that the sample entropy of the noise sequence will be reduced.


## 3.3. New Threshold Function Denoising and Signal Reconstruction

### 3.3.1. Threshold Denoising for Noisy IMFs

After the noisy IMFs are determined, the next step is to perform threshold denoising on these IMFs. In this paper, improvements are made to the traditional soft and hard threshold methods and a novel, superior threshold denoising function is proposed.Recall that the principle of the hard threshold method involves setting a fixed threshold value, such that coefficients larger than the threshold value remain unchanged, while coefficients smaller than the threshold value are set to zero; this processing method enables information larger than the threshold value to be retained but produces additional oscillations and jump points in the signal so that it lacks the smoothness of the original. Moreover, the soft threshold method proposes shrinking coefficients larger than the threshold value and setting coefficients smaller than the threshold value to zero. The coefficients around the threshold are therefore continuous, while the resulting signal is smooth after denoising; however, some errors will also arise due to the compression of the signal, which will affect the degree of approximation between the denoised signal and the original signal. In order to preserve the original signal to the greatest extent possible, a new threshold processing method is proposed as follows:(5)D=d∗2∗arctand−T∗λπ,d≥T,0,d<T.Here,d is the coefficient that requires threshold processing, T is the threshold, D is the coefficient after threshold processing, λ is the adjustment factor, and λ is used to control the size of D.Whend→±∞, there is D=limd→±∞d∗2∗arctan∞/π=d.Whend→±T, there is D=limd→±Td∗2∗arctan0/π=d.As can be seen from the above, when the absolute value of the coefficient continues to increase, the coefficient after the threshold value treatment will be closer to the coefficient before treatment; this overcomes the problem of the large difference between the coefficients before and after traditional soft threshold function treatment. When the absolute value of the coefficient approaches the threshold value, the coefficient after treatment is close to 0; this indicates that the threshold processing function is continuous at the threshold point, which improves the discontinuity of the traditional hard threshold function.Figure2 presents a comparison between the proposed improved threshold function and the traditional soft and hard threshold functions (for simplicity’s sake, only the first quadrant image is drawn in this figure). Here, the threshold value is set to 3, while λ is 50. As can be seen from the figure, the hard threshold function is nonsequence at the threshold point, and there is a constant difference between D after the soft threshold function processing and the coefficient d before the processing. The improved threshold function is continuous at the threshold point; moreover, as the coefficient d continues to increase, the coefficient D after the threshold continues to be close to d, which eliminates the problem of difference in the soft threshold context.Figure 2
Comparison diagram of the first quadrant image of the threshold function.The threshold selection in this paper uses a fixed threshold. Generally speaking, the fixed threshold value isT=σ2logN, where σ is the standard deviation of the whole noise and N is the signal length. Therefore, the T obtained by this method is of a fixed size. The IMF coefficients of each layer are different, but the threshold T of each layer is the same, meaning that the denoising effect obtained is not good. Therefore, in order to ensure that the threshold is adaptively adjusted depending on the different decomposition levels, this paper adopts the following hierarchical threshold selection method; the formula is as follows:
(6)T=σ2logNlni+1,Here,T is the threshold value, N is the number of samples, i is the current order of IMF, and σ is the standard deviation of noise. Moreover, in order to select different thresholds according to the IMF coefficients of different layers, the noise standard deviation is calculated according to the IMF coefficients of each order:
(7)σ=medianIMFi,k0.6745.IMFi,k represents the coefficient of the ith-order IMF, while median is the median calculation.


### 3.3.2. Signal Reconstruction

Finally, the processed IMF and the untreated IMF as well as the residual are reconstructed to obtain the denoised ECG.


### 3.3.3. Signal Smoothing Processing

After the above denoising processing is complete, some noise often remains in the signal. Accordingly, to further eliminate noise, we smooth the reconstructed signal [20]. First, we calculate the maximum value (lmax) in the signal minimum value and the minimum value (upmin) in the maximum value. The signal in this part needs to be smoothed. The reconstructed signal starts from the second point:
(1)
i=2(2)
Determine whether the signal pointsi needs to be smoothed. If yes, go to step (3); if not, go to step (4)(3)
Consider the former pointsi−1 and the latter point si+1 of the signal point si. If the two points are between lmax and upmin at the same time, then si=si−1+si+si+1/3; if only si−1 or si+1 is between lmax and upmin, then si=si−1+si/2 or si=si+si+1/2. Next, go to step (4)(4)
i++, then go to step (2)


## 3.3.1. Threshold Denoising for Noisy IMFs

After the noisy IMFs are determined, the next step is to perform threshold denoising on these IMFs. In this paper, improvements are made to the traditional soft and hard threshold methods and a novel, superior threshold denoising function is proposed.Recall that the principle of the hard threshold method involves setting a fixed threshold value, such that coefficients larger than the threshold value remain unchanged, while coefficients smaller than the threshold value are set to zero; this processing method enables information larger than the threshold value to be retained but produces additional oscillations and jump points in the signal so that it lacks the smoothness of the original. Moreover, the soft threshold method proposes shrinking coefficients larger than the threshold value and setting coefficients smaller than the threshold value to zero. The coefficients around the threshold are therefore continuous, while the resulting signal is smooth after denoising; however, some errors will also arise due to the compression of the signal, which will affect the degree of approximation between the denoised signal and the original signal. In order to preserve the original signal to the greatest extent possible, a new threshold processing method is proposed as follows:(5)D=d∗2∗arctand−T∗λπ,d≥T,0,d<T.Here,d is the coefficient that requires threshold processing, T is the threshold, D is the coefficient after threshold processing, λ is the adjustment factor, and λ is used to control the size of D.Whend→±∞, there is D=limd→±∞d∗2∗arctan∞/π=d.Whend→±T, there is D=limd→±Td∗2∗arctan0/π=d.As can be seen from the above, when the absolute value of the coefficient continues to increase, the coefficient after the threshold value treatment will be closer to the coefficient before treatment; this overcomes the problem of the large difference between the coefficients before and after traditional soft threshold function treatment. When the absolute value of the coefficient approaches the threshold value, the coefficient after treatment is close to 0; this indicates that the threshold processing function is continuous at the threshold point, which improves the discontinuity of the traditional hard threshold function.Figure2 presents a comparison between the proposed improved threshold function and the traditional soft and hard threshold functions (for simplicity’s sake, only the first quadrant image is drawn in this figure). Here, the threshold value is set to 3, while λ is 50. As can be seen from the figure, the hard threshold function is nonsequence at the threshold point, and there is a constant difference between D after the soft threshold function processing and the coefficient d before the processing. The improved threshold function is continuous at the threshold point; moreover, as the coefficient d continues to increase, the coefficient D after the threshold continues to be close to d, which eliminates the problem of difference in the soft threshold context.Figure 2
Comparison diagram of the first quadrant image of the threshold function.The threshold selection in this paper uses a fixed threshold. Generally speaking, the fixed threshold value isT=σ2logN, where σ is the standard deviation of the whole noise and N is the signal length. Therefore, the T obtained by this method is of a fixed size. The IMF coefficients of each layer are different, but the threshold T of each layer is the same, meaning that the denoising effect obtained is not good. Therefore, in order to ensure that the threshold is adaptively adjusted depending on the different decomposition levels, this paper adopts the following hierarchical threshold selection method; the formula is as follows:
(6)T=σ2logNlni+1,Here,T is the threshold value, N is the number of samples, i is the current order of IMF, and σ is the standard deviation of noise. Moreover, in order to select different thresholds according to the IMF coefficients of different layers, the noise standard deviation is calculated according to the IMF coefficients of each order:
(7)σ=medianIMFi,k0.6745.IMFi,k represents the coefficient of the ith-order IMF, while median is the median calculation.


## 3.3.2. Signal Reconstruction

Finally, the processed IMF and the untreated IMF as well as the residual are reconstructed to obtain the denoised ECG.


## 3.3.3. Signal Smoothing Processing

After the above denoising processing is complete, some noise often remains in the signal. Accordingly, to further eliminate noise, we smooth the reconstructed signal [20]. First, we calculate the maximum value (lmax) in the signal minimum value and the minimum value (upmin) in the maximum value. The signal in this part needs to be smoothed. The reconstructed signal starts from the second point:
(1)
i=2(2)
Determine whether the signal pointsi needs to be smoothed. If yes, go to step (3); if not, go to step (4)(3)
Consider the former pointsi−1 and the latter point si+1 of the signal point si. If the two points are between lmax and upmin at the same time, then si=si−1+si+si+1/3; if only si−1 or si+1 is between lmax and upmin, then si=si−1+si/2 or si=si+si+1/2. Next, go to step (4)(4)
i++, then go to step (2)


## 4. Results and Discussion

In this chapter, we conduct several experiments to prove the denoising feasibility of the proposed method. In order to demonstrate the denoising effect more persuasively, we conducted experiments on the MIT-BIH arrhythmia database [21]. The signal length in this database is 650,000 samples, with a sampling rate of 360 Hz and a resolution of 11 BPS. All experiments in this paper are carried out on MATLAB 2018.The method is evaluated both qualitatively and quantitatively to prove its superiority. In this experiment, after comprehensive empirical testing, we set the adjustment factorλ of the improved threshold function to 500.


### 4.1. Qualitative Evaluation

In order to verify the proposed algorithm’s robustness to different types of noise, we randomly selected signals with different numbers from the MIT-BIH database, then added three different forms of analog noise to these signals, specifically white Gaussian noise, EMG noise, and power line interference. The EMG signal noise is simulated by generating random noise, while the power line interference is simulated by adding a 50 Hz sinusoidal signal.Figure3 presents the effect diagram of the signal no. 119 record after adding power line interference and denoising. There are ectopic complexes in the signal no. 119 record. We can clearly see that while the denoising signal reduces most of the noise, the ectopic complexes still exist; thus, it can be concluded that during the denoising process, the method still retains the morphological characteristics of the original signal, which contain important diagnostic information.Figure 3
Denoising results after adding 50 Hz power line interference to the signal no. 119 record in the MIT-BIH database. (a) Original signal. (b) The signal with power line noise added. (c) The denoised signal.
(a)(b)(c)We next added the EMG noise to the signal no. 113 record; here, we simulate the EMG interference by adding random noise (whereμ=0 and σ=0.15). As shown in Figure 4, the algorithm has good robustness for the removal of EMG noise.Figure 4
The denoising results after adding EMG noise to the signal no. 113 record of the MIT-BIH database. (a) Original signal. (b) The signal after adding EMG noise. (c) Signal after denoising.
(a)(b)(c)Figure5 adds 20 dB white Gaussian noise to the signal no. 122 record and uses the proposed algorithm to conduct denoising. As can be seen from the figure, this algorithm has a good denoising effect for white Gaussian noise, while the denoised signal is relatively smooth and exhibits less distortion.Figure 5
Denoising results of the signal no. 122 record in the MIT-BIH database after Gaussian noise is added. (a) Original signal. (b) The signal after adding Gaussian noise. (c) Signal after denoising.
(a)(b)(c)


### 4.2. Quantitative Evaluation

In this paper, the performance of the denoising signal and the quality of the reconstructed signal are analyzed by improving SNR (SNRimp) and mean square error (MSE). SNRimp and MSE are evaluation parameters widely used in the signal denoising context [22, 23]. The signal-to-noise ratio (SNR), which refers to the ratio of signal to noise, can quantify the signal quality from the perspective of energy; moreover, improving signal-to-noise ratio (SNRimp) refers to the increase of SNR following signal denoising. Generally speaking, a high SNR indicates that the signal contains less noise. MSE is a measure that reflects the degree of difference between the original signal and the denoised signal. A lower MSE value indicates that the denoised signal is better able to retain the details of the original signal.The formula forSNRimp is defined as follows:
(8)SNRimp=10log10∑i=1Nyi−xi2∑i=1Nsi−xi2.The formula forMSE is as follows:
(9)MSE=1N∑i=1Nxi−si2.Here,xi represents the original clean signal, yi is the signal after adding noise to the original signal, si is the signal after denoising, and N is the signal length.Table1 presents the improved SNR results of ECG signals with 20 dB white Gaussian noise added. We chose the ECG signals numbered 100, 104, 105, 106, 115, and 215 because these were used in Reference [24]. In practical application, the algorithm presented in this paper is effective for all ECG data signals in the database. The denoising results are further compared with the EMD soft threshold [25], wavelet soft threshold [26], and EMD wavelet [27]. It can be observed from Table 1 that the algorithm presented in this paper has a high SNRimp for different ECG signals when the specific input SNR is 20 dB, so it can be seen that this algorithm can remove more noise. Under the condition of the high-input signal-to-noise ratio (20 dB), this demonstrates the robustness of this method in terms of its ability to improve signal quality by reducing noise. Furthermore, Table 2 shows the mean square error results of ECG signals with 20 dB white Gaussian noise added. As can be clearly seen from the figure, the algorithm proposed in this paper has a lower MSE after denoising; thus, following denoising via the proposed method, the resultant signal retains more details of (and can thus better estimate) the original signal.Table 1
SNRimp comparison of signal denoising results of the MIT-BIH database with WGN (20 dB) added.
ECG signalEMD soft thresholdWavelet soft thresholdEMD waveletProposed method1001.85.75.66.01041.44.55.55.41050.84.34.46.71061.23.53.44.21150.14.44.75.22150.54.64.75.1Average0.964.54.715.43Table 2
MSE comparison of signal denoising results of the MIT-BIH database with WGN (20 dB) added.
ECG signalEMD soft thresholdWavelet soft thresholdEMD waveletProposed method1000.0090.00260.00260.00241040.01410.00420.00360.00261050.02280.00300.00310.00211060.03560.00130.00120.00201150.00940.00350.00300.00292150.01050.00290.00290.0028Average0.01690.00290.00270.0024Table3 lists the improved SNR under a wide range of input SNR. We conducted multiple experiments on the signals numbered 100, 104, 105, 106, 115, and 215 and took the average values of all the signals as the results in order to make the experimental data more objective. As can be intuitively seen from the table, compared with the EMD soft threshold, wavelet soft threshold, and EMD wavelet, the method proposed in this paper achieves a higher SNR improvement in any input SNR, and for a lower input SNR, this method can also produce a higher SNR improvement.Table 3
The meanSNRimp comparison of several denoising methods with different input SNR.
Input SNREMD soft thresholdWavelet soft thresholdEMD waveletProposed method6 dB3.65.06.28.3810 dB3.35.86.17.2315 dB2.35.15.156.2520 dB0.964.54.75.43Figure6 illustrates the mean square error of the denoised ECG signal when the input signal-to-noise ratio is 6~20 dB. As shown in the figure, at each input signal-to-noise ratio level, the mean square error of this method is smaller than other methods, revealing that the denoising algorithm can estimate the original ECG signal with minimal error. Therefore, the proposed method is better than other schemes at reducing both ECG signal noise and signal distortion.Figure 6
The meanMSE comparison of several denoising methods with different input SNR.In addition, we compare the proposed method with NLM [28] and CEEMDAN [29]. To fully prove the usability of the algorithm, we carried out experiments on all signals in MIT-BIH. The SNR improvement values obtained by different algorithms when the input SNR is 10 dB are listed in Table 4. It can be seen from the table that the improved SNR of the algorithm proposed in this paper is the highest for all signals; since SNRimp refers to the increase of SNR following signal denoising, a high SNR indicates that the signal contains less noise indicating that this algorithm can remove more noise and, accordingly, that this method achieves the best denoising effect.Table 4
SNRimp comparison of different methods when the input SNR is 10 dB.
DatasetProposedNLMCEEMDANDatasetProposedNLMCEEMDAN1007.756.846.042018.656.616.361017.846.566.022029.327.707.591027.935.945.312035.624.533.441037.587.595.672057.866.235.081048.166.555.772079.738.226.721058.787.073.822088.416.325.051067.045.864.992097.016.084.451077.987.456.922108.567.174.961089.466.294.352127.635.934.611099.507.567.552137.717.134.871119.156.205.472148.427.464.701128.916.685.682157.526.115.441136.837.355.222177.726.115.641149.975.374.882197.617.724.371157.637.506.672206.786.656.971166.576.823.652218.186.675.161178.776.507.972228.345.905.201187.416.075.772238.337.547.161197.597.506.272288.756.756.031219.117.594.632307.216.375.841228.117.047.102317.627.226.151237.687.036.092328.703.743.661248.527.376.852338.406.506.302008.266.635.842347.537.016.289In order to compare the denoising effect of several algorithms more intuitively, we selected the signals with data numbers of 100, 101, 103, 105, 106, 115, and 220 from the MIT-BIH database, added 10 dB white Gaussian noise, and denoised them. Figures7 and 8 present a comparison of the SNRimp and MSE values of different methods following denoising (these signals were chosen for our experiments because they were also selected in Reference [28]). In a practical application scenario, the algorithm presented in this paper can be seen to be effective for all ECG data signals in the database. It can be further observed from Figures 7 and 8 that the method proposed in this paper not only improves the SNR but also has the lowest MSE after denoising, since a lower MSE value indicates that the denoised signal is better able to retain the details of the original signal, which proves the advantages of this method in terms of reducing ECG signal noise and signal distortion.Figure 7
Performance evaluation ofSNRimp after adding 10 dB WGN to different signals for denoising.Figure 8
Performance evaluation ofMSE after adding 10 dB WGN denoising to different signals.


## 4.1. Qualitative Evaluation

In order to verify the proposed algorithm’s robustness to different types of noise, we randomly selected signals with different numbers from the MIT-BIH database, then added three different forms of analog noise to these signals, specifically white Gaussian noise, EMG noise, and power line interference. The EMG signal noise is simulated by generating random noise, while the power line interference is simulated by adding a 50 Hz sinusoidal signal.Figure3 presents the effect diagram of the signal no. 119 record after adding power line interference and denoising. There are ectopic complexes in the signal no. 119 record. We can clearly see that while the denoising signal reduces most of the noise, the ectopic complexes still exist; thus, it can be concluded that during the denoising process, the method still retains the morphological characteristics of the original signal, which contain important diagnostic information.Figure 3
Denoising results after adding 50 Hz power line interference to the signal no. 119 record in the MIT-BIH database. (a) Original signal. (b) The signal with power line noise added. (c) The denoised signal.
(a)(b)(c)We next added the EMG noise to the signal no. 113 record; here, we simulate the EMG interference by adding random noise (whereμ=0 and σ=0.15). As shown in Figure 4, the algorithm has good robustness for the removal of EMG noise.Figure 4
The denoising results after adding EMG noise to the signal no. 113 record of the MIT-BIH database. (a) Original signal. (b) The signal after adding EMG noise. (c) Signal after denoising.
(a)(b)(c)Figure5 adds 20 dB white Gaussian noise to the signal no. 122 record and uses the proposed algorithm to conduct denoising. As can be seen from the figure, this algorithm has a good denoising effect for white Gaussian noise, while the denoised signal is relatively smooth and exhibits less distortion.Figure 5
Denoising results of the signal no. 122 record in the MIT-BIH database after Gaussian noise is added. (a) Original signal. (b) The signal after adding Gaussian noise. (c) Signal after denoising.
(a)(b)(c)


## 4.2. Quantitative Evaluation

In this paper, the performance of the denoising signal and the quality of the reconstructed signal are analyzed by improving SNR (SNRimp) and mean square error (MSE). SNRimp and MSE are evaluation parameters widely used in the signal denoising context [22, 23]. The signal-to-noise ratio (SNR), which refers to the ratio of signal to noise, can quantify the signal quality from the perspective of energy; moreover, improving signal-to-noise ratio (SNRimp) refers to the increase of SNR following signal denoising. Generally speaking, a high SNR indicates that the signal contains less noise. MSE is a measure that reflects the degree of difference between the original signal and the denoised signal. A lower MSE value indicates that the denoised signal is better able to retain the details of the original signal.The formula forSNRimp is defined as follows:
(8)SNRimp=10log10∑i=1Nyi−xi2∑i=1Nsi−xi2.The formula forMSE is as follows:
(9)MSE=1N∑i=1Nxi−si2.Here,xi represents the original clean signal, yi is the signal after adding noise to the original signal, si is the signal after denoising, and N is the signal length.Table1 presents the improved SNR results of ECG signals with 20 dB white Gaussian noise added. We chose the ECG signals numbered 100, 104, 105, 106, 115, and 215 because these were used in Reference [24]. In practical application, the algorithm presented in this paper is effective for all ECG data signals in the database. The denoising results are further compared with the EMD soft threshold [25], wavelet soft threshold [26], and EMD wavelet [27]. It can be observed from Table 1 that the algorithm presented in this paper has a high SNRimp for different ECG signals when the specific input SNR is 20 dB, so it can be seen that this algorithm can remove more noise. Under the condition of the high-input signal-to-noise ratio (20 dB), this demonstrates the robustness of this method in terms of its ability to improve signal quality by reducing noise. Furthermore, Table 2 shows the mean square error results of ECG signals with 20 dB white Gaussian noise added. As can be clearly seen from the figure, the algorithm proposed in this paper has a lower MSE after denoising; thus, following denoising via the proposed method, the resultant signal retains more details of (and can thus better estimate) the original signal.Table 1
SNRimp comparison of signal denoising results of the MIT-BIH database with WGN (20 dB) added.
ECG signalEMD soft thresholdWavelet soft thresholdEMD waveletProposed method1001.85.75.66.01041.44.55.55.41050.84.34.46.71061.23.53.44.21150.14.44.75.22150.54.64.75.1Average0.964.54.715.43Table 2
MSE comparison of signal denoising results of the MIT-BIH database with WGN (20 dB) added.
ECG signalEMD soft thresholdWavelet soft thresholdEMD waveletProposed method1000.0090.00260.00260.00241040.01410.00420.00360.00261050.02280.00300.00310.00211060.03560.00130.00120.00201150.00940.00350.00300.00292150.01050.00290.00290.0028Average0.01690.00290.00270.0024Table3 lists the improved SNR under a wide range of input SNR. We conducted multiple experiments on the signals numbered 100, 104, 105, 106, 115, and 215 and took the average values of all the signals as the results in order to make the experimental data more objective. As can be intuitively seen from the table, compared with the EMD soft threshold, wavelet soft threshold, and EMD wavelet, the method proposed in this paper achieves a higher SNR improvement in any input SNR, and for a lower input SNR, this method can also produce a higher SNR improvement.Table 3
The meanSNRimp comparison of several denoising methods with different input SNR.
Input SNREMD soft thresholdWavelet soft thresholdEMD waveletProposed method6 dB3.65.06.28.3810 dB3.35.86.17.2315 dB2.35.15.156.2520 dB0.964.54.75.43Figure6 illustrates the mean square error of the denoised ECG signal when the input signal-to-noise ratio is 6~20 dB. As shown in the figure, at each input signal-to-noise ratio level, the mean square error of this method is smaller than other methods, revealing that the denoising algorithm can estimate the original ECG signal with minimal error. Therefore, the proposed method is better than other schemes at reducing both ECG signal noise and signal distortion.Figure 6
The meanMSE comparison of several denoising methods with different input SNR.In addition, we compare the proposed method with NLM [28] and CEEMDAN [29]. To fully prove the usability of the algorithm, we carried out experiments on all signals in MIT-BIH. The SNR improvement values obtained by different algorithms when the input SNR is 10 dB are listed in Table 4. It can be seen from the table that the improved SNR of the algorithm proposed in this paper is the highest for all signals; since SNRimp refers to the increase of SNR following signal denoising, a high SNR indicates that the signal contains less noise indicating that this algorithm can remove more noise and, accordingly, that this method achieves the best denoising effect.Table 4
SNRimp comparison of different methods when the input SNR is 10 dB.
DatasetProposedNLMCEEMDANDatasetProposedNLMCEEMDAN1007.756.846.042018.656.616.361017.846.566.022029.327.707.591027.935.945.312035.624.533.441037.587.595.672057.866.235.081048.166.555.772079.738.226.721058.787.073.822088.416.325.051067.045.864.992097.016.084.451077.987.456.922108.567.174.961089.466.294.352127.635.934.611099.507.567.552137.717.134.871119.156.205.472148.427.464.701128.916.685.682157.526.115.441136.837.355.222177.726.115.641149.975.374.882197.617.724.371157.637.506.672206.786.656.971166.576.823.652218.186.675.161178.776.507.972228.345.905.201187.416.075.772238.337.547.161197.597.506.272288.756.756.031219.117.594.632307.216.375.841228.117.047.102317.627.226.151237.687.036.092328.703.743.661248.527.376.852338.406.506.302008.266.635.842347.537.016.289In order to compare the denoising effect of several algorithms more intuitively, we selected the signals with data numbers of 100, 101, 103, 105, 106, 115, and 220 from the MIT-BIH database, added 10 dB white Gaussian noise, and denoised them. Figures7 and 8 present a comparison of the SNRimp and MSE values of different methods following denoising (these signals were chosen for our experiments because they were also selected in Reference [28]). In a practical application scenario, the algorithm presented in this paper can be seen to be effective for all ECG data signals in the database. It can be further observed from Figures 7 and 8 that the method proposed in this paper not only improves the SNR but also has the lowest MSE after denoising, since a lower MSE value indicates that the denoised signal is better able to retain the details of the original signal, which proves the advantages of this method in terms of reducing ECG signal noise and signal distortion.Figure 7
Performance evaluation ofSNRimp after adding 10 dB WGN to different signals for denoising.Figure 8
Performance evaluation ofMSE after adding 10 dB WGN denoising to different signals.


## 5. Conclusion

This paper proposes an effective ECG denoising method based on EMD, sample entropy, and improved threshold function. The main purpose of this work is to combine EMD and sample entropy in order to determine the order of IMFs that need to be denoised, as well as to denoise these IMFs with the threshold function proposed in this paper. While traditional EMD denoising often discards the first IMF directly in order to remove high-frequency noise, this approach not only results in some important information being discarded but also does not completely denoise the signal. In this paper, different types of noise are added to prove the robustness of the proposed denoising method. At the same time, the effectiveness of the proposed method is evaluated by means of improving SNR and MSE. The technique is compared with ECG denoising methods based on the EMD soft threshold [25], wavelet soft threshold [26], EMD wavelet [27], NLM [28], and CEEMDAN [29]. From the simulation study and detailed analysis, it can be seen that the proposed ECG denoising method is better than the existing technology. In-depth qualitative and quantitative analyses reveal that the proposed method can better reduce the noise of ECG signals while also retaining more details of the original signal, meaning that it is a good ECG signal denoising method. In the future work, we can further feature extraction of ECG signals and research on the computer-based automatic diagnosis system. Moreover, many video/image processing methods [30–34] will be adopted to denoise ECG signals. We will also try to apply deep learning [35–40] and network optimization [41–43] methods to process ECG signals. Furthermore, we will use the big data processing approaches [44–48] to process a large number of ECG signals.



---

*Source: 8811962-2020-12-22.xml*