Keywords

1 Introduction

Electrocardiogram (ECG) represents the electrical activity of the heart. It is useful in detecting irregularities in the heart rhythm that occur sporadically in the patient’s daily life [24]. An ideal ECG wave constitutes a P-wave, a QRS-complex, and a T-wave that represents atrial depolarization, ventricular depolarization, and ventricular repolarization, respectively. Low-frequency noise caused due to Baseline Wander corrupt ECG recordings. Baseline Wander (BW) ranges between \(0.5 \pm 0.5\) Hz frequency and is caused due to respiration or motion of the subject, dirty leads and improper skin contact of electrode. BW hinders the doctors in analyzing the ST segment as both of them have a similar frequency spectrum [1, 8] and introduces a gradual increase in the amplitude of ECG signal, thereby degrading the PQRST morphology.

1.1 Related Work

Baseline wander removal from ECG signal is not a new problem and has been studied in the past. Papaloukas et al. employed cubic spline curve fitting method for BW removal [21]. Filtering techniques [5, 12, 16, 19, 22, 25] including Non linear filter banks [16], Median Filtering [5], Mean Median Filtering [12], adaptive filters [25] and combination of wavelet and adaptive filters known as Wavelet Adaptive Filtering (WAF) [22] have been also used to reduce distortion in ST segment which is highly affected by BW. Lifting-based discrete wavelet transform [7], statistical techniques like independent component analysis [10] have also been used to remove artefacts from ECG. Filtered residue [13], independent component analysis [2, 10] have also been used for BW removal from ECG singals. BW removal from ECG signal has also been performed using empirical mode decomposition (EMD) and its variants [3, 4, 14, 15, 29, 30]. EMD itself is unable to remove BW as it distorts the QRS complex and attenuates R-peak. So, different techniques were employed in addition to EMD including mathematical morphology [14], adaptive filter [30], and wavelet transform [15]. Ensemble EMD was also used to remove noise [4]. Complete ensemble EMD with adaptive noise and wavelet threshold [29] was also used to remove BW. In most of the aforementioned techniques, filtering, wavelet transform and EMD based methods are prevalent for BW removal. The techniques based on EMD and its variants provide comparatively better results but require a high execution time. EMD performs signal decomposition into high and low frequency components that are commonly known as Intrinsic Mode Function (IMF). High frequency component denotes the QRS complex and high frequency noise such as the interference from power sources. Low frequency components are P, T waves, ST segments and BW. Direct removal of higher order IMF ruptures the ST segment morphology. Hence, EMD is used in tandem with different techniques. The problem with wavelet transform is the requirement of the P, T wave morphology that is difficult to obtain and also the methods fail in the presence of other noises. Recently, variational mode decomposition (VMD) was also used for baseline wander estimation and removal by Prabhakararao et al. [23]. They reported that VMD is better for BW estimation as compared to EMD and DWT.

1.2 Our Contributions

We present a detailed analysis for an efficient estimation of BW using Variational Mode Decomposition. In addition to [23], we varied different parameters of VMD, namely, the bandwidth constraint and number of modes for better decomposition of the input signal into a clean signal and BW. A comparison between different variants of Empirical Mode Decomposition, filtering techniques, namely median, mean median filtering, and Variational Mode Decomposition, is also performed for an effective estimation of BW. The comparison between the techniques depicted that VMD estimates better BW in terms of pearson correlation, percentage root mean square difference, and maximum absolute error with slightly higher execution time required to decompose the signal.

1.3 Paper Organization

The rest of the paper is organized as follows. Section 2 provides a brief description of EMD along with its different variants, VMD, and mean median filtering. Section 3 describes the experimental setup that includes system configuration, data description and evaluation metrics. Section 4 explains the results and discussion followed by Sect. 5 that concludes the paper with the future scope.

2 Brief Description of Techniques

A brief description of the techniques including Empirical Mode Decomposition, Ensemble Empirical Mode Decomposition, Complete Ensemble EMD with Adaptive Noise, Variational Mode Decomposition, and Mean-Median Filtering is provided in subsequent subsections.

2.1 Empirical Mode Decomposition

