Fetal Electrocardiogram Extraction Using Moth Flame Optimization (MFO)-Based Adaptive Filter

A R T I C L E I N F O A B S T R A C T Article history: Received: 04 November, 2020 Accepted: 23 February, 2021 Online: 17 March, 2021 Effective Fetal Electrocardiogram (FECG) Extraction provides medical workers with precise knowledge for monitoring fetal health condition during gestational age. However, Fetal ECG Extraction still remains a challenge as the signal is weak and contaminated with noises of different kinds, more significantly maternal ECG. In this work, a new Moth Flame optimization algorithm (MFO)-based adaptive filter is proposed for the extraction of FECG signal. A noninvasive two-point method is used to record thoracic and abdominal ECG signals from the mother’s body. The abdominal ECG (AECG) signal is made up of fetal heart signal, the distorted maternal heart signal and noise. The thoracic signal contains the undistorted maternal heart signal. The two signals are applied to an adaptive filter whose coefficients are optimally determined by the conventional least means square (LMS) algorithm and MFO. Simulation results using both synthetic signals and the real data from Physionet data base developed by MITBIH show the superiority of the new approach over conventional methods. The performance has been proven by observation of the quality of the extracted wave forms and quantitatively by computing the Signal to Noise ratio (SNR) which was 10.28 for proposed algorithm as compared to 0.1028 for the connectional LMS and mean square error (MSE) which was 0.0215 for the proposed algorithm as compared to 0.0275 for the convectional LMS. The results indicate that the new approach is suitable for Fetal Electrocardiogram extraction from AECG.


Introduction
FECG reflects electrical activity of fetal heart. It can be used to discover Fetal Heart Rate (FHR) and multiple pregnancies and to establish if the fetus is in distress. It is also useful in function parameter analysis of heart for the prevention of neonatal diseases [1]. The two methods used for obtaining FECG are the use of electrodes applied on the scalp of the fetus and through noninvasive recording by placing electrode on mother's abdomen. Invasive recordings achieve better quality but the process is regretfully difficult and only applicable during labor [2]. In contrast, the recording by noninvasive means has the advantage of being simple, noninvasive and can be applied throughout gestational period. That is why medical workers and pregnant women have deeply welcomed it [3].
Research is ongoing on methods of extracting FECG from AECG. MECG is the most influential interference noise signal present in the AECG which has been suppressed using various techniques such as adaptive filters [4], [5] and wavelet transform [6]- [9] among other methods [9], [7]. Two things characterize adaptive filters. First, the type of unit sample response based on which we have Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) filters. Second, the optimization algorithm used. Gradient-based optimization algorithms are popular, but they have the problem of convergence at local minimum for multimodal error surfaces [10]. Attempts to solve the problem of local minima and achieve global optimum solution has led many researchers to introduce the use of global optimization techniques for adaptive filter optimization such as Genetic Algorithm (GA) [11], Simulated Annealing (SA) [12], Tabu Search (TS) [13], Differential Evolution (DE) [14], Particle Swarm Optimization (PSO) [15], Ant-colony (ACO) [16], Artificial intelligence [17] Modified firefly and modified ABC algorithms [18].
In this work, LMS algorithm with its exploitation ability, robustness, ease of implementation, low computational complexity and unbiased convergence [19] is combined with MFO which has high global search (exploration) capability. MFO has the additional advantages of simplicity, flexibility and ease of implementation. Due to these advantages, it has been successfully applied in many optimization applications [20]. Some of these include scheduling [21], classification [22], power energy [23], medical [24], and image processing [25]. However, from available literature, this is the first time MFO is being used for FECG Extraction. Figure 1 illustrates the method of FECG monitoring. Two electrodes are placed on the body of a pregnant woman; one each on her chest and abdomen. Three signals are recorded by the electrode placed on the abdomen. One of them is the corrupted version of the maternal ECG (MECG) signal, i.e.̂( ). The second is FECG signal ( ) and the third is noise from various sources denoted as ƞ( ). Equations (1) to (3) describe the relationship between these signals.

Fetal ECG Monitoring
MECG as recorded by the abdominal electrode is corrupted due to the nonlinear transformation it undergoes as it travels from the chest to the abdomen.

