Archives of Orthopaedics
ISSN: 2692-8299

Research Article - Archives of Orthopaedics (2020) Volume 1, Issue 1

EMG Signal Processing for Hand Motion Pattern Recognition Using Machine Learning Algorithms

Yang Zhou1, Chaoyang Chen1,2,3*, Juan Ni3, Guoxin Ni3, Min Li4, Guanghua Xu4, John Cavanaugh1, Mark Cheng1, Stephen Lemos2

1Robotic Rehabilitation Laboratory, Department of Biomedical Engineering, Wayne State University, Detroit, Michigan, USA 48201

2Department of Orthopaedic Surgery and Sports Medicine, Detroit Medical Center, Detroit, Michigan, USA 48202

3Department of Rehabilitation Medicine, First Affiliated Hospital, Fujian Medical University, Fuzhou, Fujian, China 350001

4School of Mechanical Engineering, Xi’an Jiaotong University, Xi’an, China 710049.

*Corresponding Author:
Chaoyang Chen

Received date: May 29, 2020; Accepted date: June 15, 2020

Citation: Zhou Y, Chen C, Ni J, Ni G, Li M, Xu G, et al. EMG Signal Processing for Hand Motion Pattern Recognition Using Machine Learning Algorithms. Arch Orthop. 2020; 1(1): 17-26.

Copyright: © 2020 Zhou Y, et al. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.


Electromyography (EMG) signal processing for assistive medical device control has been developed for clinical rehabilitation. The accuracy of operation and responsive time are still needed to be optimized. The purpose of this study was to determine and compare the efficiency of different artificial neural network-based machine learning (ML) algorithms in multiple channels surface EMG (sEMG) signal processing. EMG recorded from the forearm was processed for hand motion recognition. Performance of multilayer neural network training function “Trainlm” and “Trainscg” algorithms were evaluated based on their accuracy and duration required for EMG signal processing. The results showed both algorithms processed sEMG signal within less than 100 ms with the accuracy of Trainlm algorithm higher than Trainscg algorithm. The performance of the proposed methods was tested among five healthy subjects with accuracy higher than 98%. These outcomes suggested the Trainlm and Trainscg ML algorithms effectively recognized hand motion patterns, potentially they can be used for volitional control of hand robotic assistive device.


Backpropagation neural network, Signal processing, Electromyography, Machine learning, Hand, Pattern recognition


Stroke is a major cause of death and disability in the world. There were approximately 25.7 million stroke survivors and 6.5 million deaths from stroke [1]. Stroke can result in arm disability and reduce daily life activity via weak arm muscle activity [2]. Studies have been performed to discover therapeutic and assistive approaches to compensate for disabilities and restore functions. The emerging rehabilitative robotic systems, including assistive exoskeletons, provide a promising approach to conventional therapy [3-5]. Electromyography signal processing for assistive robot motion control is one of the innovative approaches. Robotic assistive systems have been reported to be able to restore patients’ motor function associated with the neuroplasticity of the brain [6, 7]. In addition, therapy time and quality of therapy are the key factors for functional recovery and improvement [8]. Rehabilitative robots provide significant advantages over classical stroke therapy [9,10]. Robotic assistive rehabilitation provides standardized treating protocols and volitional control of devices, which can reduce the therapist’s manual workload. Therapy intensity and qualities can thus be improved and optimized [11,12].

