Electromyography Signal Classification Using Deep Learning
Electromyography Signal Classification Using Deep Learning
Learning
Mekia Shigute Gaso Selcuk Cankurt Abdulhamit Subasi
Department of Computer Science Department of Computer Science Institute of Biomedicine
Ala-Too International University Suleyman Demirel University University of Turku
Bishkek, Kyrgyzstan Kaskelen, Kazakhstan Turku, Finland
[email protected] Department of Computer Science [email protected]
Ala-Too International University
Bishkek, Kyrgyzstan
[email protected]
arXiv:2305.04006v1 [cs.LG] 6 May 2023
Abstract—We have implemented a deep learning model with exhibit quite noisy, complex, and high-dimensional character-
L2 regularization and trained it on Electromyography (EMG) istics [3].
data. The data comprises of EMG signals collected from control In the medical procedure when the need arise the physician
group, myopathy and ALS patients. Our proposed deep neural
network consists of eight layers; five fully connected, two batch may proceed to take the EMG signal of his subject. A muscle
normalization and one dropout layers. The data is divided showing weakness, lack of flexibility, inflicting pain during
into training and testing sections by subsequently dividing the movement are some of the symptoms that will help a physician
training data into sub-training and validation sections. Having to propose these procedure of acquiring EMG signals from
implemented this model, an accuracy of 99 percent is achieved on his patients. During these processes it is expected that the
the test data set. The model was able to distinguishes the normal
cases (control group) from the others at a precision of 100 percent electrodes will send a very small amount of electrical signals
and classify the myopathy and ALS with high accuracy of 97.4 to the patients nerves so that the later responds to it. These
and 98.2 percents, respectively. Thus we believe that, this highly data can then be transformed using computer programs into
improved classification accuracies will be beneficial for their use figures and numerical values that can later be interpreted by
in the clinical diagnosis of neuromuscular disorders. the physician [2].
Index Terms—EMG, deep learning, DNN, EMG signal classi-
fication, Myopathy, ALS.
EMG signals are affected in the processes of acquisition
of the signals from the reaction emerging from the muscles
in what is commonly known as the environmental noise.
I. I NTRODUCTION In addition to those there are effects emanating from the
intrinsic structure of the muscle. These are often related to
What is commonly refereed to as Electromyography (EMG) the interaction of the induced electric current with the muscle
is a process of obtaining and registering electrical signals from as the signal crosses different layers of the muscles as it
the musculoskeletal system in human body. Signals obtained penetrates them. The electrical changes resulted from the
in these ways can be used for various medical applications. interaction of the neuromuscular system of the muscles with
Some of these applications can generally be grouped into those that of the electrodes which is inserted in the muscles is
which are related to clinical and to those which focus on the commonly represented in what is known as the motor unit
interactions of humans with computer systems. All of these action potential (MUAP). The MUAP provides vital informa-
signals require to carefully decompose, processes and analyse tion in investigating if a subject is likely to have developed
the signal obtained in various intricate procedures to finally neuromuscular disorders. Therefore, all these collective factors
classify them into those which are showing medical disorders add up to the complex structure that is retained in the final
related to muscular functions and those which are healthy signals that is acquired, thereby introducing for a need to clean
subjects [1]. or/and de-noise the signal (see for example the discussions
The physical procedure of acquiring EMG signal involves given in [4] and references therein).
penetrating a very narrow needle which contains an electrode Resolving the above addressed issues in order to distil the
into the subject’s skin, and proceeding to record the signals most important information from EMG data requires develop-
as the muscles are contracting and relaxing following some ing various strategies for de-noising the signal. Together with
movement [2]. These signals are observed to be often very these methods, often an intermediate steps are introduced in
chaotic and to be strongly tied up to the intrinsic properties of processing the EMG data which are known as, the feature
the muscles themselves as they are related to their structures extraction methods. These methods have proved themselves
and their functionalities. As a result, these signals usually when combined with de-noising techniques of the EMG data
to have shown significantly higher classification accuracies, in
The 1st and the 2nd features are extracted for evaluation of
the frequency distribution of the signal. The 3rd and the 4th
features are extracted for the evaluation of the changes in the
frequency distribution. Seven different features are extracted
from (i), (ii) and (iii) each; and six different features are
extracted from (iv). Hence a total of 27 features are extracted Fig. 1. The architecture of the proposed deep neural network used in this
which consist of, the mean, the average power of the wavelet work.
coefficients in each sub-band, the standard deviation, and the
ratio of the mean values of neighboring sub-bands. These
softmax activation function. The former consists of positive
extracted features are used on the wavelet coefficients so as
numbers whose sum is equal to 1.0. These numbers thus
to make them more applicable and feasible. These features
entails information which can be used as the classification
are calculated for D1–D6 and A6 frequency bands which
probabilities for the classification layer. This layer uses the
were then used as input to the classifiers. Higher classification
probabilities returned by the softmax activation function for
accuracy and lower computation cost is reported to be obtained
the corresponding input in order to assign the input to one of
when using “db4” wavelet filter [4]. Finally, we have extracted
the disjoint classes and calculates the losses. We have trained
a total of 27 features from the raw EMG signals, thus our
the deep neural network using Adam (derived from adaptive
dataset dimension became 3600 by 27.
moment estimation) optimization algorithm with a batch size
C. Classification using Deep Neural Network of 150 samples and the cross-entropy loss function by shuffling
the data at every epoch.
In this paper, we have implemented our own architecture of
deep neural network with L2 regularization (weight decay) and
V. R ESULTS AND D ISCUSSIONS
trained it on EMG data. As depicted in Fig. 1, our proposed
deep neural network contains eight layers; five fully connected, We have divided the data into training (80%) and testing
two batch normalization and one dropout layers. The overall (20%) sections. The training data is further divided into sub-
design of the network architecture consists of three main training (90%) and validation (10%) sections. We have used,
sections: (1) An initial section which involves a single layer to the sub-training data to train the network and update the
present the feature vector of EMG signals to the network, (2) weights, and the validation data to compute the accuracies at
four stages of fully connected layers with different number of the regular intervals during training. The deep neural network’s
hidden neurons (120, 90, 30, 5 nodes), and (3) a final section learning curves plotted in Fig. 2 illustrate the training progress
of a fully connected layer with 3 nodes and softmax activation and show the mini-batch loss and accuracy together with the
function. The last dense layer is used to combine the features validation loss and accuracy. To estimate the final accuracy of
which are used to classify the EMG signals. As a result, the the implemented deep learning model we have employed the
number of the nodes in the last dense layer should match the test data. Our model has achieved 99% accuracy on the test
number of classes in our data set. In this case, the output size data set.
is set to be 3 as in the number of the classes. Fig. 3 displays the confusion matrix for the test data set
The Leaky ReLU and the ReLU activation functions, which by using column and row summaries. The trained deep neural
introduces the non-linearity to layers is employed to generate network model distinguishes the normal cases from the others
the activations of fully connected layers. The outputs of without confusing them (i.e., with the precision of 100%)
the fully connected layer are normalised with the use of and classify the Myopathy and ALS with high accuracies of
network but also improve the model’s accuracy. We have
used the L2 of weight and bias regularization on the first,
second and third dense layers, and carefully tuned the L2
regularization hyperparameter of weight decay to 0.000001.
We have found that using this rate, instead of setting it to its
default value of 0.01, is quite optimal in order to minimize
the overfitting of the implemented model.
When the weights are updated after each mini-batch, the
distribution of the inputs to layers may change, which is called
internal covariate shift. Batch normalization standardizes the
distribution of the inputs through the layers for each mini-
batch [16]. In our design we have added batch normalization
layers between the dense layers and Relu activations. We
observed that adding batch normalization layer stabilizes the
training process and improves the training accuracy. Dropout
layer avoids the neurons from co-adapting extremely and pre-
vents the overfitting [17]. Using both batch normalization and
Fig. 2. A graph of learning curves showing training progresses for various dropout techniques in the same dense layer is reported as not
epochs with the losses and accuracies together with their corresponding relevant [16]. Following reference [16], we have regularized
accuracies of the validation data sets. the first and the third dense layers using batch normalization
and the second dense layer using the dropout layer.
97.4% and 98.2%, respectively. Training a deep network with The following are the computational environments that
eight layers is challenging as they can be sensitive to the were used in this work. A deep-learning packages Tensorflow
initial configuration of the network and learning algorithm. (v2.3.1) [18] back-end and Keras API (v2.4.0) [19] have
Overfitting, which is simply memorization of the training data been used to build deep neural networks. We have trained
is a common problem for the traditional feed forward neural our proposed model on a PC system with Inter Core i5
networks including the deep neural networks. This problem 9th generation at 2.40 GHz CPU, GeForce GTX 1650 GPU
avoids the network to generalize the learning process and make and 16 GB RAM.
accurate predictions for new data. Overfitting of a network VI. C ONCLUSION
can be monitored using the plot of learning curves during the
In this work we have implemented a deep learning model
training process. To reduce overfitting we have used, the L2
with L2 regularization and trained it on EMG data. The data
regularization at the first, second and third fully connected
comprises of signals collected from control group, myopathy
layers, two batch normalization layers after the first and third
and ALS patients. We find a strong relationship between our
dense layers, and one dropout layer after the second dense
implementation of the deep neural network architecture, and
layer. There are several weight regularization techniques, such
de-noising and decomposition methods on the data, as results
as L1 and L2 regularizations, and each has a hyperparameter
obtained in these work have revealed. The contribution of this
that must be configured. In reference [15] it has been reported
study is therefore rests on developing an effective and efficient
that small amount of weight decay not only regularize the
EMG classification algorithms for intramuscular EMG signals.
Our proposed deep neural network contains eight layers; five
fully connected, two batch normalization and one dropout
layers. The data is divided into training and testing sections by
subsequently dividing the training data into sub-training and
validation sections. An accuracy of 99% is achieved on the
test data set. The model was able to distinguishes the normal
cases (control group) from the others at a precision of 100%
and classify the myopathy and ALS with high accuracy of
97.4% and 98.2%, respectively. Therefor, we believe that these
highly improved classification accuracies will be beneficial for
the clinical diagnosis of neuromuscular disorders.
ACKNOWLEDGMENT
M. S. G would like to give thanks to Ala-Too International
University for the scholarship opportunity which is given to
Fig. 3. Confusion matrix for the test data set. The three classes namely, the her by Ala-Too International University, and Dr. S. Cankurt
normal, mypathy and ALS are represented by ‘0’, ‘1’ and ‘2’, respectively. for the continuous guidance and for the wonderful supervision
on her M.Sc. research and Dr. R. R. Mekuria for the fruitful
discussions on some aspects of the writing up process of this
research paper.
R EFERENCES
[1] Reaz, Mamun Bin Ibne, M Sazzad Hussain, and Faisal Mohd-Yasin
(2006). “Tech-niques of EMG signal analysis: detection, processing,
classification and applications”. In:Biological procedures online8.1, pp.
11–35.
[2] William Morrison M.D. — Written by Danielle Moores — Updated
on March 20,2018 Medically reviewed by (2018). Electromyogra-
phy(EMG).URL:https://www.healthline.com/health/electromyography
(visited on 05/24/2021).
[3] Lashgari, Elnaz and Uri Maoz (2020). “Electromyography Classification
during Reach-to-Grasp Motion using Manifold Learning”. PLOS ONE
doi: 10.1371/journal.pone.0255926.
[4] E. Gokgoz, A. Subasi, Comparison of decision tree algorithms for
EMG signal classification Biomedical Signal Processing and Control,
18 (2015), 138–144.
[5] Eddie Filho, BL, Eduardo AB da Silva, Murilo B de Carvalho, (2008).
“On EMG signal compression with recurrent patterns”. In:IEEE trans-
actions on biomedicalengineering55.7, pp. 1920–1923.
[6] Parsaei, Hossein, and Daniel W. Stashuk. ”Adaptive motor unit potential
train validation using MUP shape information.” Medical engineering &
physics 33.5 (2011): 581-589.
[7] Parsaei, Hossein and Daniel W Stashuk (2010). “Evaluating a motor unit
potential train using cluster validation methods”. In:Canadian Student
Conference onBiomedical Computing and Engineering, pp. 31–35
[8] Li, Yejin et al. (2013). “Cross-comparison between two multi-channel
EMG decomposition algorithms assessed with experimental and simu-
lated data”. In:201339th Annual Northeast Bioengineering Conference.
IEEE, pp. 191–192
[9] Marateb, H. R., Muceli, S., McGill, K. C., Merletti, R., & Farina, D.
(2011). “Robust decomposition of single-channel intramuscular EMG
signals at low force levels”. In:Journal of neural engineering8.6, p.
066015
[10] Nikolic, Miki and Christian Krarup (2010). “EMGTools, an adaptive
and versatiletool for detailed EMG analysis”. In:IEEE transactions on
biomedical engineering58.10, pp. 2707–2718.
[11] Nikolic M. Detailed Analysis of Clinical Electromyography Signals
EMG Decomposition, Findings and Firing Pattern Analysis in Controls
and Patients with Myopathy and Amytrophic Lateral Sclerosis. PhD
Thesis, Faculty of Health Science, University of Copenhagen, 2001.
[The data are available as dataset N2001 at http://www.emglab.net]
[12] Gokgoz E, Subasi A. Effect of multiscale PCA de-noising on EMG
signal classification for diagnosis of neuromuscular disorders. J Med
Syst. 2014 Apr;38(4):31. doi: 10.1007/s10916-014-0031-3. Epub 2014
Apr 3. PMID: 24696395.
[13] Grossmann, A. and J. Morlet, “Decomposition of Hardy functions into
square integrable wavelets of constant shape”, SIAM J. Anal. 15, pp.
723-736, 1984.
[14] Subasi, Abdulhamit, and Emine Yaman. ”EMG signal classification
using discrete wavelet transform and rotation forest.” International
Conference on Medical and Biological Engineering. Springer, Cham,
2019.
[15] Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). ImageNet Classi-
fication with Deep Convolutional Neural Networks. Advances in Neural
Information Processing Systems 25.
[16] Ioffe, S., & Szegedy, C. (2015). Batch Normalization: Accelerating Deep
Network Training by Reducing Internal Covariate Shift. Proceedings
of the 32nd International Conference on International Conference on
Machine Learning, (pp. 448–456).
[17] Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I., & Salakhutdi-
nov, R. (2014). Dropout: a simple way to prevent neural networks from
overfitting. The Journal of Machine Learning Research, 1929–1958.
[18] Abadi, Martın, et al. ”TensorFlow: Large-scale machine learning on
heterogeneous systems, software available from tensorflow.org (2015).”
URL https://www.tensorflow.org (2015).
[19] Chollet, F. & others, 2015. Keras. Available at:
https://github.com/fchollet/keras.