Classification of Body Movements in Ambulatory ECG Using Wavelet Transform, Adaptive Filter and Artificial Neural Networks

Ambulatory ECG (A-ECG) monitoring provides electrical activity of the heart when a person is involved in doing normal routine activities. Thus, the recorded ECG signal consists of cardiac signal along with motion artifacts introduced due to person’s body movements during routine activities. Detection of motion artifacts due to different physical activities might help in further cardiac diagnosis. Ambulatory ECG signal analysis for detection of various body movements using Discrete Wavelet Transform (DWT) and adaptive filtering approaches has been addressed in this paper. The ECG signals of five healthy subjects (aged between 22 to 30 years) were recorded while the person performs various body movements like up and down movement of left hand, up and down movement of right hand, waist twisting movement while standing and change from sitting down on chair to standing up movement in lead I configuration using BIOPAC MP 36 data acquisition system. The features of motion artifact signal, extracted using Gabor transform, have been fed to the train the artificial neural network (ANN) for classifying body movements.


Introduction
Ambulatory ECG signal monitoring is useful when long term cardiac monitoring of a person is necessary. With Ambulatory ECG device the ECG signal can be recorded while the person can perform daily routine activities. The major challenge with ambulatory ECG monitoring is that the cardiac signal gets contaminated due to motion artifacts resulting due to body movements [1]. Also, the motion artifact signal has spectral overlap with cardiac signal in 1-10 Hz which corresponds to ECG features like P wave and T wave. While attempting to remove motion artifact completely, it also affects the cardiac features [2].
Various techniques have been developed to get information regarding physical activity [3,4]. In the separability of motion artifacts due to different types of PA(Physical Activity) is tested by classifying them automatically based on the nature of movement activity [1,5,6]. A principal component analysis (PCA) based method is used for supervised learning of the classifiers for the same purpose. Back-propagation based neural network is used for characterization of motion artifacts in [7]. In DWT method is used to extract ECG parameters [8], Principal component analysis is used in [1] to estimate the motion artifact component. In various adaptive noise cancellation algorithms such as LMS (Least Mean Square), NLMS (Normalized Least Mean Square) and RLS (Recursive Least Square) are presented [9]. In undecimated wavelet transform is used for denoising ECG [10]. In a simple and efficient normalized LMS algorithm is proposed for removal of noise from ECG signal [11]. In, block LMS algorithm is used to remove artifact preserving low frequency component of ECG [12].
In [13], potential applications of artificial neural networks for ECG signal classification are explored. The organization of the paper is as follows. Data acquisition process is described in A-ECG data acquisition. The extraction of motion artifacts from A-ECG signals using DWT and adaptive filtering approaches is presented in motion artifact extraction form A-ECG Signal. The Gabor transform, used for extracting the features of motion artifacts, and the feature extraction procedure are discussed in Gabor transform for feature extraction. Neural Networks structure describes basic neuron model and the neural network structure used for simulation. The classification results for both approaches are presented in Results followed by conclusion and discussion.
A-ECG data acquisition BIOPAC MP 36 system ( Figure 1) is used for data acquisition process. The specifications used in this study are as follows: bandwidth-0.05 Hz to 35 Hz, sampling frequency-500 Hz, recording duration-60 seconds. The Lead-I configuration is chosen for data acquisition.
The following body movement activities were performed in this experiment for five different subjects:

Motion artifact extraction from A-ECG signal
The A-ECG signal inherently contains the motion artifacts due to the body movements performed by the subject. Two approaches, namely the discrete wavelet transform (DWT) and adaptive filtering, have been applied on the acquired A-ECG signal to extract the motion artifacts. They are briefly discussed in this section.