Empirical Mode Decomposition(EMD) [11] is a data-driven technique that decomposes a non stationary signal (generated from non linear systems) in narrowband monocomponent signals also called as IMFs. IMFs are zero mean amplitude modulated frequency modulated (AMFM) components. However, it is not guaranteed that an IMF consists of a single oscillatory mode, and neither a narrow band signal nor its meaningfulness due to its limitations. The algorithm to calculate EMD of signal y(t) is described as follows:

  1. 1.

    Determine all local maxima \(y_{max}(t)\) and local minima \(y_{min}(t)\) for y(t).

  2. 2.

    Interpolate \(y_{max}(t)\) and \(y_{min}(t)\) using cubic spline.

  3. 3.

    Calculate mean m(t): \(m(t) = (y_{max}(t) + y_{min}(t))/2\).

  4. 4.

    Calculate d(t): \(d(t)=y(t)-m(t)\).

  5. 5.

    Check if d(t) is an IMF using the stopping criteria, if it satisfies the criteria then goto step 6 or else goto step 1.

  6. 6.

    The above procedure is called sifting. After obtaining the first IMF, subtract it from y(t) and obtain the remaining signal. Perform sifting on the obtained signal until the residue persists any meaningful frequency information.

  7. 7.

    The final decomposed signal can be obtained as a sum of IMF’s \(d_n(t)\) and a residue \(r_n(t)\) as provided in Eq. 1.

    $$\begin{aligned} y(t) = \sum ^N_{n=0}{}d_n(t) + r_n(t) \end{aligned}$$
    (1)

2.2 Ensemble Empirical Mode Decomposition

The IMFs obtained using EMD suffers from oscillation with multiple frequencies in a single mode or single frequency in multiple modes. This problem is commonly known as “mode mixing”. Adding multiple realizations of a specific amount of noise removes mode mixing by utlizing the dyadic filter bank behaviour of EMD [9]. This phenomenon was given by Wu et al. [27] and was termed as ensemble EMD (EEMD). EEMD decomposes the original signal for multiple ensembles of noise and produces the modes by averaging. EEMD of signal y(t) is described as follows:

  1. 1.

    Generate a new input by adding multiple noise realizations of \(N(\mu =0,\sigma =1)\).

  2. 2.

    Decompose each new input using EMD and obtain the IMF \(d_k^n\).

  3. 3.

    Assign \({d_k}\) as the \(k^{th}\) IMF obtained from y(t) by averaging the corresponding IMFs as given in Eq. 2

    $$\begin{aligned} {D_k}=\frac{1}{I}\sum ^I_{i=1}{}{d_k}^i \end{aligned}$$
    (2)

Each pair of signal \(+\) noise is individually decomposed and their residue \({r_k}^i={r_k}^{i-1}-{d_k}^i\) is obtained thereby eliminating the estimation of local means.

2.3 Complete Ensemble EMD Using Adaptive Noise

EEMD alleviates mode mixing problem but introduces the problem of residual noise that corresponds to the difference between reconstructed and original signal. Another problem is that the averaging of IMFs is difficult due to the fact that varying number of IMFs are generated by EEMD. This led to the development of CEEMDAN [26] that achieved not only negligible reconstruction error but also solved the problem of varying number of modes for different noise realizations. The basic intuition of CEEMDAN comes from the fact that it utilises all final modes generated by multiple noise realization of signal for the calculation of the next mode.

