Introduction

The popular technique, used for detection of fetal heart rate before delivery is fetal electrocardiogram (FECG). It shows the muscular function and electrical activity of the fetus heart. It represents the characteristics such as dynamic behaviours, waveform and heart rate of the fetus. These characteristics help to determine the fetal development, the existence of fetal distress, fetal life, fetal maturity or congenital heart disease. So these above characteristics can be used for conduction of appropriate treatment [1]. The non-invasive fetal ECG extraction technique can theoretically be performed at almost any point in the pregnancy [25]. In this method, fetal ECG is recorded by attaching the electrode to the mother’s abdomen. The difficulties of extracting the fetal ECG from the single channel abdominal ECG, are due to the low amplitude and power of the fetal ECG signal and its contamination with noise from various sources [6]. The sources of noise are maternal electromyogram (EMG), maternal ECG, baseline wander, random electronic noise and 50 Hz powerline interference. For the appropriate prediction of the fetal ECG signal, removal of these noise components from the abdominal ECG signal is required. We can use multiple electrodes or single electrode (channel) for the fetal ECG extraction. The advantages of using a single electrode over multiple electrodes for extraction of the fetal ECG are, the fewer electronic components required. So single channel (electrode) can be used as portable and convenient device for the long-term monitoring system [1, 7]. The multi channel fetal ECG extraction technique is unpartical for ambulant household fetal monitoring, because large number of electrodes have to be placed on the body surface of the pregnant woman. Where as single channel fetal ECG technique is needed for the fetal monitoring at home, which provides the possibility of the pregrannat women completing the fetal monitoring by themselves [8].

Various signal processing methods have been used to extract the fetal ECG signal using the abdominal and or the maternal ECG signals. These proposed methods are discrete Fourier transform method [9], adaptive filter [10], correlation technique [11], singular value decomposition [12, 13], sequential processing method (modified template subtraction) [14], non-parametric method [15], wavelet transform [16, 17], neural network technique [18, 19], polynomial network [20], adaptive neuro fuzzy inference system (ANFIS) [21], blind source separation (BSS) [2224], periodic component analysis (πCA) [25], template subtraction method [26], combination of geometric features and wavelet based technique [27], independent component analysis (ICA) with πCA [28], ICA, πCA with extended Kalman smoother (EKS) [29], subset of extended Kalman filter (EKF), principal/independent component analysis, and template subtraction [30]. The techniques described in references [2830] are conceded as outstanding methods to extract the fetal ECG signal using multiple abdominal leads. However, the main target of the work is to extract the fetal ECG signal using the single abdominal lead, these methods described in the references [2830] do not give good performance using the single lead abdominal ECG signal. The reason for not showing good performance using single channel is as, the existing methods described in the references [2830] consider the relationship between channels to be linear but actually a nonlinear relationship exists between the maternal ECG components present in the single channel abdominal ECG and the maternal ECG signal. Other techniques [10, 18] also do not give good results using the single channel abdominal ECG signal [6].

In this work, an addition of the differential evolution (DE) algorithm to EKF [7, 31] with ANFIS has been developed to extract the fetal ECG signal from the single channel abdominal ECG signal. The EKS with ANFIS based technique shows a promising result for extraction of the fetal ECG signal [1]. But the EKS with ANFIS technique sometimes require operator interaction to give better performance, because nlinfit (nonlinear fitness function) is used to assign the parameters and state equation of the EKS to estimate the maternal ECG component. The main task of this study is to develop an efficient ECG signal processing method, which can extract the fetal ECG signal from the single channel abdominal ECG signal and has better performance metrics than the existing methods without the requirement of operator interaction.

Materials and methods

Database

The actual abdominal ECG signals used for the performance evaluation and comparison are taken from non-invasive fetal ECG database [32] and set A of 2013 physionet/computing in cardiology challenge database (PCDB) [33, 34]. The non-invasive fetal ECG database has been made by collecting the ECG signals from a mother between 21 and 40 weeks of her pregnancy. It consists of 55 multichannel records. Each record consists of five or six ECG signals. First two signals in each record are maternal ECG signals, and remaining ECG signals in each record are abdominal ECG signals. The sampling frequency of each ECG signal is 1 KHz [32]. The set A of PCDB consists of 75 multichannel data record from different databases (non-invasive fetal ECG database, abdominal and direct foetal electrocardiogram database and foetal ECG synthetic database). Each record consists of 4 abdominal ECG signals. The sampling frequency of the database is 1 KHz. The duration of each abdominal ECG signal is 1 min. The reference R peak of fetal ECG also provided in the database for evaluation of the algorithm [33, 34].

Eighteen records (\({\text{18 }} \times {\text{ 3 = }} {\text{54 channels}}\)) have been selected for the performance validation using the non-invasive fetal ECG database, where, in any one of the channel of the record, shows clearly visible fetal QRS complex after the removal of the baseline wander and the powerline interference noise [1, 35]. One hundred fifty channels (Where maternal R peaks are visible) have used for performance matrix calculation using set A of PCDB. The detected R peak of the estimated fetal ECG signal by the techniques have been compared with the annotation available for each record for performance matrix calculation.

Performance measurement