Discrete Wavelet Transform (DWT):
To apply discrete wavelet transform, GUI based tool called WAVEMENU from the MATLAB Wavelet toolbox [12] was used. First, the ambulatory ECG signal was imported in WAVEMENU. Then the type of wavelet and the number of decomposition levels were chosen. Wavelet coefficients selection was performed such that the synthesized signal approximates the pure cardiac signal.9-level signal decomposition of the input A-ECG signal was performed using 'bior6.8' wavelet. The coefficient selection process involved retaining some fixed percentage of coefficients at each level as shown in Figure 2. In coefficients retaining process, 60%, 80%, 70%, 50%, 40%, 30%, 5%, 3%, 1% and 1% of the coefficients available at A9, D9, D8, D7, D6, D5, D4, D3, D2 and D1levels were kept respectively Figure 2. The coefficients selection procedure was repeated for all the A-ECG signals involving described body movement activities in a similar manner discussed above.
After coefficients selection was done, the obtained synthesized (reconstructed) ECG signal approximates the pure cardiac component of ambulatory ECG. The required motion artifact signal was obtained by subtracting the synthesized ECG signal from ambulatory ECG signal. The result is shown in (Figure 3).

Adaptive filter structure:
The block diagram of adaptive filter system used to derive motion artifact signal from ambulatory ECG signal is shown in (Figure 4). As shown in the diagram, d(n)is the primary input of adaptive filter which indicates ambulatory ECG signal contaminated with motion artifacts. Her sedentary ECG signal is used as reference input r s (n). R-peaks for both the inputs of adaptive filter are detected first. Once R-peaks are detected, they are synchronized such that R-peaks of reference ECG signal are aligned with R-peaks of ambulatory ECG signal. After R-peak synchronization, the synthesized reference ECG is applied as input to adaptive filter. The filter produces the filtered output as y(n). The filtered output y(n) estimates the desired cardiac component of Ambulatory ECG. The filtered output y(n) is subtracted from the ambulatory ECG d(n) which gives the error signal e(n). The error signal e(n) represents the desired motion artifact signal component present in ambulatory ECG signal. Thus, The derived error signal e(n) is fed back to the adaptive filter to modify the weight coefficients of adaptive filter. The weights are updated as below: The filter weight coefficients are adaptively modified by a least mean squares (LMS) algorithm. The parameter µ is known as the step size parameter and is a small positive constant. This step size parameter controls the influence of the updating factor. If the value is too small, the time the adaptive filter takes to converge on the optimal solution   will be too long; if µ is too large the adaptive filter becomes unstable and its output diverges. After the convergence, the adaptively filtered signal y(n) estimates the desired cardiac signal component of acquired ambulatory ECG signal d(n) and the error signal e(n) approximates the motion artifact signal. The extracted motion artifact signal for Left arm body movement activity performed by a single subject is shown in (Figure 5).

Gabor Transform for Feature Extraction
Conventional Fourier Transform is a special linear operator that maps the signal into a set of frequency component. The problem of conventional Fourier Transform is that it does not show where in time these components occur. For stationary signal, conventional Fourier Transform is a favorable representation, since the frequency components of the stationary signal do not change with time, but in real world almost all the signals are non-stationary. Therefore, conventional Fourier Transform might not be suitable to analyze the real signal. Fortunately, we have another tool STFT (short time Fourier transform) for non-stationary signal. Using STFT, we can observe how the frequency of the signal changes with time. Therefore, in real world, Time-Frequency representations are more suitable to analyze signal than the conventional Fourier Transform. STFT uses a fixed sliding window to mask the signal and then transforms it to the frequency domain. The earliest and common window (mask) is rectangular window, which has value 1 in some range and 0 outside the range.
In 1946, Gabor suggested representing a signal in two dimensions, with time and frequency coordinates, and this expansion is called Gabor expansion, which is also a sampled STFT with Gaussian window. Thus Gabor transform uses a Gaussian window as a windowing function. This window function is given as [14], It can be seen that the Gabor transform kernel (window function) is the Fourier transform kernel plus a Gaussian function. Since the Gaussian signal is more concentrated than the rectangular function in the frequency domain, the frequency resolution of the Gabor transform is much better than short time Fourier transform [14]. Gabor transform is used for feature extraction of motion artifact signal obtained using DWT and adaptive filter system. Gabor transform has good timefrequency localization properties. Various subbands of motion artifact signal s (n) are computed by Where, W is the width of moving window. Here g l (n) represents the energy for subband depending on index of l. Here, we have considered first four subbands, i.e. l=1,2,3 and 4. Next, we have formed feature vector as We have selected L=4 in our case. This represents feature of the

