You are on page 1of 9

Biomedical Signal Processing and Control 71 (2022) 103275

Contents lists available at ScienceDirect

Biomedical Signal Processing and Control


journal homepage: www.elsevier.com/locate/bspc

A deep learning-based framework For ECG signal denoising based on


stacked cardiac cycle tensor
Arash Rasti-Meymandi , Aboozar Ghaffari *
Biomedical Engineering Department, School of Electrical Engineering, Iran
University of Science and Technology, Tehran, Iran

A R T I C L E I N F O A B S T R A C T

Keywords: The Electrocardiogram (ECG) signal is one of the frequently used non-invasive physiological measurement
Denoising techniques for heart diagnosis. However, ECG signal is often contaminated with various noise and artifacts which
ECG make the diagnosis a challenging task. Recent deep learning models have had promising results in dealing with
Non-local cycles
the noises, however, they only considered the 1D time series of the ECG signal. This paper presents a novel deep
Deep model
Convolutional neural network
learning-based Electrocardiogram (ECG) denoising approach based on the periodicity of the ECG signals. In this
work, ECG cardiac cycles are stacked together to form a 2D signal which will be fed to a convolutional neural
network (CNN) model. Accordingly, the correlation between cardiac cycles can be exploited, resulting in an
efficient and robust ECG denoising. The proposed CNN model is equipped with a novel local/non-local cycle
observation (LNC) module to account for the correlation between the cycles. The proposed framework is applied
to the publicly available MIT-BIH Arrhythmia database. Various experiments on different noise conditions have
been conducted to evaluate the effectiveness of the design. The results have shown the superiority of our
framework over the existing state-of-the-art approaches in terms of the Root-Mean-Square Error (RMSE) and
improvement in Signal-To-Noise Ratio (SNRimp ).

1. Introduction white Gaussian noise (AWGN) exist in the ECG signal as well[6]. The
first one only adds 50/60 hertz line frequency, while the latter one af­
Electrocardiogram (ECG) is the most used measurement technique fects the entire frequency band of the ECG signal.
for heart diagnosis. ECG is produced as the result of depolarization and ECG denoising has been received much attention throughout the
repolarization of the heart muscles. Multiple characteristics of the literature. Perhaps, the first attempts are based on classical linear filters
heart’s functionality can be investigated through an ECG signal such as such as low-pass filter, adaptive filter, and the filter banks [7–9].
QRS complex, P, T, and U waves. Medical experts may further utilize Moreover, some authors employed least mean square (LMS) [10],
these characteristics to determine a wide variety of cardiovascular dis­ recursive mean square [11], and Kalman filter [12–15]. One of the
eases like atrial fibrillation, atrial flutter, arrhythmia, sinus tachycardia, drawbacks of adaptive filtering is the reference noise signal require­
and sinus bradycardia [1]. Due to the non-invasive acquisition of the ment, which may not be available. Several others applied non-linear
ECG signal in which electrodes are placed on the skin, it is often filtering [16,17]. Signal decomposition techniques in the time domain
contaminated with noises caused by different factors [2]. Therefore, to have also attracted great attention [18–22]. The most popular ones are
have an efficient diagnosis, the ECG signal must be denoised. The three discrete wavelet transform (DWT), empirical mode decomposition
most dominant noises involved in ECG measurement are: the baseline (EMD) [23]. However, DWT has an issue with low-frequency approxi­
wander (BW) usually caused by the patient respiration or movement [3], mation conefficeint [20]. Moreover, EMD methods have difficulty with
muscle artifacts (MA) generated due to the skeletal muscle activity [4], the distinguishment of high-frequency noise and QRS-complex in the
and electrode motion (EM) arises from electrode impedance and ECG signal. Inspired by the great success in image denoising, non-local
changes in skin potential [5]. Removing these noises is not a trivial task means (NLM) has been shown an effective method for ECG signal
since they corrupt a particular part of the ECG spectrum. Furthermore, denoising [24,6]. The main problem with the NLM method is the rare-
powerline interference (PLI) [5] and channel noises such as additive patch effect [25]. Although, the author in [6] suggested a two-stage

* Corresponding author.
E-mail address: aboozar_ghaffari@iust.ac.ir (A. Ghaffari).

https://doi.org/10.1016/j.bspc.2021.103275
Received 24 July 2021; Received in revised form 30 September 2021; Accepted 15 October 2021
Available online 25 October 2021
1746-8094/© 2021 Elsevier Ltd. All rights reserved.
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

Fig. 1. Overview of our framework. The ECG signal is transformed to form a 2-dimensional tensor by detaching the cardiac cycles and stacking them together. The
resultant tensor is passed to a CNN model (SCEN-Net) to give a cleaned tensor and then transform back to its original 1-dimensional signal representation.

