Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/310938998

Activity Recognition of a Badminton Game Through Accelerometer and


Gyroscope

Conference Paper · December 2016


DOI: 10.1109/ICCITECHN.2016.7860197

CITATIONS READS
40 2,798

4 authors:

Ariful Islam Anik Mehedi Hassan


University of Manitoba Islamic University of Technology
2 PUBLICATIONS 91 CITATIONS 2 PUBLICATIONS 40 CITATIONS

SEE PROFILE SEE PROFILE

Hasan Mahmud Md Kamrul Hasan


Islamic University of Technology Islamic University of Technology
80 PUBLICATIONS 539 CITATIONS 243 PUBLICATIONS 3,100 CITATIONS

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Ariful Islam Anik on 10 July 2019.

The user has requested enhancement of the downloaded file.


Activity Recognition of a Badminton Game
Through Accelerometer and Gyroscope
Md. Ariful Islam Anik∗ , Mehedi Hassan† , Hasan Mahmud‡ and Md. Kamrul Hasan§
Systems and Software Lab (SSL), Department of Computer Science and Engineering (CSE)
Islamic University of Technology (IUT), Gazipur, Bangladesh
Email: ∗ arifulislam@iut-dhaka.edu, † mehedihassan@iut-dhaka.edu, ‡ hasan@iut-dhaka.edu, § hasank@iut-dhaka.edu

Abstract—The scope for doing physical exercises in daily life It is noteworthy that there are in fact some existing
is declining day by day. But, the importance of human physical solutions for the mentioned cause. The well-known providers
exercise for a healthy life, remains the same. It is necessary are Xbox360, PlayStation, Wii Nintendo etc. But these
to generate a solution to simulate the outdoor experience of
physical exercises and sports inside our home. In this paper, solutions cost a hefty amount of money. They also have some
we propose an idea of recognizing the activities of a badminton technical issues. Most of these games use a vision based
game which has the potential to be useful in simulating system where low light, ambiguous background, unaware
the Badminton Sport. We have used motion sensors (e.g. movement might be mistaken as a move of the game itself.
Accelerometer, Gyroscope) to recognize different activities like, The vision based systems are also known to be on the slower
serve, smash, backhand, forehand, return etc. We have collected
data from a large set of users and labeled their data over several side when it comes to the flow of data.
instances. We have applied the K-Nearest Neighbors (k-NN)
and Support Vector Machines (SVM) classifiers to recognize
those activities. Existing approaches (e.g. Microsoft Xbox 360) A. Activity Recognition Idea
used vision based techniques to recognize activities and use it Activity recognition is the mathematical interpretation of a
in simulated games but we are using sensor based approach.
Vision based approaches have some limitations such as slow human motion by a computing device. In personal computing,
rate of data, illumination constraints, occluded backgrounds gestures are mostly used for input commands. Recognizing
etc. Our approach gives a low cost solution with a classification gestures as input allows computers to be more accessible for
technique which is faster. The experimental result shows a the physically-impaired and makes interaction more natural in
decent recognition rate. a gaming environment [2]. In this activity recognition part,
Keywords - Badminton Sport, Activity Recognition, we will identify some well-known and mostly used moves of
Accelerometer, Gyroscope, k-NN, SVM. the Badminton game. The selected moves for our system are
Smash - a move that generates the highest magnitude of force
I. I NTRODUCTION from a player, Serve - a move to start the game from one
Physical activity is any activity that helps to improve or end, Backhand - A move played with rear part of one hand,
maintain one’s physical fitness. For the assurance of a healthy Forehand - a move played with usual hand position, Return -
physique and mind, there are hardly any substitutes of regular A move that is played to reverse the serve of the opponent.
physical exercise and activities. As we speak of activities, they Our idea of the activity recognition system can also extend to
also extend to several outdoor sports and games. But from a Virtual Reality game.
our current social point of view and working schedule, it is
not possible for the people from all professions to participate B. Hardware Definitions
in physical exercises and outdoor sports in a regular basis. For this entire system, firstly we need a Badminton racket.
Studies show that physically active people are less likely to This racket will be integrated with a MPU-6050 sensor.
develop coronary heart disease than those who are inactive [1]. An MPU-6050 is a conjunction of an accelerometer and a
gyroscope. An accelerometer is a device that measures proper
So, we decided to focus our research on how can a usual acceleration (’g-force’). Proper acceleration is not the same
person who doesn’t have regular opportunity of physical as coordinate acceleration (rate of change of velocity). For
exercise and sports can have the same experience in his leisure example, an accelerometer at rest on the surface of the Earth
without even stepping out of this room. The initial idea that will measure an acceleration g = 9.81ms−2 straight upwards.
we encountered is a Virtual Reality game of the Badminton By contrast, accelerometers in free fall (falling toward the
sport that can give a real life experience. The reason for center of the Earth at a rate of about 9.81ms−2 ) will measure
selecting Badminton among the others sports is that the range zero. A Gyroscope is a spinning wheel or disc in which the
of exercises that one can do for the sport of badminton is axis of rotation is free to assume any orientation by itself.
quite big. This wide range of physical movements will enable The Racket along with the MPU-6050 will be connected to
a person to explore various exercise related activities. an Arduino module. This Arduino module creates a data flow
with the computer. The accelerometer will provide us with raw
acceleration data in the X, Y, and Z axes and the gyroscope tennis sport are actually different type of sports even though
will provide us the angular value in the X, Y and Z axes. there are some similarities among them. Tennis is a sport that
involved the movement mainly on the left and right, the ball
is much heavier, much power is needed to whack them to the
opposite side and the overall speed of the game is slower.
While badminton is a sport that involved a lot of footwork
on the sport field, lighter shuttle weight, consumes greater
stamina, highest game speed among the racket sports and it
requires a lot of wrist movements. The similarities of these
two sports are that, they are racket sports and both of these
sports use very similar muscle and arm movements.