This estimates the local means of modes in an efficient and sequential manner for each noise realization. Suppose \(E_k(.)\) generates \(k^{th}\) IMF via EMD, where \(w^{(j)}\) has \(N(\mu =0,\sigma =1)\). Then CEEMDAN on signal y(t) is calculated as follows:

  1. 1.

    For every \(j=\{1 \dots J\}\), decompose each \(y^{(j)}=y+{\beta }_0w^{(j)}\) using EMD until the first CEEMDAN mode is obtained. Then compute \(\overline{d_1}=\frac{1}{J}\sum \limits _{j=1}^J d^{(j)}_1\).

  2. 2.

    Calculate first residue using \(r_1=y\ -\overline{d_1}\).

  3. 3.

    Generate first mode of \(r_1+{\beta }_1E_1(w^{(j)})\) by EMD, where \(j=\{1 \dots J\}\) and calculate second CEEMDAN mode as \(\overline{d_2}=\frac{1}{J}\sum \limits _{j=1}^J E_1(r_1+{\beta }_1E_1(w^{(j)}))\).

  4. 4.

    For \(k=\{1 \dots K\}\) calculate the \(k^{th}\) residue as \(r_k=r_{(k-1)}-\overline{d_k}\).

  5. 5.

    Calculate first mode of \(r_k+{\beta }_kE_k(w^{(j)})\) by EMD, where \(j=\{1 \dots J\}\) and calculate the \((k+1)^{th}\) CEEMDAN mode as \(\overline{d_{(k+1)}}=\frac{1}{J}\sum \limits _{j=1}^J E_1(r_k+{\beta }_kE_k(w^{(j)}))\).

  6. 6.

    Goto step 4 for the calculation of next mode k.

Iterate steps 4 to 6 until the residue satisfies IMF conditions or it has less than 3 local extremum points. The last residue satisfies: \(r_K=y -\sum \limits _{k=1}^K\overline{d_k}\), where K is the number of IMFs. Therefore, the overall signal can be represented by Eq. 3.

$$\begin{aligned} x=\sum ^K_{k=1} \overline{d_k}+r_K \end{aligned}$$
(3)

Modes extracted using CEEMDAN provide exact reconstruction of the original signal. Final number of IMFs is solely determined by the data and the stopping criterion. However, CEEMDAN also suffers from residual noise as the signal information appears in higher order IMF as compared to EEMD and some “spurious” lower order modes [26]. Theoretical and mathematical literature still lacks in finding out the number of ensembles and the amplitude of noise to be added in order to boost performance.

2.4 Variational Mode Decomposition

Variational Mode Decomposition (VMD) [6] is also a data adaptive technique that generates the variational modes from multicomponent signal y(t) in an entirely non recursive and concurrent fashion. The variational modes (\(u_k\)) are quasi orthogonal and bandlimited around center frequency (\(\omega _k\)) that are capable to reproduce the input signal. VMD comprises of a strong mathematical framework. It uses the concepts of Wiener filtering, Fourier transform, Hilbert transform, analytic signal and the frequency shifting through harmonic mixing. The algorithm to decompose a signal via VMD is described as follows:

  1. 1.

    For each mode, the analytical signal is computed using the hilbert transform to acquire a unilateral frequency spectrum.

  2. 2.

    The spectrum of the obtained mode is mixed with an exponential that shifts it to an estimated center frequency.

  3. 3.

    The bandwidth of the mode is estimated through the squared norm of the demodulated signal.

The above procedure is performed until convergence. Mathematically, VMD can be calculated using Eq. 4.

$$\begin{aligned} \min _{\{y_{k}\},\{\omega _{k}\}}\left\{ \sum _{k}\left\| \partial _{t}\left[ \left( \delta (t)+\frac{j}{\pi t}\right) *y_{k}(t)\right] e^{-j \omega _{k}t}\right\| _{2}^{2}\right\} s.t. \sum _{k=1}^{K}y_{k}(t)=y(t) \end{aligned}$$
(4)

where, y(t) is the signal to be decomposed, \(u_k\) are the modes obtained after decomposition, \(\omega _k\) is the center frequency of each mode, \(\delta \) is the dirac distribution, t is the time, K is the number of modes and \(*\) is the convolution operator.

2.5 Mean-Median Filtering

Mean-Median Filtering (MMF) [20] utilizes the convex combination of the sample median and sample mean of signal y(t) as provided in Eq. 5.

$$\begin{aligned} MMF = (1-\alpha )*mean(y(t)) + \alpha *median(y(t)) \end{aligned}$$
(5)

where, \(\alpha \in [0,1]\) is the ‘contamination factor’.

3 Experimental Setup

This section describes the system configuration, database used for experimental purposes, proposed workflow, and the evaluation metrics used for comparison of techniques.

3.1 System Configuration