variational mode decomposition plus NLM (VMD-NLM) framework to with these SCC tensors and returns the denoised version of each cycle
lessen the issues with the classical NLM method. A general problem with in the tensor. Afterward, the cycles in the tensor attach to form the
these techniques is their incapability of denoising in a situation where denoised 1-dimensional ECG signal.
different sorts of noises and interference exist. • The proposed network is modified with local/non-local cycle
With the advent of deep learning in the field of image denoising and observation modules (LNC modules) to account for the non-local
their remarkable success, several works have also utilized deep models cycles of ECG signal.
for ECG denoising with inspiring outcomes [26–28]. Some earlier works • The proposed method shows a significant improvement over the
such as [29] employed an artificial neural network (ANN) in conjunction CNN model that only considers the 1-dimensional time series of ECG
with DWT thresholding for ECG denoising. They reported a significant signals. We show that our proposed LNC module substantially im­
improvement over conventional DWT techniques. Authors in [26] used proves the proposed method, especially in the presence of non-
an improved denoising auto-encoder (DAE) with wavelet transform stationary noises.
(WT). They first apply a threshold to the noisy ECG signal using WT and • We show that our proposed model is capable of denoising an ECG
then feed the residual signal to the DAE model. In their report, the SNR signal in various SNR levels, and it is generalized to different noise
improvement was better than the individual WT or DAE method. sources.
Another recent work in the field of ECG denoising was introduced in
[30]. Their framework was based on the generative adversarial network, The remainder of this paper is organized as follows. In Section 2, the
and they have achieved better results compared to the work in [26]. We ECG denoising procedure and the novel LNC module are explained in
encourage readers to study more about ECG denoising techniques and detail. The experimental results are reported in Section 3. An investi­
their comparisons in [31]. gation on the performance of the framework and some remarks are
Although most of the deep learning-based denoising techniques re­ presented in Section 4, and finally, the conclusion is gathered in Section
ported superior results in contrast to DWT, EMD, NLM, etc., they only 5.
considered the ECG signal’s time-series relationship. Furthermore, the
results of their work also indicate that there are still rooms for further 2. Proposed method
improvement, especially in noise conditions such as EM and MA.
There are also some works in the literature regarding the exploitation In this section, we elaborate on the proposed approach for ECG signal
of cardiac cycles’ correlation by transforming the 1D signal into 2D denoising. Given a noisy ECG signal, the goal is to denoise the signal by
tensors. Considering the stacked cycles of an ECG signal dates back to considering both the time-domain and periodicity of an ECG signal
many years ago. Authors in [32], introduced an improved wavelet-based behavioral. The block diagram of our framework is illustrated in Fig. 1.
2D ECG data compression method by considering both interbeat and As the pre-processing step, we first locate the R-peaks of ECG signals.
inter-sample redundancies in the ECG signal. In recent works such as Next, we create a 2-dimensional representation of an ECG signal by
[33], authors transformed 1D ECG signal into 2D ECG image for the detaching the cardiac cycles involved in the signal. The reason behind
application of user recognition. Another work in [34], transformed a 1D such representation is to take the pseudo-periodicity of the signal into
ECG signal into a 2D spectrogram by applying a continuous wavelet account. Due to the variability of ECG cardiac cycles, a time-domain
transform for arrhythmia detection although, it differs from stacking interpolation is applied to equalize the number of samples of each
cardiac cycles for the sake of their correlation. cycle. We then are able to create SCC tensors by concatenating the 1-
In this work, we have developed an end-to-end stacked cardiac cycle dimensional cycles to form a 2-dimensional tensor. An encoder-
ECG denoising based on a 2-dimensional deep convolutional neural decoder architecture (SCEN-Net) is used to act as a block of image-
network (CNN), namely as “SCED-Net”. The key contributions of our denoising on SCC tensors. The network is enhanced specifically for
work are summarized as follows. SCC tensor denoising by considering local and non-local cycles in SCC
tensors. Finally, a post-processing operation converts each SCC back to
• We have considered the pseudo-periodicity of the ECG signal by the 1-dimensional ECG signal. The following is the detailed instruction
detaching each cardiac cycle and creating a stacked cardiac cycle of our framework implementation.
(SCC) tensor to form a 2-dimensional signal. The CNN model is fed

2
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

Fig. 2. An illustration of the LNC block and how it performs. (a) block description (b) the kernel size and their dilation representation in Convolution layers.

2.1. Pre-processing on ECG signal fact, a dual relationship between zero-padding the cycles in the time-
domain and Fourier-domain. As a result, both zero-padding and inter­
2.1.1. R-peaks detection and Signal detaching polation in the time-domain act similarly due to this duality. However,
The nature of an ECG signal is considered to be periodic. However, when the signal is interpolated in the time-domain, the stacked cycles
the periodicity may be corrupted due to various factors, making the ECG exhibit more correlation than when they are zero-padded. Moreover, the
a pseudo-periodic signal. Therefore, to consider this behavior, a time- kernels of the CNN model might have difficulty extracting features from
varying lag τi is defined. A noisy ECG can be modeled by non-even zero-padded cycles in TSCC .
xn (t) = x(t) + n(t), (1) Due to the variability of the number of samples in xicyc , Ncyc must be
selected carefully so that xicyc always needs to be up-sampled. Therefore,
where xn (t), x(t) and n(t) are the noisy ECG signal, the clean ECG, and
the additive noise, respectively. In order to calculate τi , R-peak locations we should consider the maximum number of samples in xicyc before up-
must be acquired. We employed the real-time implementation of the Pan sampling. Let fs and HRmin be the sampling frequency and the minimum
& Tompkins algorithm [35] to gather R-peaks and denote them as R = heart rate per minute, respectively; the maximum number of samples for
{Ri }m a single cardiac cycle is calculated as follows.
1 where m is the total number of R-peaks. We can now define the
variable τi as follows 60
N max
cyc = fs , (5)
HRmin
τi = ⌊
Ri + Ri+1
2 ⌋
, i = 1, 2, m − 1 (2)
This expression implies that each segment xicyc has at most Nmax
cyc samples.
where ⌊.⋅⌋ is the floor operator. Note that due to the non-stationary Hence, the choice of Ncyc is constrained by Ncyc ⩾Nmax
cyc . This constraint
characteristic of the ECG signal, τi may be variable. Knowing the time- will insure that all xicyc are interpolated properly. Finally, the SCC tensors
periodic of the ECG signal, we may segment an ECG cardiac cycle as are created by stacking the interpolated cycles denoted by xicyc,ip as
xicyc ∈ [x(t − τi ), x(t − τi+1 )]. (3) [ ]T
TSCC = x1cyc,ip , x2cyc,ip …, xmcyc,ip . (6)
From now on, we consider xicyc as the discrete samples of the continuous
ECG signal. Therefore, an ECG tensor is created by stacking all xicyc in
2.2. SCED-Net Architecture
rows as follows
[ ]T
2.2.1. Local/non-local cycle observation module
Xstacked = x1cyc , x2cyc …, xmcyc . (4)
As mentioned earlier, the ECG signal has a periodic characteristic in
which each cycle resembles one another. Therefore, a particular cardiac
2.1.2. Signal interpolation and SCC tensor generation cycle not only correlates with its neighboring cycles but also with those
The ECG tensor must be a rectangular matrix to use as an input to a of non-local ones. Traditional convolutional operations, on the other
CNN model. However, xicyc in Xstacked contradicts this constraint. To hand, process local neighborhoods. Therefore, long-range dependencies
tackle this problem, we up-sample each xicyc to have equal total samples in SCC tensors cannot be captured normally unless repeated convolution
denoted by Ncyc . We use the interpolation based on the Fourier transform layers with large kernel sizes are used. However, this makes the network
computationally inefficient and causes optimization difficulty [36].
of each cycle xicyc to produce Ncyc equally spaced points in time-domain
Here, we propose a novel module to involve both local and non-local
where Ncyc is the fixed number of samples that each cycle xicyc must
dependencies of the cardiac cycles in TSCC , e.g., “LNC module”. The
possess in order to create ECG tensors. More specifically, we zero pad the details of LNC can be observed in Fig. 2. It comprises three 2D Convo­
cycle xicyc in Fourier domain by the number (Ncyc − Ni ) where Ni is the lution layers lined up in parallel with different dilation rates. Convolu­
sample number of xicyc and then use inverse Fourier transform to get the tion with dilation rate has been used extensively to overcome the
interpolated signal in the time-domain. Note that the extra samples limitation of the receptive field in CNNs [37,38]. Here, these convolu­
resulted from the interpolation are only used to equalize the sample tion layers consider extracting features from local to non-local cycles in
numbers of xicyc . We further store the number of zeros inserted in xicyc in TSCC as shown in Fig. .2a. Each one is followed by batch normalization
(BN) and leaky-relu with α = 0.01. The consequent extracted feature
their Fourier domain to remove them in the post-processing stage. The
channels are then concatenated and passed to a BN and a 1 × 1 convo­
reason behind up-sampling (and not down-sampling) is that this trick
lution layer. We have also passed the input of the module to a 1 × 1
will lose no information of the actual ECG signal.
convolution and added it to the extracted feature maps to act as a re­
Remark 1. Another technique in equalizing the cycles for constructing sidual connection similar to the original work in [36]. The kernel size of
TSCC tensors is by zero-padding each xicyc in the time-domain. There is, in each convolution layer is set to (3, 7). The dilation rates are set to (1, 1)