C. Z. Shan et al. [5] investigated dynamic data of


upper limb movement including wrist, elbow and shoulder
movements. They found that the wrist movement is the
crucial parameter in badminton game. Amin Ahmadi et al.
[6] investigated the translational and rotational motion of the
swing using accelerometers for athlete skill assessment. The
work of Chien-Lu Tsai et al. [7] analyze the muscular surface
EMG (Electromyography) activities pattern and provides
Fig. 1. Badminton Bat with Integrated Sensor
quantitative information about the exertion for holding and
swinging the badminton racket. This serve as an indication to
the player that, how much strength is needed to execute the
C. Implementation powerful smash. However, the work of [6] and [7] emphasized
As far as the activity recognition idea is concerned, ac- on bodily activities of the human in performing the action.
celerometer will provide the acceleration data and the gy- The works of T. Jaitner et al. [8] in analyzing the racket
roscope will provide the angular values. This data will be speed provide good information about racket, necessary for
segmented, classified and the features of the data will be contributing a powerful shuttle ball speed. They only use
extracted in our proposed model. We will implement the idea accelerometers to correlate the velocity of the shuttle ball
based on RMS values, K-Nearest Neighbor (k-NN), Support but lacked information about how hard the shuttle ball was
Vector Machines (SVM) classifiers. being hit and at which point of the racket hit the shuttle ball.
The works of R. Jiang et al. [9] mentioned that the smashing
II. R ELATED W ORKS performance is affected by stress and instantaneous speed of
Our goal is to correctly recognize activities performed in the upper arm based on the movement mechanics theory and
a badminton game using motion sensors. The game will be law of conservation of energy. A standard or benchmark action
controlled by a sensor enabled badminton racket. Therefore, for smashing can be regulated by using this quantitative model.
the key things here are activity recognition from sensor value
and the movement of a sensor enabled badminton racket. Therefore, it is visible that there have been numerous works
There have been similar works in the field of analyzing of using motion sensors to recognize activity in different racket
strokes and smash in various racket and bat based game. M. based game. In case of badminton, multiple works have been
Lapinski from MIT Media Lab had created a sensor-based done in the field of smash analysis and muscle movement
system to analyze baseball movements called SportSemble during badminton smash. However, there have not been any
[3] which is a 6 DOF (degree-of-freedom) sensor node that significant work in recognition of other activities like service,
is able to indicate the force and torque signals of the players. smash return, forehand, backhand etc. Our work focus on
It consists both low and high range sensors so it is able to recognizing these activities from accelerometer and gyroscope
detect any motion from low speed to high speed. By using data. The output of this research will result in the recognition
the IMU (Inertial Measurement Unit), it is possible to present of badminton activity.
the swing profile of the bat.
III. M ETHODOLOGY
There have been some researches on tennis movement
A. System Integration
analysis and commercial product to track the tennis
performance. ZEPP Tennis [4] is one of the popular tennis We have used a MPU-6050 sensor, which contains an
swing tracking sensor which able to track the information integrated accelerometer and gyroscope, with the racket. This
of the ball serving, impact, sweet spot, and provide a 3D racket will be used as the input device in our system. For
feedback to the player. Yet the tennis sensor is not suitable reading the sensor values we have used an arduino module
to apply on badminton game since the badminton and the (Arduino Mega). We also created connection between the
arduino module and matlab module for our purpose of ac- the errors in data. The MPU-6050 has a digital low pass filter
tivity recognition. Because, In matlab, we plot the data for (DLPF) for both the gyroscope and accelerometer. It means
visualization so that we can understand the data and perform that the low pass filter only allows lower frequencies to pass
recognition operation. and filters out higher frequencies that come from the sensor.
MPU-6050 also comes with a DMP which means Digital
B. Defining Activities Motion Processor. It is also called a Digital Motion Processing
We have identified this following activities that are common Unit. This DMP can be programmed with firmware and is
in a real life badminton game - able to do complex calculations with the sensor values [10].
i) Serve, DMP fuses the accelerometer and gyroscope data together to
ii) Return, minimize the effects of errors inherent in each sensor [11]. It
iii) Smash, is to be noted that, we have not applied any additional noise
iv) Backhand, filter. To convert the raw acceleration and gyroscope value
v) Forehand. to an understandable format, we used the help of a library
We need to identify these activities performed by users at built by Omer Ekram Ul Haq named MPU6050 Arduino [12].
minimum. During each activity, we will get different sensor Uisng the library, first the data was calibrated. We calculated
values. From these sensor values, we will recognize the an offset for the starting position and then using that offset,
activities performed by the users. The recognition will be done we calculated the acceleration and angle.
by various algorithmic approaches such as k-NN, SVM, RMS E. Feature Selection
values and Clustering which will identify to what activity class After processing the data, we have got acceleration and
a test dataset belongs to. Among the results gathered from the gyroscope value in each of the three axis. Now, in the goal
application of these algorithms, we will choose the best results. of recognizing activities, we need to identify the features that
C. Data Collection are most important for recognition. We have tried out different
combinations and found out the required features for activity
We have used a MPU-6050 sensor to collect the required recognition.
data for our activity recognition. MPU-6050 contains an
accelerometer and a gyroscope sensor. It is very accurate as it Feature Description
The average value of the
contains 16-bits analog to digital conversion hardware for each Mean
signal over the window
channel. Therefore it can capture the x, y, z channel at the same Median signal value
Median
time. The sensor uses the I2C-bus to interface with Arduino. over the window
MPU-6050 provides us raw acceleration and gyroscope data Measures the spreadness of
Standard Deviation
the signal over the window
in 3 coordinates. Square value of standard
Variance
deviation
Root mean square value
RMS
of the signal
Positive peak value
Highest Peak
of signal
Negative peak
Lowest Peak
of signal
Calculated by applying FFT on the
Energy
signal and taking absolute value