The experiments are performed on a workstation with Intel i5-6500 CPU with a clock frequency of 3.2 GHz and 16 GB of RAM. The code was developed in Python language.

3.2 Dataset Description

MIT-BIH database [17, 18] is used for experimental purposes. It consists of 23 normal ECG and 25 arrhythmic recordings with sampling frequency of 360 Hz for two channels, namely, modified limb lead II (MLII), and V1. We have used MLII lead signal for experimental purposes.

Figure 1a represents a normal sinus rhythm from record 103 that is contaminated with BW and Fig. 1b represents the clean normal sinus rhythm (NSR). Similarly, Fig. 2a represents a segment of ventricular tachycardia (VT) from record 205 that is contaminated with BW and Fig. 2b represents the clean segment of VT.

Fig. 1.
figure 1

Normal sinus rhythm from record 103 of MIT-BIH dataset.

Fig. 2.
figure 2

Ventricular tachycardia segment from record 205 of MIT-BIH dataset.

3.3 Proposed Workflow

The workflow followed in this paper is illustrated in Fig. 3. For testing the robustness of the models, artificially generated noise of frequency around \(0.4\pm 0.4\) Hz was added to the original signal. These frequencies were selected in particular because they correspond to the frequency of BW. The noisy signal was then provided to different baseline wander estimation techniques. The techniques include median filter [16], MMF [20], Blanco EMD [3], combination of MMF with EMD [28], EEMD with fixed cut off frequency [27], and VMD [6]. The estimated baseline is further subtracted from noisy signal producing the clean signal. The clean signal is compared to the noisy signal using the evaluation metrics provided in Sect. 3.4.

Fig. 3.
figure 3

Workflow followed

3.4 Evaluation Metrics

For comparing the clean and noisy signal, three evaluation metrics have been employed. In addition to the metrics, time taken by each technique for BW removal was also taken into account. The evaluation metrics employed are Percentage root mean square difference (PRMSD), Pearson Correlation (PC), and Maximum Absolute Error (MAE) as provided in Eq. 6, 7, and 8, respectively.

$$\begin{aligned} \text {PRMSD} = \sqrt{\frac{\sum \limits _{n=1}^{N}\left[ x(n)-\tilde{x}(n)\right] ^{2}}{\sum \limits _{n=1}^{N}\left[ x(n)\right] ^{2}}} \times 100\% \end{aligned}$$
(6)
$$\begin{aligned} \text {PC} = \frac{N\sum \limits _{n=1}^{N}{x(n)\tilde{x}(n)}-\left( \sum \limits _{n=1}^{N}{x(n)}\sum \limits _{n=1}^{N}{\tilde{x}(n)} \right) }{\sqrt{\left[ N\sum \limits _{n=1}^{N}{x(n)^2} - \left( \sum \limits _{n=1}^{N}{x(n)} \right) ^2 \right] \left[ N\sum \limits _{n=1}^{N}{\tilde{x}(n)^2}- \left( \sum \limits _{n=1}^{N}{\tilde{x}(n)} \right) ^2 \right] }} \end{aligned}$$
(7)
$$\begin{aligned} \text {MAE} = \underset{{n=1}}{\overset{N}{\max }}\{\vert x(n)-\tilde{x}(n)\vert \} \end{aligned}$$
(8)

where, x[n] represents the signal contaminated with baseline wander, \(\tilde{x}[n]\) represents the clean signal and N represents number of samples in the signal. x[n] and \(\tilde{x}[n]\) are similar length signal.

4 Results and Discussion

The baseline wander estimation is performed for two signals from MIT-BIH dataset, namely 103 that represents normal sinus rhythm and 205 that represents ventricular tachycardia segment in this paper. Extensive experimentation is performed for BW removal from normal sinus rhythm using VMD in Sect. 4.1. A comparative analysis is then provided between different techniques: namely, median filter, mean median filter, EMD along with its other variants, and VMD for the task of baseline wander removal from both normal sinus rhythm and ventricular tachycardia segment in Sect. 4.2.

4.1 Analysis of VMD for BW Removal