3
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

is set for the loss function of the training optimization as follows.

1 ∑N
loss = |T c − T gSCC,n |, (8)
N n=1 SCC,n

g
where T SCC,n and TcSCC,n denote the normalized ground-truth and cleaned
SCC tensors, respectively. Furthermore, since the gradient of the MAE
loss function does not slow down when it is near the convergence point,
a step-decay learning rate is used with an initial learning rate of 10− 3
and a step decay of 0.5 after every 50 epochs.

2.3. Post-processing on SCC tensor

After the SCED-Net outputs the cleaned version T cSCC,n , true ampli­
tudes of the tensor are restored as follows.
Fig. 3. The CNN model architecture for SCC tensor denoising. ( ( ) ( )) ( )
T cSCC = T cSCC,n max T nSCC − min T nSCC + min T nSCC (9)

, (2, 1) and (4, 1) (see Fig. 2b). We do not dilate the kernels in the time- i
domain direction of the input. This is due to the fact that the de­ Next, each cleaned cardiac cycle in T cSCC , denoted by ̂
x cyc,ip , must be
pendencies or correlations mostly exist in stacked cycles direction. It is returned to its original sampling rate. We eliminate the zeros added to
noteworthy to say that the number of parallel convolution layers can be each cycle in their Fourier domain and then, use the inverse Fourier to
extended to more convolution layers with larger dilation rates in order obtain the cleaned cycles with its original sampling rate. This gives us
i
to involve more distant non-local cardiac cycles. Here, we only used x cyc . Finally, the cleaned cardiac cycles can be attached to form the
̂
three layers for the sake of simplicity in representation and imple­ original 1-dimensional representation of the cleaned ECG signal, i.e.,
mentation. The experimental results show how our LNC module with xc (t).
only three convolution layers could considerably improve performance
in the ECG denoising task. 3. Experiments

2.2.2. The CNN model 3.1. Performance metrics


SCED-Net has an encoder-decoder architecture, as shown in Fig. 3.
The input size of the network is set to 32 × 384. Note that in this work we To have an objective evaluation of the proposed framework, three
consider HRmin = 60 bpm. Therefore, according to (5), the sample performance metrics of Signal-to-Noise Ratio (SNR), Signal-to-Noise
number of each xicyc,ip is constraint by Ncyc ⩾360 which is realized in the Ratio Improvement (SNRimp ), and Root-Mean-Squared Error(RMSE)
selected input size. Furthermore, the input of the proposed model is are used similar to the previous works in [26,30,6]. The mathematical
normalized using min–max normalization as follows. formulation of these metrics is as follows.
( )
T nSCC − min T nSCC ∑
N
T nSCC,n = ( n ) ( n ), (7) (xg (t))2
max T SCC − min T SCC
SNR = 10log10 t=1
, (10)

N
(xc (t) − xg (t))2
where min(⋅) and max(⋅) denote the minimum and maximum values for t=1
the tensor and T nSCC,n is the normalized version of noisy SCC tensor TnSCC .
These two values will be further stored in order to recover the true ∑
N
(xn (t) − xg (t))2
amplitudes of the tensor after it is cleaned by SCED-Net.
SNRimp = 10log10 t=1 , (11)
There exist four encoder and decoder blocks in the network. The ∑N
(xc (t) − xg (t))2
encoder blocks contain the LNC modules that extract features from t=1
local/non-local cardiac cycles. Since stacked cycles, e.g., xicyc,ip , may not √̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅

be sufficiently correlated, we use the Max Pooling layer with size (1,2) √1 ∑ N

