Classification of EMG Signals Using Convolution Neural Network

An electrical signal is produced by the contraction of the muscles; this electrical signal contains information about the muscles, the recording of these signals called electromyography (EMG). This information is often used in studies such as prosthetic arm, muscle damage detection, and motion detection. Classifiers such as artificial neural networks, support vector machines are generally used for the classification of EMG signals. Despite successful results with such methods the extraction of the features to be given to the classifiers and the selection of the features affect the classification success. In this study, it is aimed to increase the success of the classification of the daily used hand movements using the Convolutional neural networks (CNN). The advantage of the deep learning techniques like CNN is that the relationships in big data are learned by the network. Firstly, the received EMG signals for forearms are windowed to increase the number of data and focus on the contraction points. Then, to compare the success rate, raw signals, Fourier transform of the signal, the root means square, and the Empirical mode decomposition (EMD) is applied to the signal and intrinsic mode functions are obtained. These signals are given to four different CNN. Afterward, to find the most efficient parameters, the results were obtained by splitting data set into three as 70% training set, 15% validation set, and 15% test set. 5 cross-validations have been applied to assess the system’s performance. The best results are obtained from the CNN, which receive the EMD applied signal as input. The result obtained with the cross-validation is 95.90% and the result obtained with the other separation method is 93.70%. When the results were examined, it was seen that CNN is a promising classifier even the raw signal is applied to the classifier. Also, it has been observed that EMD method creates better accuracy of classification. This is an open access article under the CC BY-SA 4.0 license. (https://creativecommons.org/licenses/by-sa/4.0/)


Introduction
Since the early ages, humanity has always tried to understand its own movement system. The most important element in the movement system is the muscular system [1]. Electrical signals occurring in the muscles are generally used in order to understand the working principle of the muscle [2].
For advanced disease detection and prosthetic application, EMG signals must be processed and characterized in detail. For such purposes the characteristics of the regional electrical signals received over the muscles are examined. Another important part is how to interpret electrical activities. Signal processing, support vector machines [3], [4] and artificial neural networks [5], [6] are used to solve interpretation and classification problems in biomedical applications.
This study aimed to increase the classification success of the EMG signals of basic hand movements used in daily life by using Convolutional neural network. CNN is a multi layered artificial neural network that is frequently used in large data sets in the field of deep learning [7]. Basically, CNN uses the standard neural network to solve the classification problem, but uses a variety of different layers to identify parser information and detect some properties so it extract features itself. By using CNN, it is attempted to reduce the bond of classification with the signal by making the majority of feature extraction by using Convolutional neural network.

Related Works
There have been several different approaches for classification of EMG signals. In this part some related studies will be examined.
Lucas et al. [3] used the method of the support vector machine(SVM) to classify six hand movements in order to control prosthesis hands. The classification accuracy was approximately 95%. Oskoei and Hu [8] did the other study which is used SVM for classification, they used the SVM method classification of upper limb motions by using EMG signals. They analysed four distinct kernels and results showed that boundaries between classes were practically linear. Also there are some other studies shows that SVM is a good method for EMG classification [9], [10] if you have low number of sample. Researchers also focused on classification with Neural Networks lately. Rabin et al. [11] aimed to analyse the difference between nonlinear dimensionality and standard linear dimensionality method on EMG classification. Short Time Fourier Transform was applied for feature extraction to EMG signal for classifies 6 different hand movements. To dimension reduction principal component analysis and diffusion maps used and K-nearest neighbours chosen for classifier. Results showed that PCA had lower success than DM in limited training data. Huang and Chen [12] worked on multi-degree prosthetic hand and they tried to classify eight different hand movements with backpropagation neural network, this system's accuracy was 85% for offline test and 71% on online test. Baspınar [13] extract 8 time domain 2 frequency domain features from 7 different hand movements and used these features to classify hand movements with Artificial Neural Network and Gaussian Mixture Model to observe difference between them. Results showed that ANN is better classifier than GMM with 92% accuracy. Rehman el al. [14] collected EMG signal samples from seven healthy subjects 15 days in series. Their main classification method was Convolutional Neural Network with raw EMG samples as the input, to compare the accuracy of the system, linear discriminate analysis, stacked spare auto encoders with features (SSAE-f) and raw signals (SSAEr) were used. Their experimental findings revealed that CNN has lower classification error than LDA and SSAE-r and that these is no substantial difference between SSAEf and CNN, so since CNN showed the similar accuracy with the raw signal, it is more advantageous in terms of time and performance.
In the light of these studies, it has been observed that most researches make feature extraction from the data, and they use these features in different classification techniques. However, selection of most representative features is an important issue. The selection of classifier is another aspect especially when the number of samples is large. Emerging deep learning tools proposes new solutions for these problems. Thus, inspired by those, in this study, the success of CNN method without any feature extraction step is compared with common methods such as Fourier transform, Root Mean Square and Empirical Mode Decomposition of the windowed raw signals.

Materials and Methods
Firstly, the received EMG signals for forearm are windowed to increase the number of data and focus on the contraction points. Then, to compare the success rate, different input formats of data are given to four different CNN. Afterwards, to find the most efficient parameters, the results were obtained by dividing data set into three. Cross validation was applied in order to assess the system's performance.

EMG Data Collection
The data set taken from UCI Machine Learning Repository is used in this study. This data set contains signals of different people grapping different objects. It is aimed to detect these gripping movements with the surface electrodes attached to the forearm. Three surface EMG electrodes is used for getting signal, two of them in Flexor Capri Ulnaris and Extensor Capri Radialis and the reference electrode in the middle, for the accumulation of muscle activation results.
Five solid subject of a similar age between 20 to 22 year old were requested to do the six movements to collect necessary signals, these movements considered as fundamental hand movements. The pace and power were intentionally left to will of the subject [15]. The movements are illustrated in Fig.1.
1) Cylindrical: Carrying object that are clindrical 2) Tip: Holding tiny objects 3) Hook: Holding a heavy item 4) Palmar: Gripping object with palm facing it 5) Spherical: Carrying spherical objects 6) Lateral: Carrying flat objects For every fundamental movement, the subjects perform each movement for six seconds and the entire system has been replicated 30 times. In the end, 180 units of 6 second long 2-channel EMG signals from each subject were reported. The data is obtained at a 500 Hz sampling rate. Using a Butterworth Band filter, the signals were filtered individually with a low and high cut-off at 15 Hz and 500 Hz and a notch filter at 50 Hz to obtain better information from signal without noises [15].