Bio-electrical signal processing for volitional control of assistive devices has provided a new approach for disability rehabilitation to improve patient daily life activity and neural function recovery. Processing bioelectrical signals such as electromyography (EMG) or electroencephalography (EEG) signals for intuitive control of an assistive robotic system is emerging technology in neurorehabilitation. EMG signals have been applied in diagnoses of neuromuscular diseases, and recently it has been used for controlling prosthetic devices or exoskeleton robots for stroke rehabilitation [13]. EMG signals from the muscle activity have been processed and used to control hand exoskeleton motion control among stroke patients which resulted in the patient regained some muscle strength for daily life activity [ 14]. An assistive EMG-driven robot system integrated with neuromuscular electrical stimulation (NMES) shows improvements on voluntary motor functions in the hand, wrist, and elbow [14]. Applications of bioelectrical signals driven exoskeleton in spinal cord injury rehabilitation have shown a promising outcome relevant to the central nervous system (CNS) neuroplasticity and neurorehabilitation [15]. Accurate signal processing for robot control is critical in robotic system’s performance, which is associated with clinical treatment outcomes [5]. The level of restoration is associated with the users’ own effort of muscle contraction. Rehabilitation robots can help users to move their affected limbs and to increase the muscle self-voluntary contraction. However, challenges are still existing in EMG extraction technology related to accuracy and sensitivity. Conventional methods used EMG amplitude or pattern recognition methods to trigger motions of an exoskeleton [16,17]. On-site calibration and manual selection of a threshold to trigger motions are required among different users. Because of weak EMG signal and low EMG voltage amplitude in the stroke patients, there is an additional challenge to recognize motion intent based on EMG due to lower signal to noise ratio (SNR), hence conventional signal processing method may not extract user’s intent accurately. Emerging machine learning signal processing methods may improve the quality of EMG signal processing and are spared of manual procedures for onsite calibration and threshold setup procedures leading to a user-friendly system.

EMG signal processing using artificial neural networkbased machine learning algorithms such as convolutional neural network (CNN) has been used for EMG based hand motion intention recognition, which demonstrate a capacity to overcome these problems in EMG signal feature extraction and system calibration. However, limitations still existed, including that complex multiple layers of deep learning architecture are required for feature extraction for a robust performance [18] and overall accuracy is around 90% [19-21]. In this research, EMG signal were processed using two new machine learning (ML) algorithms including Levenberg- Marquart (Trainlm) [22] and scaled conjugate gradient (Trainscg) algorithms for two channels of EMG signals.

The performance of processing algorithms was tested and validated among healthy subjects for a better EMGcontrolled assistive robot system development.



Five healthy subjects (aged 20-50, 3 males, 2 females) were recruited in this study. All procedures have been approved by the Institutional Research Board. Biopac data acquisition system (Model MP-36, Biopac Inc, Goleta, CA) was used to record EMG signals from forearm EMG signals from the flexor carpi ulnaris (FCU) and extensor carpi radialis longus (ECR) with data saved for off-line EMG signal processing and analysis. Subjects were instructed to perform flexion and extension of the wrist from the neutral flat position while the EMG signals were being recorded simultaneously (Figure 1). Each movement was repeated 10 times with 3 second time interval.

Signal acquisition and preprocessing

The Biopac data acquisition system recorded raw EMG signals from the selected muscles and saved data in Matlab format for later off-line analysis. The sampling rate was set at 1000 Hz and gain was set at x1000. The electrolyte hydrogel (4% chloride salt) electrodes (EL502, Biopac Inc.) were placed on the surface skin of flexor carpi ulnaris (FCU) and extensor carpi radialis longus (ECR) with reference electrode on the wrist.

To eliminate noises in raw EMG signals including power line system noise, motion artifacts between sensor and skin, a band-pass function was used to filter off power line noise and inherent noise in electrical and electronic equipment. A six order Butterworth bandpass filter with cut-off 10-500 Hz was used to filter off the noise. Butterworth low pass filter is given

Where n is the order of the filter, ωc is the cutoff frequency (approximately the -3dB frequency), G0 is the DC gain (gain at zero frequency).

The power line noise (60 Hz in the US) was removed by notch filter with 3dB gain.

Where ω0 is the central rejected frequency and ωc is the width of the rejected band. For 60 Hz, ω0 is 60 Hz, ωc is 2 Hz.

The duration of EMG recording in each subject was approximately 70 seconds which contained 10 EMG signal segments for each hand movement with a total of 30 sets of EMG data.

For each movement, the onset and offset points of muscle contraction in a series of EMG data were identified based on a 10% increase of MVC (maximum voluntary contraction). The maximum voluntary contraction and data collection were performed before the tests for a serial muscle contraction of both FCU and ECR muscle.

Feature extraction