before going to the next LNC module. This will only down-sample the RMSE = 100√ (xc (t) − xg (t))2 , (12)
N t=1
time direction of each cycle in TSCC . An exception of down-sampling
occurs from the LNC4 to the latent space (see Fig. 3). This is because
where xn (t), xg (t) and xc (t) are the noisy signal, the ground-truth signal
the more we go deep into the network, the more similar each xicyc,ip
and the cleaned ECG signal, respectively.
becomes with each other. The decoder blocks are similar to a residual
block with a 1 × 1 convolution layer in the residual skip connection (see
3.2. Database
Fig. 3). The experiment results show that using the LNC module only in
the encoder path can achieve better performance. This is because the
We use the publicly available MIT-BIH Arrhythmia database for the
decoder path performs the reconstruction of the signal from the
training and testing data[39]. It contains 48 half-hour ECG recordings
extracted features of the encoder path. The Mean-Absolute-Error (MAE)
from different patients, which can provide us with a large dataset for the
proposed framework performance analysis. The sampling rate of all
Table 1 recordings is set to 360 Hz. All recordings consist of two leads. We select
The architecture descriptions used in the evaluation.
lead II as it is the most commonly used lead in ECG recording.
Model Filter-size at each level No. parameters

1D En-Dec {32,64,128,256,384,256,128,64,32} 5,456,481 3.3. Evaluations and results


SCED-Net {16,32,64,128,256,128,64,32,16} 5,039,889
SCED-Net + LNC {16,32,64,128,256,128,64,32,16} 5,389,825
Here we implement three network architectures to assess the impact

4
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

Table 2
The effect of different dilation and kernel size on the performance of the pro­
posed framework in the presence of realistic mixed noises.
Setting SNRimp RMSE

No. dilation blocks kernel size

Non (3,7) 15.31 0.051


2 (3,7) 17.44 0.039
3 (3,7) 18.23 0.034
4 (3,7) 18.31 0.034
3 (5,5) 18.15 0.035
3 (5,12) 18.18 0.035

of using SCC tensors and the proposed LNC module on ECG denoising
Fig. 5. Record by record evaluation of different techniques on ECG denoising.
along with other techniques in the literature. The three networks are i) The records are from the MIT-BTH database and are chosen similar to [24,6].
SCED-Net with LNC module in the encoding path (see Fig. 3), ii) SCED-
Net, which is constructed as the original U-Net in [40], and iii) 1D En-
Dec, which is similar to SCED-Net architecture with the difference of
using 1D convolutions and window size of 1 × 1024 as an input. The
architecture descriptions are presented in Table 1. Note that the number
of parameters for each model is close to each other in order to avoid its
effect on the comparison results. To have a complete evaluation of the
proposed framework, we have conducted three separate experiments.
The training and test data are prepared using all the records in the MIT-
BTH Arrhythmia database. It should be noted that in all experiments the
R-peaks are located after the noise insertion.

3.4. Hyperparameter selection and loss function

3.4.1. Loss function selection


The most widely used loss function is either Mean-Squared-Error
(MSE) or the Mean-Absolute-Error (MAE). There are some in­
vestigations on MAE versus MSE performance and their robustness
against different noises, which concluded that MAE yields better per­
formance [41]. In this regard, we trained the proposed model on real­
istic mixed noises to concur the analysis in [41]. The SNRimp for the MAE
and the MSE loss function are achieved as 19.34 and 17.22, respectively.
As a result, we use the MAE as the loss function for training the proposed
framework.

3.4.2. Dilation blocks and kernels in the LNC module


We have conducted some experiments evaluating the effect of
different the number of parallel blocks with dilation in the LNC module
and the kernel size. Table 2 shows the performance of different networks
equipped with different settings. Note that “No. dilation blocks” in the
table indicate the number of parallel blocks in the LNC module with
different dilation rates. As seen, a larger number of dilation blocks could
result in slightly better performance, however, at the cost of network
complexity. It is also observed that the proposed SCED-Net with di­ Fig. 6. Qualitative results of different techniques on ECG denoising. The
lations (SCED-Net + LNC) significantly outperforms SCED-Net without segment is selected from record 230 with SNRin = 0dB.
the LNC module, which is indicated as ”non“ in Table 2. Since the
improvement is modest among networks with different dilation rates
and kernels, we chose the one with 3 dilations and the kernel size (3, 7)

Fig. 4. Quantitative performance evaluation of various techniques in ECG denoising when the signal is contaminated with AWGN.

5
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

Fig. 7. Comparison results of various deep learning-based approaches. The noisy signals are synthesized using the combination of BW, MA, and EM noise conditions
gathered from [45].

Fig. 8. Objective assessment of the proposed framework as opposed to the conventional 1D En-Dec for ECG denoising. A chunk of data with SNRin = − 1dB from (a)
the record number 122, and (b) the record number 111.

to have a low complexity while obtaining a decent performance. Remark will be further elaborated on in the discussion section.

3.4.3. AWGN noise 3.4.4. Mixed realistic noises