Pre-Processing
The sliding window method is applied to focus only on the segment where the muscle is contracted. Windowing technique is divided into adjacent and overlapping. The signal is divided into windows with the finish of the past window is associated with the following window in the adjacent windowing. For the overlap windowing, piece of the past window and next is overlapped as shown in Fig.2. In this study, 300 msec (150 data point) is chosen for window size and slide that window 30 data point until the end as in [15]. Windowing applied to the EMG signal that comes from both channels for each individual. According to the purpose of study the same movements from a different person are combined and adding each others to create, Data matrix contains six different hand movements from 5 different people but classification will focus only movements rather than the person who does the movement. In the end, Data matrix of 2x150x86400 is obtained so 86.400 window samples generated with length of 150. Figure 3 shows that Raw EMG signal and Windowed EMG signal.
2) Root Mean Square (RMS):RMS is calculated by squaring all data in EMG sample and summing them, then dividing the sum by the number of sample, last taking the square root of all equation [16].

3) Empirical Mode Decomposition (EMD):
Nonlinear and non-stationary signals can be shown by sum of correct turns with EMD method. This allows for the registration of the surface area in the complex plane. The aim of the EMD method is to disintegrate the nonlinear and non stationary signal ( ) into a sum of intrinsic mode functions (IMFs). The modes may provide insight into different signals contained within the data. This method is especially useful for analysing natural signals such as EEG and EMG [17]. First three IMF of the Hook movement are given in Figure 4. After the creating Data set, next process is dividing whole set into 70% Train set, 15% Validation set and 15% test set. The main purpose of the Validation set is to prevent the over fitting. After training, Network tried on test data. For analysing results more accurately 5-fold cross validation is applied.