Neural Network Structure
Neural networks can mimic the functionality of human brain to small extent. They are very important tool for classification and pattern recognition applications. A basic neuron model is shown in ( Figure  6). It consists of several inputs whose strengths are modified by their synaptic weights. Summing junction adds the weighted inputs together. Bias b k is used to shift the decision boundary of neural network away from the origin. This speeds up the training process of network. The weighted sum is applied as input to activation function to produce the output. Majority of Neural Networks use sigmoid activation functions. An output line transmits the result to other neurons. The output of a neuron is a function of the weighted sum of the inputs plus a bias.
The artificial neural network (ANN) is an important tool for classifying the pattern of data, when a set of feature vector is given as input. ANN has been widely used for various purposes like QRS complex detection, feature extraction, beat and arrhythmia classification [17][18][19][20][21][22]. The derived motion artifacts features can be given as an input to the neural network. Once the network gets trained, it learns by example. So when any arbitrary motion artifact signal is given as an input to neural network, the network will be able to classify the physical activity corresponding to given input motion artifact.
In this work, the Multi-layer perceptron feed-forward (MLPFF) neural network with ten hidden layers is used (Figure 7). The structure consists of input nodes, output node and hidden layer nodes. We applied features corresponding to left arm movement, right arm movement, waist twist movement and sit-stand posture change movement to four input layer neurons as shown. Here, each body movement feature vector is having dimension of 1×4000. Thus, as a whole, we applied 4× 4000 feature matrix to train the network. We have used 10 hidden layer neurons here.
We have assigned target outputs '1', '2', '3' and '4' for left arm movement, right arm movement, posture change from sitting down to standing up movement and waist twist movement respectively for a single person. After training, we applied a feature vector that corresponds to any one movement activity as an input to neural network and checked for the target output classifying the body movement activity. We experimented the similar training and testing procedure for five different subjects. The classification output results for a single subject (subject-1) for all body movement activities are shown in the next section. Figure 8 shows Classification output (top) '1' for Left Arm movement activity as expected. Some of the output sample values are values other than '1' and those are termed as error samples as shown in bottom part. Similarly, we should get outputs '2', '3' and '4' for movements corresponding to right arm, sit stand posture changes and waist twist, respectively. Similar kinds of results were obtained for the remaining four subjects (for both approaches) as well whose classification performance is presented in Tables 1 and 2 . It is observed that the ANN classification performance based on motion artifacts extracted using DWT approach results in 93.70% accuracy as compared to 89.07% obtained by adaptive filtering approach.

Classification Results
Adaptive filtering approach-based Classification performance

Conclusion and Discussion
The classification of body movements in ambulatory ECG signal using artificial neural network has been performed here. An adaptive filtering based approach and DWT approach were used to extract the motion artifact signal from ambulatory ECG signal. The features of motion artifact signal corresponding to all body movements have been extracted using Gabor transform. The energy feature vectors obtained using Gabor transform have been fed to Multi-layer Perceptron Feed-forward (MLPFF) Neural Network. The same procedure was performed for all different body movement activities for five different subjects. The overall classification accuracies obtained for motion artifacts extracted using DWT and Adaptive filtering approaches were 93.70% and 89.07% respectively. Thus, we conclude that artificial neural networks are important tool to classify body movement activities by using motion artifact component of ambulatory ECG signal. Such kind of classification would give useful information to the expert regarding movement activity, based on which, some useful diagnosis can be performed.  Overall Accuracy 89.07% Table 2: Adaptive filtering approach-based Classification performance.