In this experiment, the ECG signal is assumed to be contaminated To analyze the proposed framework performance in the presence of
with AWGN. Our proposed framework is compared with the existing real noises, we collect the BW, MA, and EM noises from the MIT-BIH
ECG denoising algorithms based on NLM-filtering [24], VMD-filtering Noise Stress Test Database (NSTDB)[45]. As suggested in [27], the
[42], and WWF-filtering [43]. 75% of the original dataset is used as noisy signals are created by adding the three noises to the clean dataset
the training while the other 25% is selected as the test data. The original with equal weights. the procedure for creating training and test data is
dataset is used as the clean for the deep-learning models. We prepared the same as [27]. 80% of the dataset is then used for the training with
the noisy training data by adding AWGN to the clean dataset with SNR = { − 2.5,0,2.5,5,7.5}dB. The other 20% is chosen for the test data
SNR = { − 1, 3, 7, 11, 15}dB. The noisy test data is contaminated with with SNR = { − 1, 3, 7}dB. The experimental results of the three net­
AWGN at SNR = {0, 5, 10, 15}dB as suggested in [24,6]. The reason for works along with the FCN architecture introduced in [27] is depicted in
using different SNR in train and test data is to have a more objective Fig. 7. As it can be observed, Using SCC tensors obtains better results
evaluation. The experimental results on the two performance metrics (SCED-Net) compared with one-dimensional ECG signals used in 1D En-
(RMSE and SNRimp ) of various methods performed on the test data are Dec and FCN architectures. We can also see a significant improvement
shown in Fig. 4. As seen, both the SCED-Net architectures give distin­ when the LNC module is embedded within the SCED-Net. An objective
guishable results from the 1D En-Dec network and other classical algo­ evaluation on a chuck of samples from ECG record 122 and 111 at
rithms, particularly at low SNRin . Fig. 5 shows the evaluation of the SNRin = − 1dB is illustrated in Fig. 8. As Seen in Fig. 8b, SCED-Net has
proposed framework on some individual recordings that were used by better preserved the amplitudes of the R-peaks compared to 1D En-Dec.
the existing methods [24,6,44]. As it is observed, both SCED-Nets obtain
the highest SNRimp in all seven recordings. To have a qualitative 3.4.5. BW, MA, and EM noises induced separately
assessment on different methods performance, a chunk of denoised In this experiment, we evaluate the proposed framework on the BW,
samples obtained from the proposed and the existing techniques are MA, and EM noises separately as suggested in [30,26]. The data prep­
illustrated in Fig. 6. Here, the noisy signal from ECG record 230 is aration is the same as the work in [26]. The training data is contami­
contaminated with AWGN at SNR = 0dB. Looking closely, one can nated with BW, MA, EM noises at SNR = { − 1.25, 0, 5}dB. The same
observe how well the P, QRS, and T waves are preserved using the SNRs is considered for the test data. Furthermore, the dataset is split
proposed framework (the bottom signal). Note that the performance of with 75% training data and 25% test data. Here, the test data consists of
SCED-Net with and without the LNC module is quite comparable. This only ten records from the MIT-BIH database to have a fair comparison

6
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

Table 3
Performance comparison of SCED-Net + LNC against the denoising auto-encoder and ECG-GAN on ECG signals corrupted with MA, EM, and BW noises.
Record 103 105 111 116 122 205 213 219 223 230 Average

SNRin BW noise
denoising auto-encoder [26] 0 SNR 23.78 25.40 23.31 23.51 20.07 20.07 21.30 23.02 24.25 22.72 22.74
RMSE 0.026 0.028 0.034 0.027 0.050 0.050 0.032 0.024 0.027 0.037 0.034
1.25 SNR 23.82 25.42 23.32 23.59 20.08 20.08 21.36 23.31 24.41 22.74 22.81
RMSE 0.026 0.028 0.034 0.027 0.050 0.050 0.032 0.023 0.027 0.037 0.033
5 SNR 23.89 25.45 23.35 23.76 20.08 20.08 21.46 24.08 24.64 22.79 22.96
RMSE 0.025 0.027 0.034 0.026 0.050 0.050 0.031 0.021 0.026 0.037 0.033
ECG-GAN [30] 5 SNR 30.70 27.01 28.03 32.49 28.06 25.85 31.66 32.42 31.59 29.17 29.69
RMSE 0.019 0.022 0.014 0.022 0.039 0.021 0.025 0.020 0.021 0.022 0.022
Proposed framework 0 SNR 29.42 28.13 26.82 28.61 28.43 27.54 27.49 27.68 28.02 25.71 27.87
RMSE 0.018 0.021 0.025 0.023 0.037 0.021 0.022 0.021 0.022 0.028 0.023
1.25 SNR 30.16 28.92 27.77 29.45 29.34 28.43 28.62 28.50 28.78 26.63 28.66
RMSE 0.018 0.021 0.023 0.022 0.035 0.019 0.023 0.021 0.022 0.026 0.023
5 SNR 31.34 30.04 29.08 30.89 31.11 29.85 30.17 29.26 29.89 28.06 29.96
RMSE 0.017 0.020 0.014 0.023 0.035 0.017 0.036 0.020 0.021 0.023 0.022
SNRin MA noise
denoising auto-encoder 0 SNR 21.38 24.72 23.15 19.22 19.57 24.23 19.59 18.80 22.91 22.58 21.62
RMSE 0.034 0.030 0.035 0.045 0.040 0.031 0.038 0.039 0.032 0.038 0.036
1.25 SNR 22.41 24.86 23.27 20.22 20.02 24.49 19.78 19.63 23.41 22.60 22.07
RMSE 0.031 0.029 0.034 0.040 0.038 0.030 0.037 0.034 0.030 0.038 0.034
5 SNR 23.33 25.13 23.33 22.41 20.63 24.67 20.63 21.97 24.21 22.63 22.89
RMSE 0.027 0.028 0.034 0.031 0.036 0.030 0.034 0.027 0.028 0.038 0.031
ECG-GAN 5 SNR 25.34 29.01 25.22 30.90 30.51 26.77 27.16 28.27 30.41 29.68 28.32
RMSE 0.018 0.021 0.015 0.019 0.026 0.021 0.026 0.021 0.016 0.015 0.019
Proposed framework 0 SNR 25.77 25.33 21.20 26.04 24.79 24.99 25.43 26.74 25.98 24.02 25.23
RMSE 0.023 0.027 0.022 0.023 0.031 0.024 0.028 0.023 0.025 0.023 0.024
1.25 SNR 26.67 26.33 22.05 27.15 25.67 25.90 26.96 27.22 26.56 25.05 25.95
RMSE 0.023 0.025 0.020 0.022 0.030 0.022 0.027 0.022 0.023 0.022 0.023
5 SNR 27.65 27.51 23.5 28.37 27.06 27.35 28.34 28.74 27.71 26.26 27.24
RMSE 0.017 0.023 0.018 0.021 0.028 0.019 0.025 0.020 0.019 0.020 0.021
SNRin EM noise
denoising auto-encoder 0 SNR 22.75 23.70 23.39 21.34 17.70 23.47 19.33 18.38 23.17 22.40 21.56
RMSE 0.029 0.033 0.034 0.035 0.050 0.033 0.040 0.041 0.031 0.039 0.037
1.25 SNR 22.97 23.94 23.57 21.82 18.76 23.57 19.79 19.07 23.55 22.54 21.96
RMSE 0.029 0.033 0.033 0.033 0.042 0.033 0.037 0.038 0.030 0.038 0.035
5 SNR 23.45 24.66 23.65 23.08 20.81 23.66 20.69 21.01 24.00 22.81 22.78
RMSE 0.027 0.030 0.033 0.030 0.035 0.030 0.034 0.030 0.028 0.037 0.031
ECG-GAN 5 SNR 25.40 26.20 25.38 24.68 30.90 24.80 30.58 26.53 31.05 24.27 26.97
RMSE 0.022 0.024 0.014 0.021 0.028 0.026 0.028 0.025 0.021 0.018 0.022
Proposed framework 0 SNR 27.29 24.85 23.86 26.87 26.31 27.12 25.48 27.05 27.89 23.65 26.04
RMSE 0.019 0.025 0.021 0.020 0.033 0.028 0.036 0.025 0.024 0.019 0.025
1.25 SNR 28.40 26.06 25.16 28.14 27.39 28.22 26.99 27.65 28.74 24.81 27.15
RMSE 0.020 0.025 0.018 0.019 0.032 0.025 0.033 0.025 0.023 0.017 0.022
5 SNR 29.68 27.48 26.73 29.67 28.82 29.34 29.03 28.12 29.45 26.16 28.44
RMSE 0.018 0.024 0.015 0.017 0.029 0.023 0.028 0.024 0.022 0.015 0.021