The performance metrics (accuracy, sensitivity (Se), positive predictive value (PPV) and F1 statistic) are computed for extracted fetal ECG using one minute of the abdominal ECG signals have been collected from the non-invasive fetal ECG database and PCDB. F1 statistic is a harmonic mean. The R peaks of the estimated fetal ECG have been detected using the improved method for R peak detection using Shannon energy envelope [36] as explained in the phase assignment subsection with the window length of 130 and 155 number of samples of the two moving average filters respectively. To determine the performance metrics, three parameters such as false positive (FP), false negative (FN) and true positive (TP) are calculated. Here, FP denotes the noise peaks detected as fetal R-peaks, FN denotes the fetal R-peaks missed by the proposed technique and TP denotes the fetal R-peaks detected correctly [6]. Each fetal extraction technique has been run 50 times by using the same abdominal channel for evaluation of the performance (positive predictive value, accuracy, sensitivity, and F1 statistics.

$${\text{Se}}{\mkern 1mu} {\text{ = }}{\mkern 1mu} {\mkern 1mu} \frac{{{\text{TP}}}}{{{\text{TP + FN}}}}{\text{ }} \times {\text{ 100 }}\% {\text{ }}$$
(1)
$${\rm{PPV}}{\mkern 1mu} {\rm{ = }}\frac{{{\rm{TP}}}}{{{\rm{TP + FP}}}}{\rm{ }} \times {\rm{ 100 }}\%$$
(2)
$${\rm{Accuracy}}{\mkern 1mu} {\mkern 1mu} {\rm{ = }}{\mkern 1mu} {\mkern 1mu} \frac{{{\rm{TP}}}}{{{\rm{TP + FP + FN}}}}{\rm{ }} \times {\rm{ 100 }}\% {\rm{ }}$$
(3)
$$\text{F1}\,\text{=}\,\text{2}\frac{\text{PPV }\!\!\times\!\!\text{ Se}}{\text{PPV+Se}}$$
(4)

Proposed fetal ECG extraction methodology

The proposed methodology extracts the fetal ECG signal and also able to calculate the heart rate of the fetus from the single channel abdominal ECG signal without the involvement of the operator. The schematic representation of the proposed methodology for extraction of the fetal ECG signal is shown in Fig. 1. The proposed technique has been divided into five stages. Pre-processing stage is the initial stage of the methodology. Phase assignment stage, template estimation stage are second and third stage respectively, the fourth stage is optimized parameters of maternal ECG estimation stage, and final stage is fetal ECG estimation logic stage. In the first stage, the noises (baseline wander, and powerline interference noise) interfered with the fetal ECG signal, are removed from the abdominal ECG signal. The phase calculated for every sample of the abdominal ECG signal is according to the detected maternal R peaks in the phase assignment stage. In the template estimation stage, mean amplitude, mean phase and standard deviation of amplitude of the abdominal ECG signal is computed. In the fourth stage, the amplitude, width, and phase of the maternal ECG components are estimated using the differential evolution algorithm. In the final stage, the fetal ECG signal is estimated using EKS, ANFIS, and non-local mean (NLM) framework. The output of the EKS is passed through the ANFIS network to estimate the actual amount of the maternal ECG signal present in the abdominal ECG signal. To estimate the fetal ECG signal, output of the ANFIS is subtracted from the pre-processed abdominal ECG signal. The estimated fetal ECG signal is passed through NLM to remove noises in the estimated fetal ECG signal. The illustration of every stage of the proposed technique is introduced in subsequent subsections.

Fig. 1
figure 1

Schematic representation of proposed methodology to extract fetal ECG from single channel abdominal ECG

Stage 1: Pre-processing

In this stage, baseline wander, powerline interference noise are eliminated from the abdominal ECG signal. The two stage moving window median filter with window length 200 and 600 ms respectively is used for removal of the baseline wander in the abdominal ECG signal [35]. The reason behind the use of the two stage moving window median filter is, the performance evaluation using Monte Carlo simulation of this filter shows better signal to noise ratio (SNR) improvement than band pass filter, two stage moving window average filter, single stage moving window median filter, and low pass filter at different input SNR using Physikalisch-Technische Bundesanstalt diagnostic ECG database [32] and MIT-BIH noise stress database [32] for creation of ECG signal is shown in [31]. The output of each median filter in this stage and baseline wander removed abdominal ECG signal is shown in Fig. 2.

Fig. 2
figure 2

The output of each stage of median filter and baseline wander noise free abdominal ECG signal (1st channel of a05m of set A of PCDB)

The last part of the first stage is the removal of the powerline interference noise. A notch filter having center frequency at 50 Hz is used for removal of the powerline interference noise [35]. The notch filter is designed by 50 tap finite impulse response (FIR) filter. The baseline wander removed abdominal ECG signal passes through the notch filter to remove the powerline interference noise. The powerline interference noise free abdominal ECG signal is presented in Fig. 3.

Fig. 3
figure 3

Powerline interference noise and baseline wander noise free abdominal ECG signal

Stage 2: Phase assignment

The phase of the abdominal ECG signal is calculated with respect to the identified maternal R peaks to provide the extra support for the fetal ECG signal estimation. The assigned phase is used to estimate the standard deviation of amplitude, mean phase, and mean amplitude (template) of the abdominal ECG signal. The phase information of the abdominal ECG signal will also help to synchronize the EKS with the abdominal ECG signal, without the need for manual synchronization.

In the second stage, the maternal R peak is identified from the abdominal ECG signal, and using the identified maternal R peaks, phase for every instance of the abdominal ECG signal is calculated. The EKS framework requires locations of the true maternal R peaks for better performance to estimate the fetal ECG signal. So, an improved method for R peak identification by using Shannon energy envelope as explained in [36, 37] is used to identify the maternal R peaks using the pre-processed abdominal ECG signal. The used R peak detection technique does not require the amplitude threshold and previous detected R peaks. The R peak detection method shows a sensitivity of 99.95% and an accuracy of 99.84% using MIT-BIH arrhythmia database, 360 Hz is the sampling frequency of the MIT-BIH arrhythmia database [36]. The databases (non-invasive fetal ECG database [32], and PCDB [33, 34]) are used to evaluate the performance of the fetal ECG extraction technique have a sampling frequency of 1000 Hz. So, the length of moving average filters used in the R peak detection technique are 196 and 257 number of samples respectively for detection of maternal R peak in the pre-processed abdominal ECG signal. The maternal R peak of the pre-processed abdominal ECG is shown in Fig. 4.

Fig. 4
figure 4

Maternal R peaks of the pre-processed abdominal ECG signal (1st channel of a05m of set A of PCDB)

The phase of each sample of the abdominal ECG signal is calculated with respect to the locations of the identified maternal R peaks.

Here \(~{{\text{ }\!\!\varphi\!\!\text{ }}_{k}}=\) phase value of ECG sample in the range of \(-\pi\) to \(\pi\).

The calculation of phase for every sample instant of the abdominal ECG signal is a linear warping process by using the detected maternal R peaks from the abdominal ECG signal as explained in [6]. The allotted phase value to every sample instant of the normalized pre-processed abdominal ECG signal is represented in Fig. 5. The formula used for calculation of the normalized pre-processed abdominal ECG signal is as follows:

$$\text{Normalized pre-processd abdominal ECG signal\,=\,}\frac{\text{Pre-processed abdominal ECG signal}}{\text{Maximum amplitude of the pre-processed abdominal ECG signal}}$$
Fig. 5
figure 5

Allocation of phase value to every sample of the normalized abdominal ECG signal (1st channel of a05m of set A of PCDB)

The description of the phase allocation process with the help of an example is expressed in the paper [38].

Stage 3: Template estimation

In the third stage (template estimation stage) of the proposed methodology, templates (mean phase, mean amplitude, and standard deviation of the amplitude) of the abdominal ECG signal are calculated. The mean phase and mean amplitude of the abdominal ECG signal are helpful to predict the maternal ECG component parameters (P, Q, R, S and T wave of the maternal ECG signal) with the help of the differential evolution algorithm. The calculation of mean amplitude along with mean phase supress the amplitude of noise and fetal ECG signal, because the amplitude of fetal ECG signal and noise are very small compared to the maternal ECG component present in the abdominal ECG signal. The calculated mean amplitude of the abdominal ECG signal is similar to the maternal ECG component present in the abdominal ECG signal for one cycle. So maternal ECG component parameters can be calculated by using the DE algorithm with the help of mean amplitude and mean phase of the abdominal ECG signal. These optimized phase values of the maternal ECG components and it’s corresponding amplitude related to mean amplitude of the abdominal ECG signal, optimized width of the maternal ECG signal are used to develop the state equation and also to initialize the process noise covariance matrix of the EKS algorithm. The measurement equation of the EKS framework (measurement noise covariance matrix) is initialized by the standard deviation of the amplitude of the abdominal ECG signal.

The mean phase, mean amplitude and standard deviation of amplitude of the abdominal ECG signal consist of sampling frequency (\(fs\)) number of samples. The mean phase of the abdominal ECG signal consists of the fs number of samples evenly spaced between −π to π. The mean amplitude and the standard deviation of amplitude of the abdominal ECG signal are calculated by using the pre-processed abdominal ECG signal, the assigned phase and the mean phase of the abdominal ECG signal with the help of mean and standard deviation operations respectively. The detail description with an example for calculation of the mean phase, mean amplitude and standard deviation of the amplitude of the ECG signal is described in [7, 38]. The mean amplitude, the mean phase and the standard deviation of amplitude of the abdominal ECG signal is displayed in Fig. 6. The X-axis of the figure corresponds to the mean phase of the abdominal ECG signal. The error bar in this figure corresponds to the standard deviation of amplitude of the abdominal ECG signal around the mean amplitude of the abdominal ECG signal.

Fig. 6
figure 6

Calculated mean phase, mean and standard deviation of amplitude of the abdominal ECG signal (1st channel of a05m of set A of PCDB)

Stage 4: Optimized parameters (maternal ECG components) estimation

The primary target of this stage is to estimate the optimized parameters of the maternal ECG components. These optimized parameters of the maternal ECG components are amplitude (\({{\alpha }_{P}},{{\alpha }_{Q}},{{\alpha }_{R}},{{\alpha }_{S}},{{\alpha }_{T}}\)), width (\({{b}_{P}},{{b}_{Q}},{{b}_{R}},{{b}_{S}},{{b}_{T}}\)) and phase (\({{\theta }_{P}},{{\theta }_{Q}},{{\theta }_{R}},{{\theta }_{S}},{{\theta }_{T}}\)) of the five waves (P, Q, R, S, and T) of the maternal ECG signal. These optimized parameters of the maternal ECG components are used for modelling of the state equation of the EKS. The DE algorithm is used to estimate these optimized parameters of the maternal ECG components by minimizing the objective function.

The DE technique is a population based search technique [39]. The DE algorithm selects “D” number of optimized parameters from the NP, D dimensional parameter vectors within the maximum \(\left( {{X}_{\max }} \right)\) and minimum \(\left( {{X}_{\min }} \right)\) parameter bound corresponding to the objective function using initialization, mutation, crossover, and selection stage, with the help of proper value of scaling factor (F), user specified parameter (CR). Here NP is the number of population, DE/rand/1 is used as a basic mutation strategy and the binomial crossover is used in the crossover stage [38, 39].

In the proposed methodology, the computation of the mean square error is the objective function of the DE algorithm. The mean square error is computed using the synthetic ECG dynamic model [40], the mean amplitude and the mean phase of the abdominal ECG signal. In this work, the synthetic ECG dynamic model described in [30], is employed for the determination of the maternal ECG components from the abdominal ECG signal. A typical ECG signal can be expressed as a combination of five waves, which are defined by their magnitude, duration (width), and phase position expressed as \({{\alpha }_{i}}\), \({{b}_{i}}\),\({{\theta }_{i}}\) respectively [6].

$${\rm{Amplitude\, of\, ECG\, signal}} = {\rm{ }}{Z_k} = - \sum\limits_{i \in W = \{ P,Q,R,S,T\} } {\frac{{{\alpha _i}w({\theta _k} - {\theta _i})}}{{b_i^2}}} \exp \left( {\frac{{ - {{({\theta _k} - {\theta _i})}^2}}}{{2b_i^2}}} \right) + {Z_{k - 1}}$$
(5)

Here \(w=\) angular frequency = \(\frac{1}{T}\), where T =  Time interval between 2 consecutive R peaks.

Here \(W\) represent five waves of the maternal ECG signal.

In this stage, \({{\theta }_{k}}\) is the phase of the mean of the abdominal ECG (\(\overline{ECG}\)). \({{b}_{i}}\) is the width of the five waves of the maternal ECG signal. To estimate the optimized width (duration) of five waves of the maternal ECG signal (\({{b}_{P}},{{b}_{Q}},{{b}_{R}},{{b}_{S}},{{b}_{T}}\)), width of the five waves of the maternal ECG signal in the differential evolution algorithm is varied in the range 0.1 to 0.4, 0.01 to 0.25, 0.01 to 0.25, 0.01 to 0.25 and 0.1 to 0.5 [40] respectively. Similarly to predict the optimized maternal phase \(\left( {\theta _{P} ,\theta _{Q} ,\theta _{R} ,\theta _{S} ,\theta _{T} } \right)\), the phase of five waves of the maternal signal is varied in the range \(\frac{-\pi }{3}\pm 0.6,\frac{-\pi }{12}\pm 0.4,0\pm 0.4,\frac{\pi }{12}\pm 0.4,\frac{\pi }{3}\pm 0.6\) [40] respectively. The optimized amplitude of the fives waves of the maternal ECG components \(\left( {\alpha _{P} ,\alpha _{Q} ,\alpha _{R} ,\alpha _{S} ,\alpha _{T} } \right)\) are the amplitude of mean of the abdominal ECG signal \(({\overline {ECG}} )\) correspond to the phase value of the five waves of the maternal ECG signal \(\left( {\theta _{P} ,\theta _{Q} ,\theta _{R} ,\theta _{S} ,\theta _{T} } \right)\) respectively and \({{Z}_{0}}=0.\) Finally, the objective function (mean square error) is calculated after computation of \({{Z}_{k}}\) for k = 1 to N, where N = length of mean amplitude of the abdominal ECG signal.

$${\text{error}}_{k}\,=\,\overline{{ECG}} _{k} - Z_{k}$$
$${\text{Objective function}}{\mkern 1mu} {\text{ = }}{\mkern 1mu} {\text{mean square error}} = \frac{1}{N}\sum\limits_{{k = 1}}^{N} {\left( {\mathop {error}\limits_{k} } \right)^{2} }$$

In the proposed methodology, differential evolution algorithm is used to estimate ten optimized parameters, with minimum parameters bound = \({{X}_{\min }}=[ \frac{-\pi }{3}-0.6,\frac{-\pi }{12}-0.4,-0.4,\frac{\pi }{12}-0.4,\frac{\pi }{3}-0.6,0.1,0.01,0.01,0.01,0.1 ]\). And maximum parameters bound = \({{X}_{\max }}=[ \frac{-\pi }{3}+0.6,\frac{-\pi }{12}+0.4,0.4,\frac{\pi }{12}+0.4,\frac{\pi }{3}+0.6,0.4,0.25,0.25,0.25,0.5 ].\)

After initialization, the differential evolution algorithm is executed by using mutation, crossover and selection steps of the differential evolution algorithm with the help of the objective function as explained in [38]. Finally, the optimized width of five waves of the maternal ECG signal such as \({{b}_{P}},{{b}_{Q}},{{b}_{R}},{{b}_{S}},{{b}_{T}}\), the optimized maternal phase components value of five waves (\({{\theta }_{P}},{{\theta }_{Q}},{{\theta }_{R}},{{\theta }_{S}},{{\theta }_{T}}\)), and its amplitude correspond to \(\overline{ECG}\) such as \({{\alpha }_{P}},{{\alpha }_{Q}},{{\alpha }_{R}},{{\alpha }_{S}},{{\alpha }_{T}}\) are obtained.

The choice of the parameters [user specified parameter (CR), positive control parameter for scaling (F), and number of population (NP)] (parameter selection) can have a large impact on the optimization performance [41, 42]. For the selection of these parameters (NP, F and CR) the following process was performed using the abdominal ECG signal (channel 1 of a05 of set A of PCDB) [41, 42]. Initially NP, then F and finally CR were selected. For selection of the NP, the objective function (fitness function) was evaluated 50 times, and fitness value (the mean square error) was calculated for each NP (from NP = 10 to NP = 110) with fixed F (F = 0.4) and CR (CR = 0.6) and we got optimized NP is 110 using the abdominal ECG signal. Similarly, for the selection of F, the objective function was evaluated 50 times, and fitness value was calculated for each F (from F = 0.1 to F = 1) with the optimized NP (NP = 110) and the fixed CR (CR = 0.6) and we got the optimized F is 0.6. Similarly, for the selection of CR, the objective function was evaluated 50 times, and fitness value (average of the mean square error) was calculated for each CR (from CR = 0.1 to CR = 1) with the optimized NP (NP = 110) and the optimized F (F = 0.6) and we got the optimized CR is 0.8. Finally, using these selected values of NP, F and CR the objective function was evaluated 50 times, and fitness value was calculated, we got convergence at 613 iterations as shown in Fig. 7.

Fig. 7
figure 7

Estimation of iteration at which convergence occurs, using NP = 110, F = 0.6and CR = 0.8 for 50 run using the preprocessed abdominal ECG signal (1st channel of a05m of set A of PCDB)

Stage 5: Fetal ECG estimation logic

The primary target of the fifth stage is to estimate the fetal ECG signal. In this stage, EKS, ANFIS, and NLM framework is applied to estimate the true fetal ECG signal using the outputs of the previous stages (stage 1–4) of the proposed technique. The schematic representation of the fetal ECG estimation logic stage is shown in Fig. 8. Here EKS estimates the maternal ECG component. ANFIS predicts the actual maternal ECG component present in the pre-processed abdominal ECG signal. After subtracting the output of ANFIS from the pre-processed abdominal ECG signal, the fetal ECG signal is estimated. The estimated fetal ECG signal is passed through NLM to preserve the edges and also to cancel any other noises present in the fetal ECG signal. The output of the NLM gives the true fetal ECG signal. The explanation of every block of the stage is described in the subsequent subsections.

Fig. 8
figure 8

Block diagram of the fetal ECG estimation logic stage

Application of EKS for estimation of maternal ECG

The main aim of this block is to predict the maternal ECG component present in the abdominal ECG signal. The EKS is used to predict the hidden state of a nonlinear system with the help of the appropriate dynamic model and the measured data. The EKS is a combination of forward EKF with backward recursive smoother [38].

The EKF is an algorithm for estimation of the hidden state using the model consist of state equation and measurement equation. The state equation and the measurement equation of the EKF is as follows:

$$\text{State equation}={{S}_{k+1}}=g\left( {{S}_{k}} \right)+{{A}_{k}}~$$
(6)
$$\text{Measurement equation}={{Y}_{k+1}}=h\left( {{S}_{k+1~}} \right)+B{{~}_{k+1}}$$
(7)

Here \({{S}_{k}}\) is state vector, \({{Y}_{k}}\) is measurement vector at instant k, \(g(.)\) is the state evaluation function and \(h(.)\) shows the relationship between the measurement vectors and the state vectors. The process noise vector is \({{A}_{k}}\). Measurement noise vector is \({{B}_{k}}\). The process noise covariance matrix = \({{Q}_{k}}=E\left\{ {{A}_{k}}A\frac{T}{k} \right\}.\) The measurement noise covariance matrix = \({{R}_{k}}=E\left\{ {{B}_{k}}B\frac{T}{k} \right\}.\) In the EKF or EKS, the initial state vector is assumed, and it’s error covariance is \(P_{0} = E\left\{ {\left( {S_{0} - \hat{S}_{0} } \right)\left( {S_{0} - \hat{S}_{0} } \right)^{T} } \right\}.\) The computation steps for solving the above equations are as described in the paper [43].

Here k varies from 0 to N where N = number of samples.

The predictable part of \({{S}_{k+1}}\) \({{\overline{S}}_{k+1}}\) \(g({\mathop {\hat S}\limits^{} {{\mkern 1mu} _k}})'\). Where \(\mathop {\hat S}\limits^{} {{\mkern 1mu} _k}'\)is an optimal estimate of \({{S}_{k}}\).

Finally, \({{\overline{S}}_{k+1}}\) is estimated by using the EKF algorithm. The backward recursive smoothing stage is applied on the output of the EKF (\({{\overline{S}}_{k+1}}\)). This process is recognized as EKS, and it provides the better prediction of the current state. Here fixed interval smoothing stage has been used as the backward recursive smoothing stage [43].

The application of the EKS to predict the maternal ECG component is described as follows:

The reason behind the use of EKS for the estimation of fetal ECG is due to the nonlinear transformation of the maternal ECG as a dominated component present in the abdominal ECG. State equation is the initial step of the EKS. In the proposed methodology, the simplified dynamic ECG model is used to create the state equation. The simplified dynamic model used in the state equation small sampling period of \(\delta\) [44] is as displayed in Eqs. (8) and (9).

$$\theta {}_{k+1}=({{\theta }_{k}}+w\delta )\bmod \left( 2\pi \right)$$
(8)
$${{Z}_{k+1}}=-\sum\limits_{i\in W=\{P,Q,R,S,T\}}{\frac{{{\alpha }_{i}}(\Delta {{\theta }_{i,k}})w\delta }{b_{i}^{2}}\exp \left( \frac{-{{(\Delta {{\theta }_{i,k}})}^{2}}}{2b_{i}^{2}} \right)}+{{Z}_{k}}+\eta$$
(9)

Here \(\Delta {{\theta }_{i,k}}=({{\theta }_{k}}-{{\theta }_{i}})\bmod (2\pi )\) and \(w=\)angular frequency, \(\eta\) is an additive random noise. It is used to represent inaccuracies of the dynamic synthetic ECG model. The summation i is taken over the values of five waves maternal ECG component as estimated in the stage 4, to model the shape of desired maternal ECG signal present in the abdominal ECG signal. Here, \({{\theta }_{k}}\) and \({{Z}_{k}}\) are the state variables, and \(w,\text{ }{{\alpha }_{i}},\text{ }{{\theta }_{i}},\text{ }{{b}_{i}}\text{ }and\text{ }\eta\) are process noises. To map the notation of Eq. (1), the state vector and the process noise vectors are represented as follows: \({{S}_{k}}={{[{{\theta }_{k}},{{Z}_{k}}]}^{T}},\) \({{A}_{k}}=[ {{\alpha }_{P}},{{\alpha }_{Q}},{{\alpha }_{R}},{{\alpha }_{S}},\mathop{\alpha }_{T},{{b}_{P}},{{b}_{Q}},{{b}_{R}},{{b}_{S}},\mathop{b}_{T},\mathop{\theta }_{P},\mathop{\theta }_{Q},\mathop{\theta }_{R},\mathop{\theta }_{S},\mathop{\theta }_{T},w,\eta],\) and the process noise covariance matrix is given as \(\mathop{Q}_{k}=E\left\{ \mathop{A}_{k}\mathop{A}_{k}^{T} \right\}\)

\({{\alpha }_{i}}\), \({{\theta }_{i}}\), \({{b}_{i}}\) are the values of maternal ECG estimated by using DE are used in Eq. (9).

The second step of the EKS is a measurement equation as presented in Eq. (7) which consists of measurement data and measurement function.

Measurement data \({{Y}_{k+1}}={{\left[ \begin{matrix} {{\varphi }_{k+1}} & {{M}_{k+1}} \\\end{matrix} \right]}^{T}}\), here \({{\varphi }_{k+1}}=\) phase of the abdominal ECG at instant k + 1 and \({{M}_{k+1}}=\) magnitude of the ECG sample at instant \(k+1\).

The measurement function \(h({{S}_{k+1}})=S{}_{k+1}.\) The first diagonal entry of the covariance of measurement noise \(\mathop{R}_{k}\) correspond to the time varying variance of the measurement phase noise.

Before computation of EKS, initial state \(\hat{S}_{o}\) and initial covariance \({{P}_{0}}\) values of the EKS are initialized. The initialization values for these parameters are shown as follows:

$$\hat{S}_{o} = \left[ {\begin{array}{*{20}c} { - \pi } & 0 \\ \end{array} } \right]^{T}$$
$${P_0} = \left[ {\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} {{{(2\pi )}^2}}\\ 0 \end{array}}&{\begin{array}{*{20}{c}} 0\\ {10\max {{(|M|)}^2}} \end{array}} \end{array}} \right]$$