Raw EMG signals extracted for signal processing included voltage amplitude - mean absolute value (MAV), frequency - mean frequency (MNF), root mean square (RMS), mean frequency (MNF), median frequency (MDF), power spectrum density (PSD), and integrated EMG (IEMG). Only mean absolute value (MAV) and median frequency (MDF) were adapted into machine learning algorithms for hand motion intention recognition. The purpose was to determine if less EMG parameters can still get accurate outcomes. Less EMG parameters used for processing makes algorithms less complex. Backpropagation neural network (BPNN) with “Trainlm” and “Trainscg” training functions was used for machine learning process in this study.

MAV was the average rectified value (ARV) and calculated using the moving average of full-wave rectified EMG by taking the average of the absolute value of EMG signal (Formula 1). It is defined as in (3).

In the Formula (3), N denotes the length of the signal and Xn represents the EMG signal in an epoch. Median frequency (MDF) was the median frequency value of EMG signal in frequency domain. MDF was a frequency value at which the EMG power spectrum was divided into two regions with an equal integrated power. It can be expressed as (4).

Pj is the EMG power spectrum at a frequency bin j and M is the length of frequency bin.

Signal processing using back propagation neural network

Backpropagation neural network (BPNN) for motion recognition and classification was created by applying the Widrow-Hoff learning rule to multiple-layer network and nonlinear differentiable transfer function, the weight of neurons was adjusted by gradient descent algorithm which minimized the loss function. The BPNN consisted of three layers: an input layer, a hidden layer, and an output layer. The main characteristic of the BPNN was that the signal transmits forward and the error transmits backward. The topology structure of the BP neural network as shown in Figure 3. Here, the Xn means the input value, Ym means the predicted value, Wij and Wjk mean the neural network weight. Here, n is 4 which depends on the number of the features, and m is 3 which indicates the output of 3 of hand gestures.

BP neural network performed two processes, one was forward propagation, and another was backward propagation. Node i and node j are two adjacent nodes in the net, between i and j, there is a weight value called Wij, node j has a threshold called bj. Every node has an output value which is determined by an activation function (logistic function aka sigmoid) with all the previous layer’s node output values, all the weight values between the current node and each previous node, and the threshold value in the current node.

Two BPNN training algorithms were used in this study. The first algorithm was the Levenberg-Marquardt (trainlm) algorithm (Figure 4a). This algorithm determined how to adjust the weights to minimize the final output error by using the gradient of the error function. There was a total of 150 EMG datasets used in this study, in which 90 datasets were used for training, 30 datasets for validation, and 30 were used for testing.

During the training process, all the 90 datasets including EMG feature data and output results were used for generalizing the neural network model. Two criteria were set up to stop the training, one was when the total mean squared error (MSE) was smaller than 0.001, another one was when the iteration steps reached 1000. The weights and bias of the input layer and hidden layer were calculated based on the previous bias and weight values for each training session. The network training kept running until the stop criterion met. The final training produced the weight and bias values.

Another type of BP algorithm, the scaled conjugate gradient (trainscg) algorithm was also used in this study for efficiency comparison between two different training algorithms (Figure 4b). Three-layers of BP neural network were used including input, hidden and output layer respectively. The input layer contained EMG signal median frequency (MDF) values and mean absolute value (MAV) obtained from 2 targeted muscles the flexor carpi ulnaris (FCU) and extensor carpi radialis longus (ECR). The output layer contained three patterns of hand gestures including flat palm, wrist flexion, and wrist extension (Figure 4b). The hidden layer was set up using the mathematic model obtained from training recorded EMG datasets.

The feed-forward BP network is shown in Figure 3 with 4 neurons in the input layer, 10 tan-sigmoid neurons in the hidden layer, and 3 linear neurons in the output layer. The EMG features were extracted from EMG signals of 3 different hand movements from 5 subjects. In total, 90 EMG signal datasets were used in training. After feature extraction, we put these 90 of feature vectors and targeted vectors into the network. The sample input vectors and corresponding vectors are shown in Table 1.

Table 1: Sample input vectors and output vectors in neural network.

Input vector numbers from top to bottom are FCU muscle EMG MAV, ECR EMG muscle MAV, FCU muscle EMG MDF, and ECR muscle MDF respectively. The output vector used a combination of 0 and 1 to express different hand motions.

In our study, we used [1,0,0] as flexion, [0,1,0] as extension and [0,0,1] as flat position.

Statistical analysis