TABLE I
F EATURES WITH BRIEF DESCRIPTION

We have calculated this values separately on the three


accelerometer axis values and three gyroscope axis values. We
have added all these values in the feature vectors. So, Each
feature vector have length of (6 x 8) = 48 which means we
have 48 values in each feature vector.
IV. R ECOGNITION OF THE ACTIVITIES
Fig. 2. Raw Accelerometer data samples A. Fixing the Axes and Initial Positioning
Before we started to take data from the accelerometer,
D. Data Filtering and Preprocessing we have to calibrate the accelerometer to fix its axes. Once
Now we cannot understand the data clearly. Because it is its axes is fixed, the MPU automatically adjust the axes
not in a normal acceleration or angle format. To understand the according to the movement. So, we don’t need to consider
data and make it usable first we need to convert the data in a the axis changing issue during movement.
regular format and apply some filtering to reduce the noise and
For making the calculation process simpler, we have set D. Applying Support Vector Machines (SVM)
an initial position before performing any activity. When not Support Vector Machines (SVM) are supervised learning
playing a shot, it is intuitive for the player to fix the racket models with associated learning algorithms that analyze data
in a position which normally vary from player to player. For used for classification and regression analysis. In SVM, we
simplicity, we have fixed the same position for every player. give a set of training examples and the classifier build a
model that assigns new examples into one category. So, it
B. Applying Root Mean Square (RMS) value works as a non-probabilistic binary linear classifier. When
the data are not labeled, supervised learning is not possible.
RMS value of a set of values is the square root of the So labeled data is a requirement for SVM.
arithmetic mean of the squares of the values. In case of a set
of n values (x1 , x2 , x3 , ., xn ), the RMS value will be-
SVM has been used previously in different types of activity
recognition. It has been used to recognize human physical
r activities [15] and also in many other different kinds of activity
1 recognition [16] [17]. We have applied SVM on our dataset.
xrms = (x1 2 + x2 2 + · · · · +xn 2 ) (1)
n We have created two subsets of data from our dataset. The
bigger set is used as the training set and the smaller set is
To calculate the combined signal of the x,y,z axis, we de- used as the test set.
cided to calculate the RMS value for every set of acceleration.
We followed the given formula to calculate the RMS value for V. R ESULT A NALYSIS
our defined activities. For example, we calculated the RMS
A. Results from Root Mean Square (RMS) value
value for three different activity (serve, smash, and backhand)
for some users. From the graph of RMS values of different activities, it
is quite evident that, for each of the activity, RMS value is
similar. It is due to different reasons. Firstly, though each
activity is different from one another, the pattern that users
follow when performing activities are similar. Because when
performing activities the acceleration mainly changes during
a certain period.