here M = amplitude (magnitude) of abdominal ECG signal.

After initialization of the parameters of EKS, the next step is computation. The description of the computation of the EKS is described in [44]. The output of the EKS technique using the abdominal ECG signal (1st channel of a05m of set A of PCDB) is shown in Fig. 9. The output of the EKS algorithm, in the proposed methodology is the estimated maternal ECG component. To get exact amount of maternal ECG signal present in the pre-processed abdominal ECG signal the ANFIS technique is used after the EKS.

Fig. 9
figure 9

The output of the EKS using the abdominal ECG signal (1st channel of a05m of set A of PCDB)

Application of ANFIS for estimation of the fetal ECG signal

The primary target of this block is to estimate the fetal ECG signal from the abdominal ECG signal. ANFIS consists of neural network with fuzzy rules using input vector and target vector for fitting the input vector with the target vector [45]. In the proposed methodology, ANFIS consists of bell type membership function with Sugeno type fuzzy inference system and the combination of least square algorithm and gradient descent method as back propagation is used to train and test the dataset [1, 45]. The description of each step of the ANFIS used in the proposed methodology is explained in detail in [1]. The reason behind the use of the ANFIS in the proposed methodology is due to the nonlinear transformation of the maternal ECG signal present in the abdominal ECG signal [1, 21].