SPSS software (IBM, version 25) was used for statistical analysis. T-test was used to determine the significant difference in accuracy rates of two machine learning training algorithms (trainlm and trainscg) in signal processing. P-value that smaller than 0.05 was considered a significant difference.


Muscle activity and corresponding EMG signals

When wrist performed dorsal extension, MAV and RMS of extensor carpi radialis (ECR) EMG increased while MAV and RMS of flexor carpi ulnaris (FCU) did not increase significantly. The peak of power spectrum density (PSD) of flexor and extensor EMG was located between 80-100 Hz. When wrist performed ventral flexion, the MAV and RMS of extensor carpi radialis EMG did not increase from the baseline while the MAV and RMS of flexor carpi ulnaris increased significantly (Figure 5).

Graphical user interface (GUI)

Our customized algorithms produced a visualized graphical user interface (GUI) (Figure 5) to process raw EMG data. The processed outcomes were viewable in the GUI. Digitized EMG data was read from channels in GUI (channel 1 or 2) (Figure 6A). The whole raw data was further processed and plotted as showed in Figure 6B and 6C. The system then determined the maximum RMS and median frequency for both channels and output the readings in the “EMG Analysis Parameters” box. These four values were then inputted into the neural network for pattern recognition processing based on the weight and bias value of the neural network obtained from previous machine learning training. Overall manipulation and outcome reading demonstrated that the algorithm system was a user-friendly system.

Efficiency comparison of two algorithms in model training

In this study, criteria to stop the training was set at when the total mean squared error (MSE) was smaller than 0.001 or when the iteration number reached 1000.

Comparison results demonstrated that the number of model training iterations of the Trainlm algorithm was less than Trainscg algorithms (t-test, p<0.02) (Figure 7a and Table 2). Trainlm algorithm took 80 iterations to get a mean square error (MSE) less than 0.001 (Figure 7a) to complete the model training, while Tarinscg took 90 iterations to get a training model completed (Figure 7b). In terms of zero error occurrence, the error histogram demonstrated that the training, validation, and testing errors from Trainlm were close to zero centered (instance =85) at -0.00029 with a good agreement. Trainscg algorithm resulted in zero error occurrence was centered at -0.00047 with fewer instances (instance=15) than Trainlm, with many cases of zero error occurrence that were not close to zero, indicative of a less stable train model.

  Subjects  Trainlm AccuracyRequired iteration steps by TrainlmProcessing Time of Trainlm (Second)Trainlm performance (mean square error)  Trainscg AccuracyRequired iterations by TrainscgProcessing Time of Trainscg (Second)Trainscg performance (mean square error)
100.0 ± 0.0  429.2 ± 370.8  0.4 ± 0.54s5.97E-12 ±
  93 ± 5.8%  1000.0 ± 0.0  1.4 ± 0.55s  0.03 ± 0.02
P Value0.0290.0310.020.031    

Table 2: Recognition results of hand motion using trainlm and trainscg algorithm.

As shown in Table 2, the recognition accuracy of S1 is the lowest for the individual. In all the tested five cases, the average recognition accuracy of wrist extension (WE) is the highest (99.50%), while the average recognition accuracy of wrist flexion (WF) is the lowest (97.69%). Trainlm algorithm had higher recognition accuracy than Trainscg algorithms (t-test, p=0.029). The number of algorithm train iterations of Trainlm algorithm was less than Trainscg algorithms (t-test, p=0.031). The time required to get the recognition outcomes was less using Trainlm than Trainscg algorithm (t-test, p=0.02).


Skeletal muscle weakness, pain, sensory loss, impaired dexterity, and incoordination caused by stroke make a huge influence on activities of daily living (ADL) [23]. The restore of the upper-limb function is an important goal of rehabilitation. This study aimed to develop a novel wrist motion intent estimator that not only detects the hand motion patterns but also accurately and swiftly controls the hand robotic assistive device motions. This study demonstrated that the hand movement patterns including wrist flexion and extension versus resting at a neutral position can be recognized using surface EMG signals and machine learning algorithms. This EMG sensor and signal processing algorithms can detect hand motion intent of health subjects and athlete, and potentially it will detect hand motion intent of an amputee, stroke, spinal cord injury, or Duchene muscle dystrophy disorder using pattern recognition methods.