three separate noise conditions compared to the denoising auto-encoder.


Furthermore, we can observe that although the proposed framework
gives a comparable result with the ECG-GAN for MA noise conditions,
the performance metrics for BW and EM noise conditions are better than
that of the ECG-GAN.

4. Discussion and remarks

This paper presents a novel scheme for a robust ECG denoising under
various noise conditions at different SNRin levels. The network receives
an SCC tensor as an input constructed by stacking the cardiac cycles
together to form a 2D signal. The idea is to consider the periodicity of
ECG signals. The proposed network can consider the local cycles and the
non-local cycles using the proposed novel LNC module. The effect of
Fig. 9. The learning curve of different network architectures in the presence of
both using the SCC tensor and the LNC module in the convergence of the
the realistic mixed noises.
learning process can be observed in Fig. 9. As seen, It is apparent that the
SCED-Net with LNC performs consistently better in terms of SNRimp
with the previous existing works in [30,26]. Table 3 shows the results of throughout the learning process.
the proposed framework compared with the state-of-the-art ECG-GAN Through a careful inspection in Fig. 4 and Fig. 7, one might ask that
[30] and the denoising auto-encoder [26] methods. Note that for the why the SCED-Net embedded with LNC modules compared to simple
ECG-GAN, the authors reported the RMSE and SNRout metrics only at SCED-Net, considerably improves the SNR with the realistic noises
SNRin = 5dB. We can deduce from this table that the proposed frame­ whereas, no improvement is seen for AWGN noise condition? The
work gives a substantially better performance at all the SNRin for the answer perhaps lies within the characteristics of the noises. AWGN is a

7
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

Fig. 10. An exploring examination on the amount of cycle dependency of SECD-Net with and without the LNC module. (a) realistic mixed noise, (b) AWGN noise.

results of this experiment. We can see that the reduction in SNRimp is


much faster than that of the AWGN noise case for the real noise case.
Also, as seen in Fig. 10a, the slope of the reduction curve for SCED-Net
with embedded LNC module is higher than the simple SCED-Net at the
first four categories. The results of this experiment could support our
aforementioned assumption. Therefore, we can speculate that the pro­
posed framework is more capable when it comes to ECG signals with
non-stationary noise characteristics.
Remark 2. One of the problems that arise from using the proposed
scheme is the initiation time of the denoising. The framework requires
32 cardiac cycles to start the denoising. The waiting might be undesir­
able. Hence, to alleviate such a situation, we can repeat the first actual
cardiac cycle 32 times, and when two actual cycles are received, we then
repeat the actual ones until they reach 32 cycles (the framework’s input
is 32 × 384). Therefore, as deduced in Fig. 10, the SNRimp will reach its
maximum performance while improving over the initial time interval. It
is worth mentioning that after the first 32 actual cycles are received, a
moving window of size 32 could be considered to take the newest 32
cycles into account. Accordingly, the framework will operate in real-
time.
Remark 3. Since cycles are collected using R-peaks locations, the role
of the QRS-detector might influence the performance of the network. As
an example, consider a tensor collected from record 214 illustrated in
Fig. 11a. This special record contains multiple ectopic beats in which,
the QRS-detector fallaciously considers them as R-peaks. We can see that
despite the irregularities in the noisy tensor due to wrongly detected R-
peaks, the output tensor of the SCED-Net is sufficiently accurate.
Fig. 11b shows the unrolled versions of the tensors. It is apparent from
Fig. 11. An example of a corrupted tensor with faulty detected R-peaks. (a) Its this figure that the performance is insignificantly decreased from sample
corresponding clean and denoised tensor. (b) The unrolled version of the ten­ 6000 to 9000. This reduction of performance is predictable since these
sors form sample 3000 to 9000. abnormalities have less correlation with most of the ECG signal.
Therefore, the performance of the proposed framework might slightly
stationary noise where the SNR is roughly consistent in each cardiac decrease in case of pathological beats or wrongly detected R-peaks;
cycle. Therefore it does not matter that the correlation of local cycles or however, it still manages to yield a good result.
non-local cycles is considered by the network. On the other hand, BW,
MA, and particularly EM noises are quite non-stationary in which one 5. Conclusion
cycle might be damaged by the noise, whereas the surrounding cycles
might be less affected. In other words, the non-local cycles might have A novel framework specialized for ECG signal denoising was pre­
even more information than the local ones. As a result, The SCED-Net sented in this paper. The proposed framework was based on a con­
with LNC module would prefer to pay more attention to the local/ volutional neural network. It was capable of considering both local and
non-local cycles’ correlation. In order to test this assumption, we car­ non-local cardiac cycles in order to perform an efficient ECG denoising.
ried out the following experiment. We created new data from the test This is a beneficial property since the ECG signal exhibits pseudo-
dataset in five categories in which the cardiac cycles are being repeated periodicity and cardiac cycles tend to have a high correlation. Multi­
to form SCCs. For category one, no repetition is applied; for category ple experiments were conducted on noises such as AWGN, BW, MA, and
two, half of the cycles are repeated (meaning only 16 out of 32 EM. The proposed framework showed a substantially better perfor­
consecutive cycles are unique); for category three, a quarter of the total mance compared to the networks with 1D time-series input signal and
cycles are unique, and so on. The reason for the manual repetition is to other existing state-of-the-art approaches. In addition, further assess­
evaluate the dependency of the network on the local/non-local cycles. ment of the proposed framework suggested that it is particularly well-
Therefore, if the dependency is high, SNRimp should decrease fast as the suited for removing non-stationary noises such as MA and EM.
number of repetitions in each category increases. Fig. 10 shows the Currently, our model is designed to select non-local cycles at some

