EMG Onset Detection
Comparison of Different Methods for a Movement Prediction Task based on EMG
Marc Tabie
1
and Elsa Andrea Kirchner
1,2
1
AG Robotik, University of Bremen, Bremen, Germany
2
German Research Center for Artificial Intelligence (DFKI), Robotics Innovation Center, Bremen, Germany
Keywords:
Online EMG Onset Detection, Movement Prediction.
Abstract:
In this work a study with 8 male subjects was conducted to compare three preprocessing methods for online
capable movement prediction based on the recorded electromyogramm (EMG) signals of the right upper limb.
One of the compared methods is the widely used Teager Kaiser Energy Operator (TKEO), the other two are
a recently proposed method that is based on variance calculation of the signal and the standard deviation.
Scope of the work was to show that fast methods, which are required for online processing, have at least
the same performance as more classical approaches with higher demands on computational resources like
the TKEO. An adaptive threshold was used for onset detection after preprocessing in all compared cases.
Comparisons of preprocessing methods were done with respect to the performance in movement prediction
and earliness of onset detection. The influence of different movement speeds on the prediction time and
the performance were investigated as well. Results presented here show significant differences between the
investigated preprocessing methods concerning the prediction time. As a further result of this study it could
be shown that different movement speeds also have a significant effect on the prediction time.
1 INTRODUCTION
Motivated by a robotic application developed by our
group that enables movement assistance by an ex-
oskeleton, we were reviewing fast methods for move-
ment prediction based on psychophysiological data.
In previous studies we could show that the control
of an exoskeleton benefits from prediction of move-
ments based on psychophysiological data. It could
be shown that the electroencephalogram (EEG) can
be used to improve the interaction between human
and an exoskeleton (Folgheraiter et al., 2012). How-
ever, due to the so called electromechanical delay be-
tween measurable changes in the electromyogramm
(EMG) and the production of force in the correspond-
ing muscle (Cavanagh and Komi, 1979) (Zhou et al.,
1995) a fast detection of EMG onset activity can also
be used to predict a physical movement. There are
several studies concerning the automatic onset detec-
tion in the EMG. It is stated that preprocessing of
EMG signals with the Teager Kaiser Energy operator
(TKEO) improves the onset detection in comparison
to simply filter the EMG data (Kaiser, 1990) (Li et al.,
2007) (Solnik et al., 2010). However, fast and simple
methods that require low computational resources are
required for embedded signal processing that allow
onboard analysis. Recently a preprocessing method
that is based on the variance (VAR) calculation of
EMG signals was proposed (Nikolic and Krarup,
2011), but to our knowledge so far no comparison of
the TKEO and variance was done. Thus the compari-
son will be one goal of this paper.
After preprocessing onset detection can be per-
formed with different threshold methods, like single
threshold (Hodges and Bui, 1996) or multi thresh-
old (Bonato et al., 1998) detection. The drawback
of those methods is that the performance strongly de-
pends on the threshold that is chosen once for the
whole dataset. Recently an adaptive threshold method
was proposed, in which the threshold is continuously
updated based on the mean and standard deviation of
a sliding window containing the recent data point and
N previous data points (Semmaoui et al., 2012). Thus,
onset detection can be adapted to possible changes in
the EMG as they may occur during extensive behav-
ior due to fatigue of the muscle. To our knowledge,
this adaptive approach was not yet combined with the
above mentioned preprocessing methods for the pur-
pose of EMG onset detection. Therefore, another goal
of this paper is to investigate the performance of the
242
Tabie M. and Andrea Kirchner E..
EMG Onset Detection - Comparison of Different Methods for a Movement Prediction Task based on EMG.
DOI: 10.5220/0004250102420247
In Proceedings of the International Conference on Bio-inspired Systems and Signal Processing (BIOSIGNALS-2013), pages 242-247
ISBN: 978-989-8565-36-5
Copyright
c
2013 SCITEPRESS (Science and Technology Publications, Lda.)
adaptive threshold in combination with the prepro-
cessing methods.
To compare these different processing methods
we did not only choose performance in detection but
also the earliness of detection of EMG activity as a
performance measure. In this context we also investi-
gated different speeds of movements. Since different
speeds of behavior do occur under natural condition,
in which embedded systems for movement prediction
might be applied and may influence predictability.
2 MATERIALS AND METHODS
2.1 Experimental Setup
Eight healthy right-handed male subjects (age 29.9 ±
3.3 years) participated in the study. The subjects were
seated in a comfortable chair in front of a table. A
monitor and two switches, a flat board and a buzzer,
were located on the table. The flat board consisted of
a plastic cuboid (10 × 10 ×1.5 cm) and a plastic plate
(10 × 10 × 0.4 cm). The two parts were connected
with a rotary joint. Inside the cuboid a microswitch
and a spring were mounted. When putting a hand on
the whole device, the plate will press the microswitch.
By lifting the hand again the spring will push the plate
up for approximately 0.5 cm which causes the switch
to be released again. During the experiments both in-
put devices were used to determine the begin or the
end of a movement.
The experiments consisted of intention based
movements of the right arm. The subjects were asked
to perform 40 voluntary movements starting from the
flat board to the buzzer and back. The events from the
input devices (pressing/releasing) were marked in the
recorded EMG data. Experiments with normal, slow,
and fast speeds were performed. For each movement
speed three runs were recorded.
Normal movements can be defined as natural
ones. We simply ask the subjects to hit the buzzer
in their own speed. These runs were performed first
and used to make the test persons familiar with the ex-
periment and the whole setup. They were not used for
analysis. For slow movements a minimum time of 1 s
from the flat board to the buzzer had to be satisfied.
For fast movements the subjects were asked to move
as fast as possible.
Since maximum movement speed differs between
subjects, a preliminary investigation was done. Each
subject was asked to perform the movement to the
buzzer and back starting from the flat board, for 10
times as fast as possible. From the 10 movements the
mean time needed to move from the flat board to the
buzzer was calculated for each test person. Those av-
erage times plus an offset of 10 ms were used as the
maximum time for fast movements. The maximum
times varried from 120 to 275 ms. The experiments
were designed and executed using Presentation (Neu-
robehavioral Systems, Inc.).
During the experiments a green circle with a black
fixation cross was shown on the monitor. A resting
time of 5 s between two movements had to be main-
tained. A wrong movement was indicated to the sub-
ject by changing the color of the circle from green
to red for 100 ms. Wrong movements were defined
as moving before the resting time (5 s) was expired,
moving too fast, e.g., in case slow movements were
requested, and moving too slow, e.g., in case fast
movements were requested. Wrong movements were
not taken into account for data analysis. In order to
get the same amount of movements from each test
person, a run was finished after 40 valid movements.
To determine the physical begin of a movement a mo-
tion tracking system was used to track the position
of the right hand, which is further explained in Sec-
tion 2.3.1.
2.2 Data Acquisition
EMG was acquired at 5 kHz with a bipolar setup on
four muscles of the right arm, named M. brachio-
radilis, M. bizeps brachii, M. triceps brachii, and M.
deltoideus. For the measurement Ag/AgCl gel elec-
trodes were used. The skin of the test persons was
prepared with medical alcohol to obtain better con-
ductivity. The signals were amplified and digital-
ized by a BrainExG MR (Brain Products GmbH, Ger-
many) amplifier and saved to a computer. The events
from the two switches, meaning pressing and releas-
ing, were marked in the EMG data. The motion track-
ing system consisted of three ProReflex1000 cam-
eras (Qualisys AB, Sweeden) and a passive infrared
marker mounted on the back of the right hand of the
subjects. The position of the marker was tracked with
a frequency of 500 Hz and stored on a computer. The
accuracy of the system was approximately 0.15 mm.
2.3 Data Processing
2.3.1 Finding Physical Movement Onsets
The motion tracking system was used to determine
the physical movement onset. For this the movement
speed of the right hand was derived from the track-
ing data. Afterwards, the EMG and the tracking data
were synchronized. As mentioned before in Subsec-
tion 2.1, the begin of a movement was marked in the
EMGOnsetDetection-ComparisonofDifferentMethodsforaMovementPredictionTaskbasedonEMG
243
EMG data using a flat board. Since the device con-
tains a microswitch, it is obvious that the subject was
already moving when the switch is released. How-
ever, after synchronizing the EMG data and the move-
ment speed, the markers from the flat board were
used as a starting point for finding the physical move-
ment onsets in the tracking data. Starting from those
marker positions the movement speed was analyzed
backwards. Once the movement speed was below
a threshold, the detected position was saved as the
physical movement onset. This threshold was set to
0.15 mm/sample, since this is the given accuracy of
the tracking system. This was done consecutively for
all recorded runs and contained movements. Figure 1
illustrates the procedure. The vertical dashed line in-
dicates the position of the marker from the flat board
and the solid vertical line indicates the found position
of the physical movement onset.
Figure 1: Physical movement onset detection. The move-
ment speed is show. The dashed vertical line indicates the
position of the marker from the flat board and the solid one
the detected physical movement onset.
In the further analyses the determined physical move-
ment onsets, found with the motion tracking system,
were used as the reference for the onset detection in
the EMG data.
2.3.2 Preprocessing of EMG Data
Three different methods Teager Kaiser Energy
operator (TKEO), variance, and standard deviation
were used to preprocess the EMG data. The goal
of preprocessing is to enhance the signal-to-noise
ratio of the signals. The TKEO is widely used as a
preprocessing method in EMG onset detection. The
algorithm calculates the energy of the signal in a very
efficient way. Only three consecutive samples are
needed. The formula for the TKEO is given as:
Ψ(t) = x(t)
2
(x(t 1)x(t + 1)) (1)
where x(t) is the current EMG sample.
As one can see, one of the required samples lays in the
future. In order to use the TKEO online, the formula
is thus redefined as:
Ψ
0
(t) = x(t 1)
2
(x(t 2)x(t)). (2)
Before applying the TKEO, the data is filtered us-
ing a 20 Hz second order butterworth high-pass filter.
The filtering is done to remove motion artifacts, like
movement of cables or changes in resistance at the
electrodes. Afterwards the energy of the EMG signal
is calculated using the TKEO. At the end the resulting
energy is smoothed to remove large fluctuations.
The variance method for preprocessing EMG sig-
nals is based on the following equation (Nikolic and
Krarup, 2011):
v(t) =
1
N 1
m
i=m
x
2
(t + i)
1
N 1
m
i=m
x(t + i)
!
2
(3)
where N = 2m + 1 is the window length.
Here again samples do lay in the future, therefore the
formula is reformulated as follows for an online use
of the variance:
v(t)
0
=
1
N 1
0
i=2m
x
2
(t + i)
1
N 1
0
i=2m
x(t + i)
!
2
(4)
When using the variance for preprocessing, a moving
window of fixed length is used. The variance of the
window is assigned to the last data point. This is done
consecutively for all samples of the data, resulting in
a signal with smoothed baseline noise and enhanced
amplitudes during movement phases. The sensitivity
of this method can be adjusted by varying the length
of the window. For smaller windows the method re-
acts faster to changes. The drawback is that artifacts
are also more amplified. Thus by increasing the win-
dow size the baseline noise gets smoother but the am-
plitudes during movement phases are less amplified.
The procedure for the standard deviation is the
same as for the variance. Even if the calculations
of both methods are very similar, they have different
mathematical properties.
For later analysis the total computational time for
all preprocessing methods was measured. A compar-
ison of all methods is shown in Figure 2.
2.3.3 Onset Detection
For onset detection in the preprocessed EMG data an
adaptive threshold approach was used. The formula
is given as:
T (t) = x(t)
N
+ (t)
N
(5)
BIOSIGNALS2013-InternationalConferenceonBio-inspiredSystemsandSignalProcessing
244
(a) Raw EMG signal.
(b) Preprocessing with the variance.
(c) Preprocessing with the standard deviation.
(d) Preprocessing with the TKEO.
Figure 2: Resulting signals after the application of prepro-
cessing methods: a) original EMG signal, b) after variance,
c) after standard deviation, and d) after TKEO.
with x the mean value, µ the standard deviation, N the
length of the window for the mean and standard devia-
tion and p the sensitivity factor of the threshold (Sem-
maoui et al., 2012). The preprocessed data was passed
to the adaptive threshold procedure using various val-
ues for the parameters of the different methods. For
the standard deviation and variance window sizes of
100, 250, and 500 samples were used. For the thresh-
old the windows of sizes 5000, 10000, 15000, and
20000 samples and p values of 0 19 were used.
As performance measures for preprocessing methods
balanced accuracy and prediction time were used.
Balanced Accuracy. The balanced accuracy metrics
is calculated as the mean of sensitivity and speci-
ficity (Velez et al., 2007). The metrics is defined
as:
Balanced accuracy
def
= 0.5 [
T P
T P+FN
+
T N
T N+FP
]
where TP, TN, FP and FN represent the number of
true positives, true negatives, false positives and
false negatives, respectively. A classification was
counted as TP, if the signal exceeded the thresh-
old in range 500 0 ms before a physical move-
ment, classifications in other ranges were counted
as FP. Not detecting a movement was counted as
FN. The number of TN was counted as the amount
of periods between two movements where no FP’s
occurred. For the onset detection, parts of the data
containing wrong movements were not taken into
account. Therefore the whole wrong movement
plus ranges of 1 s before and after it were rejected
from the signal.
Prediction Time. The prediction time is defined as
the elapsed time between the detected onset in the
EMG signal and the physical movement onsets
detected by the motion tracking system.
For all combinations of the above mentioned parame-
ters the balanced accuracy and prediction time for all
recorded runs were calculated. Afterwards, a cross
validation over all subjects was done. Thus, the mean
balanced accuracy and prediction time for seven out
of the eight subjects were calculated. From those
results the best combination of parameters, meaning
those which produce the highest balanced accuracy
with earliest prediction time, was chosen and tested
on the data from the remaining subject. This was done
separately for all preprocessing methods and subjects.
The mean trainings results for different EMG chan-
nels are shown in Table 2. The training showed that
best results could be obtained when using signals
from the M. bizeps brachii. Results were statistically
analyzed by repeated measures ANOVA with method
(VAR, STD, and TKEO) and speed (slow and fast) as
within-subjects factor.
3 RESULTS
Results of all described analysis are summarized in
Table 1. Statistical analysis showed that there are sig-
nificant differences between the three compared pre-
processing methods for the prediction time, but not
for the balanced accuracy. STD has significantly ear-
lier prediction times compared to the two other meth-
EMGOnsetDetection-ComparisonofDifferentMethodsforaMovementPredictionTaskbasedonEMG
245
Table 1: Results of all preprocessing methods on the dataset from 8 subjects with slow and fast movement speeds. PT, and
BA indicate prediction time in ms and balanced accuracy respectively.
VAR STD TKEO
slow fast slow fast slow fast
SUB PT BA PT BA PT BA PT BA PT BA PT BA
1 202 0.86 52 0.85 216 0.88 65 0.84 195 0.88 50 0.81
214 0.88 54 0.88 230 0.88 66 0.88 196 0.86 50 0.9
209 0.88 50 0.96 222 0.9 64 0.94 191 0.89 49 0.93
2 194 0.81 33 0.91 215 0.84 39 0.91 201 0.8 36 0.9
221 0.92 50 0.78 226 0.9 50 0.63 207 0.95 57 0.65
175 0.74 44 0.9 182 0.74 57 0.9 143 0.81 42 0.81
3 184 0.8 91 0.58 190 0.8 101 0.56 176 0.8 86 0.63
175 0.88 63 0.63 182 0.88 78 0.63 167 0.83 55 0.63
177 0.78 54 0.51 178 0.73 76 0.49 169 0.81 29 0.41
4 129 0.4 46 0.86 115 0.41 47 0.81 119 0.4 38 0.79
93 0.4 31 0.66 102 0.44 31 0.69 110 0.44 31 0.71
106 0.46 33 0.66 135 0.45 47 0.64 99 0.44 37 0.6
5 198 0.95 43 1.0 245 0.95 47 1.0 184 0.9 41 0.96
216 0.9 56 1.0 244 0.93 65 1.0 197 0.88 40 0.94
186 0.9 46 0.98 218 0.9 50 0.98 189 0.91 46 0.96
6 173 0.89 49 0.91 219 0.93 70 0.91 163 0.93 46 0.88
149 0.86 46 0.91 177 0.84 53 0.91 139 0.91 42 0.93
182 0.85 38 0.83 213 0.85 73 0.84 148 0.89 28 0.88
7 73 0.86 44 0.96 81 0.9 45 0.96 84 0.73 44 0.94
75 0.73 42 0.96 86 0.63 43 0.89 70 0.58 41 0.93
47 0.44 26 0.84 59 0.48 29 0.81 47 0.45 27 0.86
8 218 0.76 57 0.96 238 0.76 76 0.96 207 0.8 56 0.96
234 0.79 49 0.88 252 0.79 66 0.85 203 0.8 49 0.83
282 0.88 52 0.98 296 0.86 58 0.98 248 0.94 46 0.98
Table 2: Mean balanced accuracy for training with differ-
ent EMG channels, with all, EMG1, EMG2, EMG3, and
EMG4 representing mean of all channels, M. brachioradi-
alis, M. bizeps brachii, M triceps brachii, and M. deltoideus
respectively.
VAR STD TKEO
all 0.79 0.78 0.75
EMG1 0.66 0.65 0.62
EMG2 0.81 0.81 0.8
EMG3 0.63 0.62 0.6
EMG4 0.68 0.69 0.66
ods. [prediction time: F(2, 46) = 46.4, p < 0.001,
pairwise comparisons: VAR vs. STD = 0.001, VAR
vs. TKEO = n.s., STD vs. TKEO = 0.001; balanced
accuracy: F(2, 46) = 2.59, p = n.s., all each pairwise
comparisons: p = n.s.]
The same pattern was found for different move-
ment speeds. Significant differences for the predic-
tion time, but not for the accuracy were found. Slow
movements lead to an earlier prediction time. [pre-
diction time: F(1, 23) = 142.1, p < 0.001, all each
pairwise comparisons: p < 0.001; balanced accuracy:
F(1, 23) = 1.57, p = n.s., all each pairwise compar-
isons: p = n.s.].
It was found that the calculation time for the
TKEO needs approximately 1.5 times the time the
other two methods need.
The following parameters were determined for the
preprocessing methods in the training phase. VAR
windows size (WS) of 100 samples with p = 10 and
20000 WS for the adaptive threshold, STD WS of
100 samples with p = 7 (subjects 1,3,5,6,8) and p =
8 (subjects 2,4,7) and 20000 WS for the adaptive
threshold, and for the TKEO p = 7 and 20000 WS
for the adapt. threshold.
4 DISCUSSION AND
CONCLUSIONS
Since the calculation time for the VAR and STD is
1.5 times faster compared to the time needed by the
TKEO, they suite better the needs for online process-
ing of EMG data with embedded systems. Although,
the STD prediction time in average is 13 ms earlier
BIOSIGNALS2013-InternationalConferenceonBio-inspiredSystemsandSignalProcessing
246
compared to the prediction time of VAR, one may pre-
fer VAR for embedded systems, since the calculation
of the square root for the STD is computational very
expensive on such devices. However, the decision de-
pends on the application, if the earliness is very im-
portant, one would use STD for preprocessing. Fur-
ther, by combining VAR or STD with the adaptive
threshold very good results for movement prediction
could be achieved. In summary, a simple and compu-
tational very efficient way of predicting movements
using EMG data can thus be realized.
For some subjects rather large variations in predic-
tion times, especially for slow movements, could be
observed. Mainly two reasons could have led to these
results. First, it is possible that the subjects somehow
pretensioned there muscles, even if they were told to
move right away without any preparation. This could
have led to an earlier movement prediction. Hence,
if the subjects did so for some movements and for
other not, this could explain the variation in predic-
tion times. Second, the only constraint for slow move-
ments was a minimum time of 1 s for the movement
from the flat board to the buzzer Section 2.1. The
subjects were asked to perform the movements with a
steady speed. However, the subjects may have varied
the initial movement speed, e.g., fast start followed
by a slower movement. Movements with fast initial
speed may be detected later compared to those with
slow initial speed. Thus, the differences in predic-
tion time could be explained by the variation of initial
movement speeds.
Our results show that it is possible to predict
both slow as well as fast movements. We found
that for slow movements earlier prediction times were
achieved. Whether this is a real effect, or might be
due to experimental setup, i.e., datasets from slow and
fast movements were merged for training, cannot fi-
nally answered here. Due to our focus on a real ap-
plication, parameters were not optimized for a certain
speed of movement. This was done since in applica-
tions one cannot relay on a certain movement speed
and the methods will have to deal with both, fast and
slow movements.
ACKNOWLEDGEMENTS
Work was funded by the German Ministry of Eco-
nomics and Technology (grant no. 50 RA 1011 and
grant no. 50 RA 1012). We want to thank Su Kyoung
Kim for her help with the statistics.
REFERENCES
Bonato, P., D’Alessio, T., and Knaflitz, M. (1998). A sta-
tistical method for the measurement of muscle activa-
tion intervals from surface myoelectric signal during
gait. IEEE Transactions on Biomedical Engineering,
45(3):287–299.
Cavanagh, P. R. and Komi, P. V. (1979). Electromechanical
delay in human skeletal muscle under concentric and
eccentric contractions. European Journal of Applied
Physiology and Occupational Physiology, 42(3):159–
163.
Folgheraiter, M., Jordan, M., Straube, S., Seeland, A., Kim,
S.-K., and Kirchner, E. A. (2012). Measuring the im-
provement of the interaction comfort of a wearable ex-
oskeleton. International Journal of Social Robotics,
4(3):285–302.
Hodges, P. W. and Bui, B. H. (1996). A comparison
of computer-based methods for the determination of
onset of muscle contraction using electromyography.
Electroencephalography and Clinical Neurophysiol-
ogy, 101(6):511–519.
Kaiser, J. F. (1990). On a simple algorithm to calculate the
‘energy’ of a signal. In Proc. IEEE International Con-
ference on Acoustics, Speech and Signal Processing
ICASSP-90. Conf, pages 381–384.
Li, X., Zhou, P., and Aruin, A. S. (2007). Teager-kaiser en-
ergy operation of surface EMG improves muscle ac-
tivity onset detection. Annals of Biomedical Engineer-
ing, 35(9):1532–1538.
Nikolic, M. and Krarup, C. (2011). EMGTools, an adaptive
and versatile tool for detailed EMG analysis. Biomed-
ical Engineering, IEEE Transactions on, 58(10):2707
–2718.
Semmaoui, H., Drolet, J., Lakhssassi, A., and Sawan, M.
(2012). Setting adaptive spike detection threshold for
smoothed TEO based on robust statistics theory. IEEE
Transactions on Biomedical Engineering, 59(2):474
482.
Solnik, S., Rider, P., Steinweg, K., DeVita, P., and Horto-
bgyi, T. (2010). Teager-kaiser energy operator signal
conditioning improves EMG onset detection. Euro-
pean Journal of Applied Physiology, 110(3):489–498.
Velez, D. R., White, B. C., Motsinger, A. A., Bush, W. S.,
Ritchie, M. D., Williams, S. M., and Moore, J. H.
(2007). A balanced accuracy function for epista-
sis modeling in imbalanced datasets using multifac-
tor dimensionality reduction. Genetic Epidemiology,
31(4):306–315.
Zhou, S., Lawson, D. L., Morrison, W. E., and Fairweather,
I. (1995). Electromechanical delay in isometric mus-
cle contractions evoked by voluntary, reflex and elec-
trical stimulation. European Journal of Applied Phys-
iology and Occupational Physiology, 70(2):138–145.
EMGOnsetDetection-ComparisonofDifferentMethodsforaMovementPredictionTaskbasedonEMG
247