In the proposed methodology, input vector to the ANFIS consists of the estimated maternal ECG component using the EKS technique and a delayed by fifteen samples of the estimated maternal ECG component using the EKS technique, target vector of the ANFIS technique is the pre-processed abdominal ECG signal. The output of the ANFIS is the estimated maternal ECG component present in the pre-processed abdominal ECG signal. After estimation of the actual maternal ECG component present in the abdominal ECG signal using ANFIS, the estimated actual maternal ECG component is subtracted from the pre-processed abdominal ECG signal to get the fetal ECG signal, as the pre-processed abdominal ECG signal is a combination of the maternal ECG component and the fetal ECG signal.

$$\text{estimated fetal ECG signal}\,\text{=}\,\text{ pre-processed abdominal ECG-output of ANFIS}$$

We got the best estimation of the fetal ECG signal by using four membership function and 50 iterations of the ANFIS. The estimation of the fetal ECG signal using EKS with ANFIS approach from the abdominal ECG signal (1st channel of a05m of set A of PCDB) is shown in Fig. 10.

Fig. 10
figure 10

Estimation of the fetal ECG using the EKS with ANFIS technique from the abdominal ECG signal (1st channel of a05m of set A of PCDB)

Application of NLM technique to estimate the true fetal ECG signal

The main target of the NLM block is to estimate the true fetal ECG signal. NLM denoises the signal by averaging different regions with similar characteristic. The explanation of application of the NLM to denoise the ECG signal is described in [46]. The main reason behind the use of the NLM technique in the proposed methodology is to denoise the estimated fetal ECG signal if any noise is present in it, and also to preserve the edges of the estimated fetal ECG signal. The estimated fetal ECG after ANFIS process passes through the NLM technique is the true fetal ECG signal. Here parameters used in the NLM is same as the parameter used in the paper [46] for denoising the ECG signal. Figure 11 show the estimation of the true fetal ECG signal from the abdominal ECG signal (1st channel of a05m of set A of PCDB).