8
A. Rasti-Meymandi and A. Ghaffari Biomedical Signal Processing and Control 71 (2022) 103275

predetermined intervals with the use of dilated convolution layers. [19] S. Mishra, D. Das, R. Kumar, P. Sumathi, A power-line interference canceler based
on sliding dft phase locking scheme for ecg signals, IEEE Transactions on
Further investigation on how to dynamically select the non-local cycles
Instrumentation and Measurement 64 (1) (2014) 132–142.
would be advantageous which is left for future work. [20] M.A. Kabir, C. Shahnaz, Denoising of ecg signals based on noise reduction
algorithms in emd and wavelet domains, Biomedical Signal Processing and Control
CRediT authorship contribution statement 7 (5) (2012) 481–489.
[21] A.-O. Boudraa, J.-C. Cexus, Emd-based signal filtering, IEEE Transactions on
Instrumentation and Measurement 56 (6) (2007) 2196–2202.
Arash Rasti-Meymandi: Methodology, Software, Validation, [22] B. Weng, M. Blanco-Velasco, K.E. Barner, Ecg denoising based on the empirical
Writing - original draft, Writing - review & editing. Aboozar Ghaffari: mode decomposition, in: International Conference of the IEEE Engineering in
Medicine and Biology Society, IEEE, 2006, pp. 1–4.
Conceptualization, Validation, Investigation, Writing - review & editing, [23] M. Rakshit, S. Das, An efficient ecg denoising methodology using empirical mode
Supervision. decomposition and adaptive switching mean filter, Biomedical Signal Processing
and Control 40 (2018) 140–148.
[24] B.H. Tracey, E.L. Miller, Nonlocal means denoising of ecg signals, IEEE
Declaration of Competing Interest Transactions on Biomedical Engineering 59 (9) (2012) 2383–2386.
[25] T. Torfs, Y.-H. Chen, H. Kim, R.F. Yazicioglu, Noncontact ecg recording system
The authors declare that they have no known competing financial with real time capacitance measurement for motion artifact reduction, IEEE
Transactions on Biomedical Circuits and Systems 8 (5) (2014) 617–625.
interests or personal relationships that could have appeared to influence [26] P. Xiong, H. Wang, M. Liu, S. Zhou, Z. Hou, X. Liu, Ecg signal enhancement based
the work reported in this paper. on improved denoising auto-encoder, Engineering Applications of Artificial
Intelligence 52 (2016) 194–202.
[27] H.-T. Chiang, Y.-Y. Hsieh, S.-W. Fu, K.-H. Hung, Y. Tsao, S.-Y. Chien, Noise
References
reduction in ecg signals using fully convolutional denoising autoencoders, IEEE
Access 7 (2019) 60806–60813.
[1] G.D. Clifford, F. Azuaje, P. McSharry, et al., Advanced methods and tools for ECG [28] C.T. Arsene, R. Hankins, H. Yin, Deep learning models for denoising ecg signals, in:
data analysis, Artech house Boston, 2006. 27th European Signal Processing Conference (EUSIPCO), IEEE, 2019, pp. 1–5.
[2] A. Velayudhan, S. Peter, Noise analysis and different denoising techniques of ecg [29] S. Poungponsri, X.-H. Yu, An adaptive filtering approach for electrocardiogram
signal-a survey, IOSR Journal of Electronics and Communication Engineering 3 (ecg) signal noise reduction using neural networks, Neurocomputing 117 (2013)
(2016) 641–644. 206–213.
[3] Y. Luo, R.H. Hargraves, A. Belle, O. Bai, X. Qi, K.R. Ward, M.P. Pfaffenberger, [30] P. Singh, G. Pradhan, A new ecg denoising framework using generative adversarial
K. Najarian, A hierarchical method for removal of baseline drift from biomedical network, IEEE/ACM Transactions on Computational Biology and Bioinformatics
signals: application in ecg analysis, The Scientific World Journal 2013 (2013). (2020).
[4] V. de Pinto, Filters for the reduction of baseline wander and muscle artifact in the [31] S. Chatterjee, R.S. Thakur, R.N. Yadav, L. Gupta, D.K. Raghuvanshi, Review of
ecg, Journal of Electrocardiology 25 (1992) 40–48. noise removal techniques in ecg signals, IET Signal Processing 14 (9) (2020)
[5] G.D. Clifford, F. Azuaje, P. Mcsharry, Ecg statistics, noise, artifacts, and missing 569–590.
data, Advanced Methods and Tools for ECG Data Analysis 6 (2006) 18. [32] S. Sahraeian, E. Fatemizadeh, Wavelet-based 2-d ecg data compression method
[6] P. Singh, G. Pradhan, Exploring the non-local similarity present in variational using spiht and vq coding, in: EUROCON 2007-The International Conference on
mode functions for effective ecg denoising, in: 2018 IEEE International Conference Computer as a Tool, IEEE, 2007, pp. 133–137.
on Acoustics, Speech and Signal Processing (ICASSP), IEEE, 2018, pp. 861–865. [33] M.-G. Kim, H. Ko, S.B. Pan, A study on user recognition using 2d ecg based on
[7] T.-Y. Slonim, M. Slonim, E. Ovsyscher, The use of simple fir filters for filtering of ensemble of deep convolutional neural networks, Journal of Ambient Intelligence
ecg signals and a new method for post-filter signal reconstruction, in: Proceedings and Humanized Computing 11 (5) (2020) 1859–1867.
of Computers in Cardiology Conference, IEEE, 1993. [34] A. Ullah, S. Tu, R.M. Mehmood, M. Ehatisham-ul haq, et al., A hybrid deep cnn
[8] N.V. Thakor, Y.-S. Zhu, Applications of adaptive filtering to ecg analysis: noise model for abnormal arrhythmia detection based on cardiac ecg signal, Sensors 21
cancellation and arrhythmia detection, IEEE Transactions on Biomedical (3) (2021) 951.
Engineering 38 (8) (1991) 785–794. [35] J. Pan, W.J. Tompkins, A real-time qrs detection algorithm, IEEE Transactions on
[9] V.X. Afonso, W. Tompkins, T. Nguyen, S. Trautmann, S. Luo, Filter bank-based Biomedical Engineering BME-32 3 (1985) 230–236, https://doi.org/10.1109/
processing of the stress ecg, in: Proceedings of 17th International Conference of the TBME.1985.325532.
Engineering in Medicine and Biology Society, Vol. 2, IEEE, 1995, pp. 887–888. [36] K. He, X. Zhang, S. Ren, J. Sun, Deep residual learning for image recognition, in:
[10] M.Z. Islam, G.S. Sajjad, M.H. Rahman, A.K. Dey, M.A.M. Biswas, A. Hoque, Proceedings of the IEEE conference on computer vision and pattern recognition,
Performance comparison of modified lms and rls algorithms in de-noising of ecg 2016, pp. 770–778.
signals, Int. J. Eng. Technol. 2 (3) (2012) 466–468. [37] F. Yu, V. Koltun, Multi-scale context aggregation by dilated convolutions, arXiv
[11] N.K. Muhsin, Noise removal of ecg signal using recursive least square algorithms, preprint arXiv:1511.07122 (2015).
Al-Khwarizmi Engineering Journal 7 (1) (2011) 13–21. [38] F. Yu, V. Koltun, T. Funkhouser, Dilated residual networks, in: Proceedings of the
[12] O. Sayadi, M.B. Shamsollahi, Ecg denoising and compression using a modified IEEE conference on computer vision and pattern recognition, 2017, pp. 472–480.
extended kalman filter structure, IEEE Transactions on Biomedical Engineering 55 [39] G.B. Moody, R.G. Mark, The impact of the mit-bih arrhythmia database, IEEE
(9) (2008) 2240–2248. Engineering in Medicine and Biology Magazine 20 (3) (2001) 45–50.
[13] H.D. Hesar, M. Mohebbi, An adaptive kalman filter bank for ecg denoising, IEEE [40] O. Ronneberger, P. Fischer, T. Brox, U-net: Convolutional networks for biomedical
journal of biomedical and health informatics (2020). image segmentation, in: International Conference on Medical image computing
[14] H.D. Hesar, M. Mohebbi, An adaptive particle weighting strategy for ecg denoising and computer-assisted intervention, Springer, 2015, pp. 234–241.
using marginalized particle extended kalman filter: An evaluation in arrhythmia [41] J. Qi, J. Du, S.M. Siniscalchi, X. Ma, C.-H. Lee, On mean absolute error for deep
contexts, IEEE Journal of Biomedical and Health Informatics 21 (6) (2017) neural network based vector-to-vector regression, IEEE Signal Processing Letters
1581–1592. 27 (2020) 1485–1489.
[15] H.D. Hesar, M. Mohebbi, Ecg denoising using marginalized particle extended [42] K. Dragomiretskiy, D. Zosso, Variational mode decomposition, IEEE Transactions
kalman filter with an automatic particle weighting strategy, IEEE Journal of on Signal Processing 62 (3) (2013) 531–544.
Biomedical and Health Informatics 21 (3) (2016) 635–644. [43] L. Smital, M. Vitek, J. Kozumplík, I. Provaznik, Adaptive wavelet wiener filtering of
[16] R. Sameni, M.B. Shamsollahi, C. Jutten, G.D. Clifford, A nonlinear bayesian ecg signals, IEEE Transactions on Biomedical Engineering 60 (2) (2012) 437–445.
filtering framework for ecg denoising, IEEE Transactions on Biomedical [44] M.-B. Hossain, S.K. Bashar, J. Lazaro, N. Reljin, Y. Noh, K.H. Chon, A robust ecg
Engineering 54 (12) (2007) 2172–2185. denoising technique using variable frequency complex demodulation, Computer
[17] T. Schreiber, D.T. Kaplan, Nonlinear noise reduction for electrocardiograms, Methods and Programs in Biomedicine 200 (2021), 105856.
Chaos: An Interdisciplinary, Journal of Nonlinear Science 6 (1) (1996) 87–92. [45] G.B. Moody, W. Muldrow, R.G. Mark, A noise stress test for arrhythmia detectors,
[18] S. Jain, V. Bajaj, A. Kumar, Riemann liouvelle fractional integral based empirical Computers in Cardiology 11 (3) (1984) 381–384.
mode decomposition for ecg denoising, IEEE Journal of Biomedical and Health
Informatics 22 (4) (2017) 1133–1139.

You might also like