EMG signal amplitude increases upon muscle contraction, a simple control algorithm can be to set a voltage threshold between baseline and responding EMG to trigger robot actuators. The challenges of this technique include artificial signal noise and artifacts from the sensor’s motion on the skin that can lead to unwanted robot motor activation. In addition, remnant EMG signals are weak in stroke patients, making it difficult for robot to detect true muscle contraction. The pattern recognition approach can be a robust approach for motion intent recognition using EMG signals and machine learning algorithms.

Fast Fourier Transformation (FFT) method and wavelet method can be used to remove noise in the EMG signal by monitor PSD change within a fixed bandwidth beyond the noise frequency band. In this study, we used the FFT method to get the median frequency of the selected period of EMG signals as a crucial criterion of recognition of hand movement patterns. The results demonstrated that a combination of median EMG frequency and mean EMG voltage yielded accurate pattern recognition outcomes using Trainlm algorithms. This has resulted from that FFT processing removed noise and the Mean frequency of mean voltage of responding EMG signals directly reflected those muscle contractions.

Several machine learning algorithms have been used for hand motion pattern recognition using artificial neural networks (ANN). ANN was developed to learn from examples and to reproduce arbitrary non-linear functions of inputs for pattern classification tasks. ANNs simulate the low-level functions of biological neurons and are useful for complex pattern recognition and classification tasks [24]. The capability of learning from examples and reproducing non-linear functions of input with the parallel structure make ANN suitable for pattern recognition tasks [25]. One of the purposes of this research was to develop a simple ANN which can be trained with effective features extracted from fewer channels of EMG signals. The hypothesis was that the simple ANN structure avoids complex structure and huge computational task. A back-propagation neural network was designed and optimized in this research work to classify the pre-processed EMG signals obtained from different hand motions. Mean absolute value (MAV) and the median frequency of EMG signals were selected as input variables for training. The Levenberg-Marquardt (Trainlm) algorithm was used to train the network and its performance compared to the scaled conjugate gradient (Trainscg) algorithm.

Levenberg-Marquardt algorithm (Trainlm) was for back-propagation training. The back-propagation algorithm is used for the training of feed-forward ANN. The Trainlm algorithm determines how to adjust the weights to minimize performance to get the smallest value of mean square error (MSE) by using the gradient of the performance function. The algorithm was designed to have second-order training speed without having to compute the Hessian matrix. It has the fastest convergence speed for moderate-sized feedforward neural networks (up to several hundredweights). This algorithm reduces the numbers of calculations but requires more memory than other algorithms. Pulido et. al. [26] compared trainlm and trainscg for classification of blood pressure and showed that trainlm achieved a better result. Antwi et. al. [27] also found that trainlm algorithm can achieve a better Backpropagation neural network (BPNN) model after comparing 11 training algorithms. Zhang et. al. [28] also found that evenberg-Marquardt (trainlm) was a better training method than an elastic algorithm (trainrp) in BPNN model.

The Trainscg algorithm is used for function approximation and pattern recognition. Trainscg has been believed to perform better for supervised learning and network with large weight variables. This algorithm combines the modulus trust-region algorithm with the conjugate gradient algorithm to reduce the time to search the network when adjusting the direction. The network was also generalized to avoid overfitting.

In this paper, a 3-layer artificial neural network was used to complete the classification of EMG signals. The results demonstrated that this Trainlm algorithm was a faster and reliable method for training moderate-sized feed-forward neural networks than Trainscg algorithms.

Limitations of this study include that signal processing was performed in the off-line data processing manner. In future studies, real-time EMG signal processing technology for robotic hand motion control will be developed based on knowledge obtained from this study. Moreover, future studies validate the current EMG processing and robot control algorithms in stroke patients for assistive device control using remnant weak EMG signals.


This paper explored the methodology of using sEMG signals to control the robotic hand for wrist flexion and extension and compared the efficiency of two machine learning algorithms in sEMG signal processing. Results demonstrated that both algorithms processed EMG signal in less than 100 ms with the accuracy of Trainlm algorithm higher than Trainscg algorithm.

Disclosure Statement

No potential conflict of interest was reported by the authors.


This research was supported by the NSF CAREER #1055932 and NSF MRI #1229635.