A detailed analysis is performed for the use of VMD on the task of BW removal from normal sinus rhythm signal. The idea of choosing VMD as compared to other techniques, in particular, is because it is a relatively new technique and is not much explored for this particular task. Moreover, the variational modes extracted by VMD for the corresponding signal precisely captures their center frequencies The trend and mid frequency bands of the obtained modes consists of less spurious oscillations when compared to EMD. In addition to the above characteristics, no additional spectral and temporal feature estimates are required for discriminating the BW components from the ECG.

In [23], authors have used VMD for BW estimation, but the effect of the number of modes (K) and center frequency (\(\omega \)) on the decomposition was not demonstrated. The authors specified that at \(K=8\) and \(\omega =1000000\) modes with least reconstruction error (in least square sense) are obtained. We analyze this effect for normal sinus rhythm having 3500 samples. We decomposed the signal into its variational modes/components using VMD and then reconstructed the original signal back from these variational modes. The difference between the original and reconstructed signal is illustrated with the help of Fig. 4. The number of modes/components varied from 2 to 15 and center frequencies varied from 1000 to 60000.

Fig. 4.
figure 4

Application of Variational Mode Decomposition on Normal Sinus Rhythm where the variational modes vary from 2 to 15 and center frequencies vary from 1000 to 60000.

Few observations can be made from Fig. 4. The PRMSD and MAE are maximum when number of modes is less, and bandwidth constraint is very high. As variational modes increases, the bandwidth constraint should also be increased in order to obtain less error while reconstructing the original signal. As a precise value for number of variational modes and bandwidth constraint was difficult to determine, we choose \(\omega =8000\) and \(K=8\). At these two values least reconstruction error was error was obtained. As specified by [6], both over-binning and under-binning have advantages and disadvantages. During under-binning (less number of variational modes), mode sharing occurs between the neighbouring frequency for small center pulsation and high-frequency variational modes are discarded, as these modes are considered as noise for large pulsation. During over-binning (higher number of variational modes), larger values of pulsation allows a low-frequency band in the decomposed modes providing very compact band in frequency spectrum but with increased execution time for mode extraction. After the signal decomposition using VMD, the baseline wander was mostly present in the \(1^{st}\) component. A similar pattern can be observed for correlation where the PC increases as K and \(\omega \) increase together. In the case of low K and high \(\omega \), the correlation becomes insignificant. The memory consumption also increases by 50 mega bytes for each additional variational mode. The time for mode extraction via VMD increases exponentially with each new mode as depicted in Fig. 4. Hence, for higher number of modes, the execution time of VMD algorithm limits the use in real world.

Therefore, we can infer that there exists a relation between the variational modes and bandwidth constraint such that if either of them increases then the other has to increase in order to produce consistent modes with least reconstruction error in least square sense. It is also clear that larger values of variational modes and bandwidth constraint produce modes with compact frequency spectrum when compared to smaller values, but the execution time and RAM requirement also increases.

4.2 Comparison of VMD with Other Techniques

After selecting parameters \(K=8\) and \(\omega =8000\) for VMD, we compare it with other BW removal techniques. For comparison, median filter, mean median filter and EMD along with its other variants are employed for BW removal in normal sinus rhythm and ventricular tachycardia.

For the first experiment, we employed two median filters [16] in a cascading fashion where the output of first filter was provided as input to second filter and a step like waveform is obtained as the resultant baseline wander. The window length for the filters was kept at 251 and 601 for first and second filter, respectively. Thus providing a high value of correlation between obtained and BW present in the signal.

For the second experiment, mean median filter [20] was chosen. The filters were applied in a similar fashion as the median filters with similar window length with \(\omega =0.6\). The mean median filters produce a very smooth baseline because of the presence of mean filter. The mean filter overestimates baseline wander because of the presence of QRS complex and the median filter produces trimmed mean that in turn leads to severe wave distortion. Hence, MMF not only preserves the outline of baseline wander but also avoids step like waveform as generated by the traditional median filter. However, the drawback is that the discontinuity is still present in the obtained baseline at the signal endpoints.