Proposed Extraction Algorithm
The proposed method of adaptive filtering as depicted in Figure  2 consists of two adaptation algorithms; the LMS alone and LMS/MFO. These algorithms (implemented one after the other) were used to update the weights of Finite Impulse Response Filter based on the error signal (desired signal). Here the noisy abdominal signal is given as input and a thoracic electrode output signal is given as reference input to the filter. Since the signal of interest is the fetal heartbeat, maternal heart beat is considered as the interference noise to the signal. The primary signal is the fetal electrocardiogram measured from the abdominal electrode. It consists of mainly maternal heartbeat which dominates the fetal heartbeat and some residual measurement noises. The reference signal is taken from the chest of the mother through thoracic electrode which consists of actual maternal heart beat with some additive noise. Adaptation algorithm here uses the error signal as its input and updates the filter coefficients based on the parameters defined to the filter. The output obtained by the filter should be approximately equal to the noise i.e. the maternal heart beat in the primary signal so that the error signal obtained should be fetal heart signal. The error signal obtained finally corresponds to the fetal heart beat signal but corrupted with residual noises which are in turn eliminated by filtering them out adaptively.

Configuration of the Adaptive Filter
The configuration of the adaptive filter is shown in Figure.   In Figure 3, ( ) is the primary signal while the primary noise is ( ), and the two are uncorrelated. ( ) is the reference signal and it is strongly correlated with ( ) but uncorrelated with ( ). The output error ( ) is given by The error signal serves as the input to the adaptation algorithm [26]- [28] which subsequently adjusts the adaptive filter coefficient vector ( ) depending on some measurements standard. The adaptation process is geared towards minimizing the error signal (in this case the fetal ECG).
According to [26]- [28], the mean square error (MSE) is a measure that shows how effectively a system adapts to a specified solution. The final value of MSE can be used to decide on proficiency of the adaptation algorithm. Consequently, a least value signifies the efficiency of the algorithm and in contrast, a high value normally signifies the inability of the algorithm to model the specified system or the initial state of the adaptive filter is inappropriate starting point to ensure the adaptive filter convergence. The mean square error is given by where E[.] indicates expectation operation. For noise cancellation, the goal is to have a system output best fit in the least squares sense of the signal s(n) . The mean square of error is of interest and can be obtained as follows Taking expectation of both sides Since ( ) is uncorrelated with both ( ) and ( ) Adapting the filter minimizes the mean square of error. This has no effect on the input signal ( ).
If the means square error is minimized, output of the filter, ( ) will be a best least square match to ( ). We can rewrite (4) as Minimizing the mean square error of (10) Minimization of the mean square error makes e(n) to be the most suitable match of the signal s(n) in the least squares sense. This is achieved by adaptive filtering with no a priori information about the signal and noise statistic.

Least Mean Square Algorithm
The popularity of LMS as an adaptive filter algorithm is due to its simplicity, robustness, ease of implementation, low computational complexity, stability and unbiased convergence as reported by [19]. From Figure 3 ( ) = ( ) ( ) (12) where ( ) is a vector representation of the adaptive filter weights and ( ) is a vector of the corresponding delayed values of x(n) as depicted in Figure 3. That is, where and The estimation error, e(n) is given by and the weights are updated as follows where µ is called the step-size, w(n) represents the new coefficient values for the next time interval, x(n) is the filter (reference) input signal, y(n) represent the filtered output, s(n) is the desired response and e(n) is the error function. The convergence of ( ) to the optimum solution and the convergence speed depend on the value of step-size parameter µ.

Moth-Flame Optimization Algorithm (MFO)
Moth-flame optimization (MFO) was initiated by Mirjalili in 2015 [29]. It is among the latest metaheuristic population-based methods. It is an optimization design to mimic the behavior of moth, a type of butterfly species flying in night towards a moon in a straight line known as transverse orientation for navigation. However, turn to spiral motion when encountered with shorter light source. Consequently, this led to the formulation of an interestingly new optimization algorithm. Additionally, MFO was designed to achieve exploration and exploitation goal as it combines population-based algorithm and local search strategy. Also, to prevent the solution being trapped in local minima, the optimal solutions were maintained in each repetition as reported in [29]. The algorithm uses the explorative as well as exploitative search to get an optimized solution.
In the introduced MFO, a moth is considered to be a candidate solution and the position of moth at different search space as problem's variables. Hence, the moth can fly in hyper dimensional space or 3D dimensions and changing their position vectors. Since MFO is population-based, matrix representation of the swarm of moths can be made as in (18) We can evaluate the fitness of each moth by means of the fitness function. The fitness is stored in a matrix as in (19) = The matrix of (20) stores moths best positions in each dimension as flames, while the generated corresponding fitness values are stored as in (21).
The spiral movement of the moth around the flame is represented in (22) , here, , , indicate the spiral motion, is a constant associated with the shape of the spiral movement. is a random variable used to select the position of a moth from the flame. = −1 represents the closest position while = 1 represents the farthest position of the moth. Equation (22) is used to update the position of the moths with the best moth position updating the flame position. Furthermore, the number of flames is decreased in each iteration using (23) where ceil, and , denote round to whole number, the current iteration number and the total number of iterations respectively. MFO process is elucidated in Table 1.
MFO algorithm is illustrated in Table 1. The next stage describes the implementation of MFO in the proposed work.  [29] Initialization of the Moths