Fig. 11
figure 11

Estimation of the true fetal ECG signal from the abdominal ECG signal (1st channel of a05m of set A of PCDB)

The R peaks of the estimated fetal ECG have been detected using the improved method for R peak detection using Shannon energy envelope [36] as explained in the phase assignment subsection with the window length of 130 and 155 number of samples of the two moving average filters respectively. After successful estimation of the fetal ECG signal, the fetal heart rate (FHR) can be determined by utilizing the locations of the two nearest fetal R-peaks [47].

$${\rm{FHR\, between\, two\, nearest\, fetal\, R\, peaks}}{\kern 1pt} \,{\rm{ = }}\,\frac{{60\mathop f\limits_s }}{n}{\rm{beats/min}} = \frac{{60}}{t}.$$

where \(\mathop{\text{f}}_{\text{s}}\)=sampling frequency, n = number of samples between the two nearest fetal R peaks, t = time interval between two nearest fetal R peaks.

Results

In this section, performance evaluation and comparison of the proposed technique on the actual abdominal ECG signals are presented. This section is divided in to qualitative analysis subsection, and quantitative analysis subsection. In the qualitative analysis subsection, the proposed algorithm (EKS + DE + ANFIS, EKF + DE + ANFIS) have been compared with EKS + ANFIS and EKF + ANFIS for extraction of the fetal ECG signal. In the quantitative analysis subsection, performance of the proposed methodology (EKS + DE + ANFIS, EKF + DE + ANFIS) is validated. To validate the performance, the estimated fetal ECG signal using proposed methodology (EKS + DE + ANFIS and EKF + DE + ANFIS) have been compared with eight other existing fetal ECG estimation technique using single channel abdominal ECG in the quantitative analysis subsection. These techniques are extended Kalman smoother with adaptive neuro-fuzzy inference system (EKS + ANFIS) [1], extended Kalman filter with adaptive neuro-fuzzy inference system (EKF + ANFIS) [1], EKS [31], non-parametric method [15], EKF [31], template subtraction method with principal component analysis (TSPCA), singular value decomposition (SVD) [13], sequential processing method (modified template subtraction) [14], and ∏CA (multi-channel method) [25].

