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 () and mean square error (), 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 and a lower . Qualitative and quantitative studies demonstrate that the proposed algorithm is a good ECG signal denoising method.

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 denoising

The rest of this work is organized as follows. In Section 2, 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 zero

The steps in the screening process are as follows: (1)Determine all the maximum and minimum values of the signal , then use the cubic spline method to fit the upper envelope and the lower envelope of the signal (2)Subtract the average value of these two envelope lines from the signal and get (3)Because 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 (4)The first IMF component contains the highest frequency component of the signal. Separate from to obtain a difference signal with the high-frequency components removed, i.e., (5)Repeat steps (1)-(4) with as the new data until all IMFs have been extracted. The filtering process is terminated when the th residual signal satisfies a given termination condition (usually making a monotone function). Therefore, the original data can be represented as the sum of the decomposed IMF and obtained : where is the number of IMFs and is the th-order IMF, while 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 series with length , the entropy calculation process of the sample is as follows: (1)Construct a set of -dimensional vectors , where (2)The absolute value of the maximum value of the difference between the corresponding elements of and is defined as the distance between vectors and and is set as . In short (3)For a given , count the number of for which the distance between and is less than or equal to , record this as , and calculate the ratio of to the total distance: (4)Calculate the average of all as (5)Increase the dimension to and repeat steps (1) to (4): (6)The sample entropy of the time series is thus defined as

As the actual signal cannot approach infinity, we estimate the sample entropy as follows:

In this paper, we take and , where is defined as the standard deviation of the initial data .

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. Figure 1 presents the flow chart of the algorithm proposed in this paper, which will be explained in more detail in the following sections.

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 series and its sample entropy was calculated, where the order of IMF was (2)Let , after which the th IMF and noise sequence are reconstructed. The reconstructed sequence is regarded as a new noise sequence , 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 order as the noisy IMF; that is, is the noise IMF

As 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:

Here, is the coefficient that requires threshold processing, is the threshold, is the coefficient after threshold processing, is the adjustment factor, and is used to control the size of .

When , there is .

When , there is .

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.

Figure 2 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 after the soft threshold function processing and the coefficient before the processing. The improved threshold function is continuous at the threshold point; moreover, as the coefficient continues to increase, the coefficient after the threshold continues to be close to , which eliminates the problem of difference in the soft threshold context.

The threshold selection in this paper uses a fixed threshold. Generally speaking, the fixed threshold value is , where is the standard deviation of the whole noise and is the signal length. Therefore, the obtained by this method is of a fixed size. The IMF coefficients of each layer are different, but the threshold 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:

Here, is the threshold value, is the number of samples, 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:

represents the coefficient of the th-order IMF, while 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)(2)Determine whether the signal point needs to be smoothed. If yes, go to step (3); if not, go to step (4)(3)Consider the former point and the latter point of the signal point . If the two points are between lmax and upmin at the same time, then ; if only or is between lmax and upmin, then or . Next, go to step (4)(4), 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.

Figure 3 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.

We next added the EMG noise to the signal no. 113 record; here, we simulate the EMG interference by adding random noise (where and ). As shown in Figure 4, the algorithm has good robustness for the removal of EMG noise.

Figure 5 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.

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 () and mean square error (). and 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 () refers to the increase of SNR following signal denoising. Generally speaking, a high SNR indicates that the signal contains less noise. 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 for is defined as follows:

The formula for is as follows:

Here, represents the original clean signal, is the signal after adding noise to the original signal, is the signal after denoising, and is the signal length.

Table 1 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 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 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 3 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.

Figure 6 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.

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 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.

In 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. Figures 7 and 8 present a comparison of the and 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 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.

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 [3034] will be adopted to denoise ECG signals. We will also try to apply deep learning [3540] and network optimization [4143] methods to process ECG signals. Furthermore, we will use the big data processing approaches [4448] to process a large number of ECG signals.

Data Availability

The software code and data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

All authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This project is supported by the National Natural Science Foundation of China under Grant 61972057, the Hunan Provincial Natural Science Foundation of China under Grant 2020JJ4626, the Scientific Research Fund of Hunan Provincial Education Department of China under Grants 19B004 and 15C0083, the “Double First-class” International Cooperation and Development Scientific Research Project of Changsha University of Science and Technology under Grant 2018IC25, and the Young Teacher Growth Plan Project of Changsha University of Science and Technology under Grant 2019QJCZ076.