For the third experiment, Blanco’s EMD. [3] method was chosen where they employed EMD for signal decomposition to IMFs with multiband filtering for BW estimation. We refer to this method as Blanco EMD for the rest of the paper. The EMD algorithm produces high frequencies in lower order IMFs and low frequencies in higher order IMFs. So, the baseline wander was present in higher order IMFs (except the residual mode due to less number of extrema). However, it is worth mentioning the fact that in our implementation, the generated baseline varied from the original baseline. The two baselines were have a phase difference. Hence, if the two baselines are aligned together, they produce a very high correlation. But in this paper we opt for the actual baseline obtained from Blanco EMD method.

BW obtained through MMF resulted in discontinuities at the starting and ending point of the baseline. Hence, the fourth experiment combines MMF and EMD [28], where EMD smoothens the baseline obtained from MMF. Two mean median filters with window length of 250 and 600 were used that produced the BW. The obtained baseline wander was decomposed using EMD and noisy IMFs were removed using statistical methods.

Fig. 5.
figure 5

Comparison between the techniques for BW removal from NSR.

Fig. 6.
figure 6

Comparison between the techniques for BW removal from VT segment.

According to our results, BW was present up to the last 6 IMF with \(L=0.05\). These values were obtained in contrast to the PRMSD and Pearson correlation which turn out to be around 0.85 and 61.37. It can be observed from the Fig. 5 that due to the shifted baseline, the performance metrics deteriorated. We performed two more variations to the [3] approach by employing EEMD and CEEMDAN in place of EMD that helped in better estimation of baseline wander. However, the time required by CEEMDAN was very high making it unreasonable for real-time applications. Hence, we have not included the results of CEEMDAN in this study.

The performance for all the techniques for normal sinus rhythm for all evaluation metrics are provided in Fig. 5. The best PC was obtained for VMD at 0.98 followed by median filter, and EEMD with fix cut off frequency. Median Filter correlation constantly reduced from 0.97 to 0.83 as the artificially induced noise was increased. Except for Blanco EMD method, other techniques did not produce much change in MAE when the noise was increased. Here too, VMD produced least MAE among all at \(27\%\). Median filter, EEMD_Fixcut, and Blanco EMD produced MAE in an increasing fashion as the noise was increased. For PRMSD, median filter and Blanco EMD produced an increase in error as the noise increased. VMD again provided the least error irrespective of the noise. The time taken by decomposition techniques namely EMD, EEMD and VMD were higher than other techniques. Median filter, MMF and MMF-EMD took the least time at around 0.1, 0.6, and 3 s, respectively. VMD took around 5 s. The higher the complexity of the present baseline, the more execution time the algorithm took to decompose the signal. Hence, as the noise increased the time tom decompose also increased. Results for CEEMDAN are not included as its execution time exceeds by a huge margin as compared to other approaches.

Results on VT for all techniques for all evaluation metrics are provided in Fig. 6. The best PC was obtained for VMD at 0.97 followed by EEMD_Fixcut, and median filter. The PC values for MMF and MMF with EMD were better than the ones obtained for NSR. Blanco EMD method performed similar to MMF for high noise frequencies. MAE values kept varying for all the techniques at different noise frequencies. However, VMD provided less error at most of the noise frequencies and MMF, MMF-EMD and Blanco EMD method provided highest error at every noise frequency. VMD, EEMD fix cut constantly low PRMSD ranging between \(20\%\) to \(25\%\). PRMSD for all other methods kept increasing with MMF, MMF-EMD, and Blanco EMD producing the highest PRMSD values. Median filter, MMF and MMF-EMD took the least time, whereas decomposition took relatively higher execution time.

5 Conclusions and Future Work

In this paper, we analysed variational mode decomposition for the task of baseline wander removal from normal and VT segment. An analysis between the relation of K and \(\omega \) is also provided that affects the variational modes obtained from VMD. A comparative study for comparison between different decomposition methods, namely EMD along with its variants, VMD, median filter and MMF was also conducted. We found that VMD performs better in almost all aspects for both the signals at all noise frequencies. However, the time required by VMD was slightly higher than the filtering techniques.

For future research directions, we plan to use the baseline free ECG signal to produce features that characterize an ECG signal in an efficient way such that it can be used to predict different classes of arrhythmia in handheld mobile devices.