The proposed method is implemented in MATLAB R 2012 A.

Qualitative analysis

Figures 12, 13, 14, and 15 present the comparison of the estimated fetal ECG signal by the proposed technique (EKS + DE + ANFIS, EKF + DE + ANFIS) with the estimated fetal ECG signal by the EKS + ANFIS and EKF + ANFIS using first channel of a01m, a04m, a15m, a22m of set A of PCDB respectively.

Fig. 12
figure 12

Comparison of the extracted fetal ECG by using different techniques from the abdominal ECG signal (1st channel of a01m of set A of PCDB)

Fig. 13
figure 13

Comparison of the extracted fetal ECG by using different techniques from the abdominal ECG signal (1st channel of a04m of set A of PCDB)

Fig. 14
figure 14

Comparison of the extracted fetal ECG by using different techniques from the abdominal ECG signal (1st channel of a15m of set A of PCDB)

Fig. 15
figure 15

Comparison of the extracted fetal ECG by using different techniques from the abdominal ECG signal (1st channel of a22m of set A of PCDB)

Figures 16, 17, and 18 present the extracted fetal ECG by the proposed technique (EKS+DE+ANFIS, EKF+DE+ANFIS) using the third channel of ecgca290, fourth channel of ecgca308, and fifth channel of ecgca445 of non-invasive fetal ECG database respectively.