Experiment and Results
In this section experiment methods and result will be given. Firstly, CNNs will be examined in 4 main groups according to the input signals for better explanation.
Afterwards their accuracy with the cross validation and normal separation methods will be given. Parameters of CNN can be seen in figure 5.  2) Convolutional Layer: The first argument in the Convolution layer represent the size of the filter, the training function uses this filter when scanning input data. The second argument is the quantity of filter with that size, which is the quantity of neurons that associate with the same part of the input [18].

3) Max Pooling Layer:
The max pooling layer performs down-sapling and returns the maximum values of rectangular area of input [19].

4) Fully Connected Layer:
This layer incorporates all the features that have been learned by previous layers. The last fully connected layer blends features to classify the signal. The size of the last fully connected layer also should be the same as the number of classes in the data which is 6 for this study [19].
The optimum values of the number of layers and parameters were obtained heuristically in network architecture. There are batch normalization layer and RELU layer after every Convolutional layer, finally after fully connected layer there are softmax layer.
After choosing network architecture, training options should be specified. As a result of experimentation, stochastic gradient descent with momentum (SGDM) is chosen to train the network with an initial learning rate of 0.01. Maximum number of epoch is chosen as 6, an epoch means full training cycle on the whole training data set and the data is shuffled in every epoch. Some trail parameters and results are given below.
The results of CNNs trained with 70% train set, 15% validation and 15% test set are given below. The results of CNNs trained with K=5 cross validation and 80% train, 20% test set are given below.

Discussion
In discussion part accuracy of previous studies, their methods and class numbers will be given. Details of these studies mentioned in part 1.1. As shown as in Table 3, in one of previous studies with same data set, simple linear classifiers is used with Empirical Mode Decomposition and took results for every subject individually. Results are between 85.53% and 90.42% [15]. In other study, they extracted features with Short Time Fourier Transform and used these features in Artificial Neural Network to classify the movements in pairs. With just two classes results are around 98% [6]. Huang and Chen used several different methods to extract features from the signal these are variance, bias zerocrossings, autoregressive model and spectral estimation. BPNN is used as a classifier, system achieved success rate of 85% on offline and 71% on online tests [12]. Also classification of hand movements tried as pair of classes. Short Time Fourier Transform is applied to raw signal to feature extraction. The system trained with ANN and showed good classification performance when there are only two classes [6]. Baspınar applied EMD to signal and Gaussian Mixture model and ANN based classifiers used to compare. Results showed that ANN is better classifier with 92% [13].
In the other two studies, SVM was used as the classifier, one of them used 4 different kernels [8] and the other used Discrete Wavelet Transform [3] for feature extraction, and both achieved a similar success rate of 95%.
As can be seen from the table, even a feature extraction is not applied, the CNN classifies the raw signals with accuracy of 90.62% with same dataset [6], [15], in our study. This result shows the pattern recognition capability of CNN. Thus, pre-process is reduced by making the majority of feature extraction to Convolutional Neural Network. Also, when EMD is applied better classification accuracy is obtained when compared to the studies which have 6 or more classes.

Conclusions
Classification of the EMG signal is known to assist in the development of bionic hands as well as to identify clinical diagnoses. The methods used in this study were tried to contribute to increase the classification success and performance of the EMG signal. The results show that CNN is a promising classifier even the raw signal is applied to the classifier. Also, it has been observed that IMF method creates better classification accuracy.