Fig. 3. RMS values for Serve Activity

C. Applying K-Nearest Neighbors Algorithm (k-NN)


K-Nearest Neighbors (k-NN) is an offline classification
algorithm. In k-NN classification, the output is a class
membership. An object is classified by a majority vote of its Fig. 4. RMS Comparison for different activities
neighbors, with the object being assigned to the class most
common among its k nearest neighbors where k is a positive
integer number. k-NN is a type of instance-based learning, Here, the difference is that, the changes are in different axes
or lazy learning, where the function is only approximated for different activities. But when we are calculating the RMS,
locally and all computation is deferred until classification. we are actually ignoring separate axis and combining all axes
k-NN has previously been used in sensor based research to generate a single value. So, even if the changes were in
works [13] [14]. different axes, the RMS value of different activities becomes
almost the same. Also, for calculating the RMS, the values
We have applied k-NN on our dataset. We have created are firstly squared and then root value is calculated. For this,
training feature vectors from the training datasets and com- the peak in negative axis is also moving to positive axis. The
pared our test feature vectors with them. we have used 1 as peak of RMS value will always be positive.That’s why we
the k value, which means the test feature vectors is assigned have come to the decision that, considering the RMS value
to the class of single nearest neighbor. for comparison wouldn’t yield good result.
B. Results from K-Nearest Neighbors (K-NN) R EFERENCES
K-NN classification assigns a class to each of the test [1] D. E. Warburton, C. W. Nicol, and S. S. Bredin, “Health benefits of
physical activity: the evidence,” Canadian medical association journal,
data based on the training data. So, when we applied K-NN vol. 174, no. 6, pp. 801–809, 2006.
classification in our dataset, all the test data were assigned to [2] H. Junker, O. Amft, P. Lukowicz, and G. Tröster, “Gesture spotting with
a training activity class. We have used three activities(smash, body-worn inertial sensors to detect user activities,” Pattern Recognition,
vol. 41, no. 6, pp. 2010–2024, 2008.
serve, backhand) dataset for testing. After analyzing the results [3] M. Lapinski, E. Berkson, T. Gill, M. Reinold, and J. A. Paradiso, “A
we found out that, the classification gives us around 58% distributed wearable, wireless sensor system for evaluating professional
accurate recognition of activities on average. baseball pitchers and batters,” in 2009 International Symposium on
Wearable Computers, pp. 131–138, IEEE, 2009.
C. Results from Support Vector Machines(SVM) [4] ”ZEPP TENNIS,” ZEPP US Inc. [Online]. Available:
http://www.zepp.com/tennis/ [Last Accessed On: 23 May 2016,
We have prepared our dataset containing three activities 09.51 PM].
[5] C. Z. Shan, E. S. L. Ming, H. A. Rahman, and Y. C. Fai, “Investigation of
data. We have used the data of smash, serve and backhand upper limb movement during badminton smash,” in Control Conference
activity. We had a dataset of 180 instances. We separated the (ASCC), 2015 10th Asian, pp. 1–6, IEEE, 2015.
data using Resample filter in Weka machine learning tool [18]. [6] A. Ahmadi, D. D. Rowlands, and D. A. James, “Investigating the
translational and rotational motion of the swing using accelerometers
We took 80% data as training data and rest 20% as the test for athlete skill assessment,” in 2006 5th IEEE Conference on Sensors,
data. We applied SVM on the test data using the Weka machine pp. 980–983, IEEE, 2006.
learning tool [18] and got a 88.89% accuracy on the test data. [7] C.-L. Tsai, C.-C. Yang, M.-S. Lin, and K.-S. Huang, “The surface emg
activity analysis between badminton smash and jump smash,” in ISBS-
We have generated a confusion matrix table that shows us Conference Proceedings Archive, vol. 1, 2008.
the details of the classifications. In the confusion matrix in [8] T. Jaitner and W. Gawin, “Analysis of badminton smash with a mobile
Table II, each cell shows us the number of instances for a measure device based on accelerometry,” in ISBS-Conference Proceed-
ings Archive, vol. 1, 2007.
given class (row labels show the true class, and column labels [9] R. Jiang and Z. Wang, “Analysis on smashing motion in badminton,” in
show the predicted class). Correct predictions are given on the Proceedings of the International Conference on Information Engineering
diagonal cells. We have tested 12 instances of each activity and and Applications (IEA) 2012, pp. 651–657, Springer, 2013.
[10] DMP: Digital Motion Processing. [Online].
a total of 36 instances. We can see that, among these three Available:http://playground.arduino.cc/Main/MPU-6050/ [Last Accessed
activities, smash and backhand activities can be recognized On: 23 May 2016, 10.08 PM].
more accurately than serve activity. [11] DMP: Digital Motion Processing. [Online].
Available:http://www.geekmomprojects.com/mpu-6050-dmp-data-
Smash Serve Backhand Accuracy from-i2cdevlib/ [Last Accessed On: 23 May 2016, 10.01 PM].
Smash 12 0 0 100% [12] MPU-6050 and Arduino Calibration. [Online].
Serve 1 9 2 75% Available:https://github.com/helscream/MPU6050-Arduino [Last
Backhand 1 0 11 91.67% Accessed On: 23 May 2016, 10.26 PM].
[13] U. Maurer, A. Smailagic, D. P. Siewiorek, and M. Deisher, “Activity
TABLE II recognition and monitoring using multiple sensors on different body
C ONFUSION M ATRIX TABLE positions,” in International Workshop on Wearable and Implantable
Body Sensor Networks (BSN’06), pp. 4–pp, IEEE, 2006.
Overall accuracy = (Correctly identified instances)/(Total [14] A. Mannini and A. M. Sabatini, “Machine learning methods for classi-
fying human physical activity from on-body accelerometers,” Sensors,
number of instances) = 32/36 = 88.89% vol. 10, no. 2, pp. 1154–1175, 2010.
[15] L. Sun, D. Zhang, B. Li, B. Guo, and S. Li, “Activity recognition on
VI. C ONCLUSION AND F UTURE W ORKS an accelerometer embedded mobile phone with varying positions and
orientations,” in International Conference on Ubiquitous Intelligence
After analyzing the results from k-NN and SVM, it is quite and Computing, pp. 548–562, Springer, 2010.
obvious to say that the SVM classifiers gives us better results [16] N. Ravi, N. Dandekar, P. Mysore, and M. L. Littman, “Activity recog-
in recognizing the activities. But till now we have used offline nition from accelerometer data,” in AAAI, vol. 5, pp. 1541–1546, 2005.
[17] Z. He and L. Jin, “Activity recognition from acceleration data based on
classifiers to classify our activities. Also, we have used a discrete consine transform and svm,” in Systems, Man and Cybernetics,
dataset which is relatively small. So, we can increase the 2009. SMC 2009. IEEE International Conference on, pp. 5041–5044,
size of our dataset to increase the stability of the accuracy. IEEE, 2009.
[18] M. Hall, E. Frank, G. Holmes, B. Pfahringer, P. Reutemann, and I. H.
Also, there is a chance to improve the accuracy by applying Witten, “The weka data mining software: an update,” ACM SIGKDD
online classifiers like DTW (Dynamic Time Warping) for explorations newsletter, vol. 11, no. 1, pp. 10–18, 2009.
classifications. So, in our future works, we will focus on
improving the accuracy rate by applying the online classifiers
on our dataset. With this improved accuracy, the recognized
activities can further be used to train Artificial Intelligence(AI)
based applications such as various virtual reality games, where
we can control the difficulty level of the AI component with
much more precision.

ACKNOWLEDGMENT
We would like to thank Systems and Software Lab(SSL)
for providing us with the necessary hardware equipments.

View publication stats

You might also like