Fig. 16
figure 16

Extraction of the fetal ECG using EKS + DE and EKF + DE on 3rd ECG signal of ecgca290 from non-invasive fetal ECG database

Fig. 17
figure 17

Extraction of the fetal ECG using EKS + DE and EKF + DE on 4th ECG signal of ecgca308 from non-invasive fetal ECG database

Fig. 18
figure 18

Extraction of the fetal ECG using EKS + DE and EKF + DE on 5th ECG signal of ecgca445 from non-invasive fetal ECG database

All the seven figures (Figs. 12, 13, 14, 15, 16, 17, 18) exhibit that the extracted fetal ECG using the proposed technique (EKS + DE + ANFIS) is similar to the actual fetal ECG signal with very less noise compared to the EKS + ANFIS and the EKF + ANFIS techniques. The figures show that the EKS + DE + ANFIS properly extract the fetal ECG signal from the single channel abdominal ECG signal.

Quantitative analysis

In this subsection performance parameters [accuracy, sensitivity (Se), positive predictive value (PPV), and F1 statistics] of the proposed fetal ECG extraction methodology (EKS + DE + ANFIS, EKF + DE + ANFIS) is compared with other existing methodology.

Table 1 shows the performance comparison of the proposed methodology (EKS+DE+ANFIS, EKF+DE+ANFIS), and other existing techniques, using 54 channels of abdominal ECG from the non-invasive fetal ECG database of 1 min from the beginning of the sample for extraction of the fetal ECG signal. The table shows that EKS + DE + ANFIS method has a superior performance compared to the other fetal ECG extraction methodologies

Table 1 Performance comparison of extracted fetal ECG using different methods from non-invasive fetal ECG database (1 min)

Table 2 shows the performance comparison of the proposed methodology (EKS + DE + ANFIS, EKF + DE + ANFIS), and other existing techniques, using 150 channels of abdominal ECG from the set A of PCDB for extraction of the fetal ECG signal. The table shows that the EKS + DE + ANFIS method has a superior performance to extract the fetal ECG signal compared to the other fetal ECG extraction methodologies.

Table 2 Performance comparison of extracted fetal ECG using different methods from set A of PCDB database

Discussion

Extraction of the fetal ECG signal from the abdominal ECG signal is important to determine the fetal development, the existence of fetal distress, fetal life, fetal maturity or congenital heart disease. Hence these features can be used for conduction of appropriate treatment. Extraction of the fetal ECG signal from the single channel abdominal ECG signal is complicated because the abdominal ECG signal consists of fetal ECG signal, noise, and non-linear transformed maternal ECG signal and dominated by the non-linear transformed maternal ECG signal. Different techniques such as extended Kalman smoother with adaptive neuro-fuzzy inference system (EKS + ANFIS), extended Kalman filter with adaptive neuro-fuzzy inference system (EKF + ANFIS), EKS, non-parametric method, EKF, SVD, template subtraction method with principal component analysis (TSPCA), sequential processing method (modified template subtraction) have been proposed to extract the fetal ECG signal from the single channel abdominal ECG, but these techniques sometimes contains the maternal ECG components with the estimated fetal ECG signal. The proposed method (EKS + DE + ANFIS) shows reduction of the maternal ECG component and noise significantly as displayed in the qualitative analysis subsection.

The EKS + DE + ANFIS technique uses the process noise covariance matrix (\(\mathop{Q}_{k}\)), the simplified dynamic model equation (Eqs. (8) and (9)), the state and measurement equation (Eqs. (6) and (7) respectively) to estimate the maternal ECG component using the single channel abdominal ECG signal. The state equation of the EKS in the EKS + DE + ANFIS technique is modelled by the process noise covariance matrix and the simplified synthetic ECG dynamic model, and they consist of parameters [width, amplitude, and phase (\({{b}_{i}}\),\({{\alpha }_{i}}\),\({{\theta }_{i}}\))] of five of five waves of the maternal ECG signal. The exact initialization of these parameters (\({{b}_{i}}\),\({{\alpha }_{i}}\),\({{\theta }_{i}}\)) in the process noise covariance matrix, the simplified dynamic model, and the state equation is needed for better prediction of the maternal ECG components. However, in the EKS + ANFIS technique, the nonlinear fitness function (nlinfit) algorithm is applied to initialize the maternal ECG parameters (\({{b}_{i}}\),\({{\alpha }_{i}}\),\({{\theta }_{i}}\)), hence the technique sometimes needs operator involvement to initialize of these parameters depend upon the abdominal ECG signal. Whereas the EKS + DE + ANFIS technique computes the parameters (\({{b}_{i}}\),\({{\alpha }_{i}}\),\({{\theta }_{i}}\)) from the abdominal signal itself using the differential evolution algorithm, hence the proposed technique (EKS + DE + ANFIS) provides the better estimation of the parameters of the maternal ECG components than EKS + ANFIS and EKF + ANFIS techniques. The EKS + DE + ANFIS framework applies forward EKF by using the differential evolution algorithm and followed by backward recursive smoothing stage then ANFIS. Hence EKS + DE + ANFIS provides smoother fetal ECG signal compared to the EKF + DE + ANFIS framework.