MFO Adaptive Filtering
It is noteworthy that we are using the moth flame optimization algorithm to optimize the LMS adaptive filtering algorithm. The moths here represent the filter coefficients to be updated. This means for each filter coefficient ( ( )), there is a moth and the position of the filter coefficient is considered as the position of the moth. This is because the moth is taken to be candidate solution in the search space and when the moth changes position, the filter coefficient is adjusted. The process continues repeatedly until the best coefficients are obtained as in MFO process in Table 1. The number of dimensions, = 3 since the filter coefficients ( ( )) would be placed in a real world environment. The position matrix representing the moth based on filter coefficient ( ( )) is given by (24 here, n is a number representing the length of the coefficient vector ( ( )) in the network. The fitness value of the current filter coefficient ( ( )) is generated by using its distance from the destination. Equation (25) is used to generate the said fitness value.
The matrix of fitness values is as given in (26).
The flame matrix gives the position matrix of the best neighbor filter coefficient ( ( )) to be selected in the route by any filter coefficient ( ( )) given by (27) and corresponding fitness value matrix generated using the (25) is given in the (28 The position of the filter coefficient ( ( )) to be selected next in the route is given by the (29).
The new position obtained using the (12) need not be the exact position of the filter coefficient ( ( )), so the filter coefficient ( ( )) nearest to the updated position is to be selected, so the (12) is applied to generate the matrix in (30).
For the updated matrix to be generated, a quick sort can be performed on matrix . The algorithm would then select or 1 according to the fitness value. In other words, filter coefficients ( ( )) with lower fitness values (which are better) are selected. The estimation error is thus decreased to minimal value.

Generation of Synthetic Signals
A sampling frequency of 4 KHz is used to simulate the maternal ECG shown in Figure 4. Other important parameters for the signal are the approximate heart rate of 89 bmp (beats per minute) and the peak voltage of 3.5 mV. The FHR is normally higher than the maternal heart rate, with the former ranging from 120 bpm to 160 bpm. For the simulated FECG signal the heart rate is 139 bpm and the peak voltage is 0.25 mV. [30] The signal obtained from the abdominal electrode is a noisy signal and is shown in Figure 6. This is to be filtered and given as input to the adaptive noise canceller.
The signal recorded by the thoracic electrode is given as reference signal [30] as shown in Figure 7. This is given as reference input to the adaptive noise canceller.   Figure 8 is the result obtained by training the adaptive noise canceller with LMS algorithm. In fetal ECG extraction QRS complex detection is important so that R-R interval and R peaks can properly be identified. In this case two R peaks indicated by arrows are poorly extracted that may hinder proper monitoring of fetal heart status. Reference Signal R-R interval clearly seen when the moth population was increased to 100. Also, the expected FHR was equally recovered. The FHR was recovered using (31).

Simulation using Synthetic Signals
where is the R-R interval and t is the time interval.      Table 2 shows the results of magnitude of Mean Square Error (MSE) obtained at different moth population (between 20 and 100) at a fixed number of iterations. Table 3 shows the SNR before the application of the proposed technique and after. The SNR is calculated using (34).
where Ps is the signal power, in this case the power of fetal ECG signal ( ) which was obtained using = ( 1) and is the noise power which represents the power of both deformed maternal ECG and white Gaussian noise. It was obtained using where ( ), The result in Table 2 shows that the MSE is low with high population of moth (i.e. 100). The obtained mean square error values show that system has converted to a solution. Table 3 indicates a decrease of MSE and increase of SNR when the proposed algorithm was applied as required.   Table 4 gives performance comparison of the proposed algorithm with conventional LMS and some existing methods. The proposed method shows improvement in SNR and decrease in MSE.

Analysis Using Real ECG Signal
To establish the efficacy of the proposed approach a real abdominal ECG and thoracic ECG data were obtained from Physionet developed by MIT-BIH. Figure 14 and Figure 15 are the abdominal and thoracic ECG signals respectively. After the application of the proposed algorithm, Fetal ECG was extracted as in Figure 16. The R peaks that are used to determine the FHR were efficiently localized.

Performance Comparison with Existing Techniques
The results obtained using proposed LMS/MFO extraction method was compared with selected existing methods and the result is summarized in Table 4. According to [34], actual comparison of the existing techniques for FECG extraction is still difficult due to the differences in dataset, evaluation techniques, etc used by individual researchers. It is thus easier to use specific criteria like improvement in SNR, computational complexity, etc. the following rather subjective criteria were proposed.
Overall performance: This has to do with the robustness of the technique. Performance can be classified as low, medium or high.
Low: Performance is classified as low when the technique is not suitable for FECG extraction but may be used to eliminate specific types of noise like power line interference, baseline wandering, etc. Low performance techniques are primarily capable of NI-FECG preprocessing.
Medium: In this case, techniques are suitable for advanced preprocessing. They are capable of removing most noise types in NI-FECG preprocessing. These include EMG, myopotentials, motion artifacts, among others. Medium performance techniques partly remove MECG thereby enabling the detection of FQRS (Fetal QRS) and consequently the determination of FHR.
High: High performance techniques are the strongest in terms of NI-FECG processing. A high performance technique supplies information on FHR and FECG morphology (PR, QT, ST, etc.).

Improvement in SNR:
Like with overall performance, techniques are categorized into three (i.e. low, medium and high) in terms of SNR improvement. It is noteworthy that SNR accurately verifies proficiency of a technique with respect to some reference value. However, when it comes to clinical applications the use of SNR may not be very helpful. Techniques that show very high performance in the improvement of SNR may not be good in FQRS detection.
Computational Complexity: This is an assessment of the computational requirements of a particular technique. Computational complexity requirements may be high, medium or low. Of course, low is the best.

FHR (R-R):
This is an assessment of the credibility of a technique under investigation in terms of its ability to determine FHR based on R-R interval. Four classes are identified, viz. inaccurate, moderately accurate and very accurate.
Inaccurate: This is when a technique is not capable of effectively removing artifacts and noise for proper detection of the R-R interval. When an inaccurate technique is used to process NI-FECG, the result cannot be used for monitoring FHR.
Moderately accurate: This is when a technique effectively removes most common noises, thus enabling the detection of R-R interval. Of course, the noises are not effectively removed resulting in undetected and false-detected complexes. For moderately accurate techniques, maximum sensitivity is 80%, maximum PPV (positive predictive value) is 90%, maximum accuracy is 80% and probability of correct detection of beats (F1) is 85%.
Accurate: These techniques permit precise FHR detection. Maximum sensitivity is 85%, maximum PPV, 95%, maximum accuracy, 85% and maximum F1, 95%.  Moderately accurate: This is when a technique allows for morphological analysis. The problem, in this case, is that SNR, age of gestation, position of fetus, etc. significantly affect the efficacy of the method except for some tested real data. Thus, for monitoring of T/QRS or QT interval, a moderately accurate technique cannot be used.
Promising: A promising technique has a very high potential of being used for morphological analysis.

Conclusion
A new algorithm for FECG extraction has been presented. The algorithm which combines MFO algorithm and LMS adaptive filtering has two inputs, viz. the abdominal signal which is the major signal of interest and the thoracic signal which serves as the reference input.
The hybrid algorithm has been shown to be better than the LMS adaptive algorithm. Results have shown improvement in the detection of R-peaks of fetal ECG much better with 100 moth population. The superiority of the new approach has been shown quantitatively by MSE and SNR calculation.
A decrease of mean square error of 0.0215 was observed with the proposed algorithms and improvement of signal to noise ratio of 10.28 was also observed.
Comparison with existing methods shows better performance of the proposed approach.
Further research should focus on applying this method for multifetal ECG separation and the use of statistical method of analysis e.g. anova method for comparison of result.