The proposed methodology (EKS + DE + ANFIS) has been evaluated on non-invasive fetal ECG database, and only training set (set A) of 2013 physionet/computing in cardiology challenge database. But the proposed methodology has not been evaluated on test set (set B) of 2013 physionet/computing in cardiology challenge database. The EKS + DE + ANFIS shows better accuracy, sensitivity, and positive predictive value compared to other existing technique using the single channel abdominal ECG signal as shown in the quantitative evaluation subsection. The performance of the EKS + DE + ANFIS displays better sensitivity, positive predictive value, F1 statistics and accuracy for extraction of the fetal ECG signal because of assignment of perfect values to the measurement noise covariance matrix (\(\mathop{R}_{k}\)). The measurement noise covariance matrix is a diagonal matrix consist of the standard deviation of the abdominal ECG signal. Which is calculated from the abdominal ECG signal itself. The measurement noise covariance matrix is computed without any adaptation strategy, this avoids the overestimation of the measurement noise covariance matrix.

The EKS + DE + ANFIS framework is depended upon the phase assignment as an extra support addition to the abdominal ECG signal for good performance of the EKS and the automatic synchronization. The assignment of phase depends upon the perfect maternal R peaks detection. Hence indirectly, the automatic synchronization and performance of the fetal ECG extraction using the EKS + DE + ANFIS based upon the detected maternal R peaks. Here an improved method based on the Shannon energy envelope has been used to detect the maternal R peaks from the abdominal ECG signal. The improved Shannon energy based R peak detection technique displays better sensitivity, and accuracy to detect the maternal R peak from the noisy abdominal ECG signals like abdominal ECG signals with varying QRS complex of the maternal ECG signal, the muscle artifact and noise, wide maternal QRS complex, abdominal ECG signals with low amplitude. The R peak detection method does not need prior knowledge of the past detected maternal R peak and any amplitude threshold. The improved R peak detection method exhibits better accuracy and sensitivity to detect maternal R peaks than other techniques. As the EKS + DE + ANFIS uses the improved Shannon energy based R peak detection method for detection of the maternal R peaks, so it gives better sensitivity, accuracy, and positive predictive value by using noisy abdominal ECG signal and varying maternal QRS complex.

The ANFIS in the proposed methodology (EKS + DE + ANFIS) estimates the fetal QRS complex in the extreme case like where fetal QRS complex overlaps on the maternal QRS complex and in any condition. As the ANFIS assumes the nonlinear relationship between the input signal (maternal ECG signal) and the target signal (pre-processed abdominal ECG signal), so it can estimate the true maternal ECG component present in the abdominal ECG signal in any situation.

The NLM technique is used in the proposed methodology (EKS + DE + ANFIS) estimates the true fetal ECG signal by removing the noise if present in the estimated fetal ECG signal after the ANFIS process. The NLM technique also preserves the edges, it means the NLM technique smoothen the fetal ECG signal.

The limitation of the proposed methodology (EKS + DE + ANFIS) is, it may give a lower performance for extraction of the fetal ECG signal at lower sampling frequency compared to the extraction of the fetal ECG signal at the higher sampling frequency.

The results have signified that the proposed technique (EKS + DE + ANFIS) can perform as the new framework to extract the fetal ECG signal from the single channel abdominal ECG signal. Furthermore, the results of this study have recommended that the clinical information can be kept by the proposed fetal ECG estimation methodology. After fetal ECG extraction, FHR can be calculated by using the interval between two consecutive R peaks of extracted fetal ECG signal. When FHR is between 120 and 160 bits/min and ventricular rhythm is regular, it is known as normal sinus rhythm of fetus heart. When FHR is more than 160 bits/min it is known as tachycardia of fetus heart, when FHR is less than 120 bits/min is known as bradycardia of fetus heart. When FHR is between 120 and 160 bits/min and ventricular rhythm is irregular is known as arrhythmia. Tachycardia, bradycardia, arrhythmia of the fetus heart is known as abnormal FHR. An abnormal FHR may mean that the fetus is not getting enough oxygen or there are other problems. Sometimes an abnormal pattern also may mean that an emergency or cesarean delivery is needed. Our proposed method with EKS can be applied to detect FHR so that typically asphyxia can be recognized, with sufficient warning to enable intervention by the clinician.

Conclusion

In this paper, five stage based methodology has been proposed to extract the fetal ECG signal from the single channel abdominal ECG signal. The initial stage of the method is pre-processing, and this stage is used for removal of the baseline wander and the powerline interference noises from the single channel abdominal ECG signal. The estimation of the maternal ECG components and other noise components present in the single channel abdominal ECG signal is calculated by using phase assignment, optimized parameters estimation using the differential evolution algorithm, EKS, and ANFIS framework. The fetal ECG is extracted by subtracting the output of ANFIS framework from the pre-processed abdominal ECG signal. Finally, the true fetal ECG signal is estimated by passing the estimated fetal ECG signal through the NLM technique.

The advantage of the proposed methodology is, it does not require operator interaction for initialization of the parameters depend on the abdominal ECG signal. The proposed methodology (EKS + DE + ANFIS) has been evaluated on non-invasive fetal ECG database, and only training set (set A) of 2013 physionet/computing in cardiology challenge database. But the proposed methodology has not been evaluated on test set (set B) of 2013 physionet/computing in cardiology challenge database. The described technique (EKS + DE + ANFIS) yields preferred accuracy, sensitivity and positive predictive value compared to other well existing methods for extraction of the fetal ECG signal from the single channel abdominal ECG signal using non-invasive fetal ECG database, and set A of PCDB. The presented method also shows better accuracy than periodic component analysis method, which uses multiple channels for extraction of the fetal ECG signal.