MEKATRONIKA
e-ISSN: 2637-0883
VOL. 2, ISSUE 2, 49 – 54
DOI: https://doi.org/10.15282/mekatronika.v2i2.6751




*CORRESPONDING AUTHOR | Ismail Mohd Khairuddin |  [email protected] 49
© The Authors 2020. Published by Penerbit UMP. This is an open access article under the CC BY license.

ORIGINAL ARTICLE
Ball Classification through Object Detection using Deep Learning for Handball
Arzielah Ashiqin Alwi
1
, Ahmad Najmuddin Ibrahim
1
, Muhammad Nur Aiman Shapiee
1
, Muhammad Ar Rahim Ibrahim
1
, Mohd Azraai
Mohd Razman
1*
and Ismail Mohd Khairuddin
1*

1
Faculty of Manufacturing and Manufacturing Engineering Technology, Universiti Malaysia Pahang (UMP), 26600 Pekan, Pahang Darul Makmur,
Malaysia.


ARTICLE HISTORY
Received: 5
th
Nov 2020
Revised: 26
th
Nov 2020
Accepted: 14
th
Dec 2020

KEYWORDS
Handball
Accuracy
High Speed Ball
Deep Learning
Object Detection

INTRODUCTION
The game of handball is appreciated at varying levels in different parts of the world. Besides, it is hugely popular in
France, Hungary, Germany, Poland, Russia and Romania. There are semi-professional leagues of handball in some
countries. However, the TV coverage of the sport is only limited to World Championships and other international
competitions. This fastball sport required quick analysis in the fast changing circumstances of the game and adapted well
to different conditions and needs, creating fun and engaging variations that anyone can play anywhere at any time [1].
Like other team sports, shooting a ball at the goal is the culmination of an offensive phase. Success or failure depends on
whether a team attains its ultimate aim, that of scoring a goal. Throwing efficiency is the key to winning or losing matches.
It depends mainly on the accuracy and speed of a throw [2]. Nevertheless, the challenging part of this sport is the sizing
of the goal post, as the size of the goal post is relatively small, standing at 2m (6.56ft) tall and 3m (9.84ft) wide, compared
to football. Thus, shooting accuracy is a crucial skill that needs to be strengthened during shooting training.
A handball goal marker tool for shooting accuracy performance analysis was proposed on this project by realising ball
detection. It is due to the existing research in handballs' training and sound experience as a handball athlete [3]. The
research proposed a ball shooting system and the best instrument to solve the scoring monitoring system. Unfortunately,
the research stated that the analysis showed that the target was not correct as the ball did not exceed its entire
circumference.
Therefore, this research was carried out to develop a training tool for the handball sport, mainly for ball detection
during shooting. The dataset of different ball positions was collected to train the dataset using deep learning. Instead of
using sensors as the ball detection, image processing object detection is proposed in this paper. The remaining part of the
paper starts with an elaboration beginning of the related works accordingly. The methodology will be clarified, where
systematic steps on developing the training tools will be deliberate in detail. Then, laying out the results as well as
associated discussion and lastly, to conclude the paper.
RELATED WORK

Recent development in sport training applications using image processing has led to renewed interest in machine
learning techniques [4]. However, the machine-learning concept's training tools are mostly found for football, athletics,
and tennis sports. A training tool was developed, the automated monitors for hitting load for tennis [5]. In this research,
the methods were used on 19 competitors that wore an inertial estimation unit (IMU) on their wrist. During the 66 video-
recorded instructional courses, the result for all 10-fold cross-validation using a cubic-kernel Support Vector Machine
(SVM) was classified into three types of shots with an overall accuracy of 97.4%. Later in 2020, catch detection for
American football using neural network (NN) in machine learning has been established. The method uses a sensor stage
ABSTRACT – Dynamic gameplay, fast-paced and fast-changing gameplay, where angle
shooting (top and bottom corner) has the best chance of a good goal, are the main aspects
of handball. When it comes to the narrow-angle area, the goalkeeper has trouble blocked
the goal. Therefore, this research discusses image processing to investigate the shooting
precision performance analysis to detect the ball's accuracy at high speed. In the handball
goal, the participants had to complete 50 successful shots at each of the four target
locations. Computer vision will then be implemented through a camera to identify the
ball, followed by determining the accuracy of the ball position of floating, net tangle and
farthest or smallest using object detection as the accuracy marker. The model will be
trained using Deep Learning (DL) models of YOLOv2, YOLOv3, and Faster R-CNN
and the best precision models of ball detection accuracy were compared. It was found
that the best performance of the accuracy of the classifier Faster R-CNN produces 99%
for all ball positions.

Alwi et al. │ Mekatronika │ Vol. 2, Issue 2 (2020)
50 journal.ump.edu.my/mekatronika ◄
to get nine degrees of freedom and audio data for both hands in 759 endeavours to get a pass [6]. After pre-processing,
the accumulated information was utilised for training the NN to categorise all endeavours, giving an accuracy of 93%.
Besides that, a profound learning network, called TrackNet where it uses a heatmap-based learning network, is
prepared to perceive the ball picture from a solitary edge and take in flying status from continuous frames [7]. The result
obtains for the TrackNet reach 99.7% for precision, 97.3% for recall and 98.5% for F1-measure.
Moreover, detecting the ball position was used to identify the scoring goal concerning the location of the goalpost in
the image [8]. Supervised learning, the SVM model was used for ball detection classification. There were 900 images
tested and classified. The goal detection for the visible ball is 98.3% with a 0.2% false positive, while detecting the ball
during occluded situation the detection rate is 76.2% with 2.6% false positive.
Some significant approaches and principles are considered beneficial and provide a lot of assistance for this research
after all the possibilities have been collected from the literature. In conclusion, this mixture of transfer learning and
machine learning can improve the accuracy performance for ball detection classification.
METHODOLOGY
Experimental setup
The research is divided into several levels. The first step is the experimental setup that has to be compatible with
image processing, transfer learning, ball and objective detection methods, image processing, and suitable accuracy
methods. The second phase of this study was analysing the ball's condition and ensuring that the video angle was correctly
taken for the successful ball positions classification. In this phase, the video will be split, and the ball is labelled as 'ball'
while the successful goal was grouped according to the classification required, which is the successful goal at the targeted
area. The third phase of this study will concentrate on training the dataset with a pre-trained model from different model
types with the transfer learning method. Therefore, the step of this project was fast detection ball using the deep learning
techniques to get the best accuracy performance on classifying the ball. In developing the training tools, accuracy analysis
for the successful goal at the targeted area, the video angle is taken, shooting training and high possibility of successful
goal were studied and analyse to obtain ball and goal in the frame. From the video captured during the shooting training,
the image was extracted according to the ball's successful goal and visibility.
The data collection that involves the successful goal was carried out at Universiti Malaysia Pahang (UMP) outdoor
handball court in Pekan, Pahang. The participants who volunteered for the shooting training are two players from the
UMP handball team, female and male, with 11 years and 7 years of experience, respectively. The video was captured
using EKEN H9R Action Camera and iPhone X camera in Full HD quality. Figure 1 (a) shows the Action Camera and
phone camera placement during the video recorded. Action Camera was located near the 11.5-meter line from the
goalpost, while phone cameras are located at the penalty line, which is 7- meters from the goal D-line as in Figure 1 (b).
Besides that, the video consist of three type shooting practice: standing, jump, and winger shooting both left and right
positions. There are 100 successful goal shots by both players, with 50 each shooting attempt.


(a) (b)
Figure 1. (a) Shooting video setup (b) shooting angle from outside the D-line
Data Pre-processing
Pre-processing applies until it is put in the machine learning or deep learning algorithm for all raw data transformation.
The positioning of raw data or images has a high risk of producing poor classification results. Therefore, the raw file
format that needs to be modified in this project is .xml to .txt because the data will be trained in YOLO and Faster R-
CNN algorithm. The flow of data pre-processing is shown in Figure 2.

camera

Alwi et al. │ Mekatronika │ Vol. 2, Issue 2 (2020)
51 journal.ump.edu.my/mekatronika ◄


Figure 2. Data Pre-processing flowchart
Data Labelling
Data labelling terms imply identifying the raw data by marking it to provide meaning. This study refers to the ball, so
the deep learning model can correctly learn the data. The bounding box used for data labelling is a rectangular box to
denote the object's position where the ball's position is to define in two coordinates, x and y-axis as in Figure 3. To label
the data, the labelling tools used are the LabelImg tools. This tool is a Python-based graphical image annotation tool that
uses Qt for its graphical interface. The list or annotation dataset is stored in the Pascal VOC (Visual Object Classes) in
XML file, which also supports the YOLO format.


Figure 3. Labelled of the ball's position
Labelled ‘ball’

Alwi et al. │ Mekatronika │ Vol. 2, Issue 2 (2020)
52 journal.ump.edu.my/mekatronika ◄
Train and Test Data Split
In machine learning, training and test data division are essential since this is a method for evaluating the output of a
machine learning algorithm. There is a distinction between training and testing data, where training data is implemented
in creating a model, while testing data means a collection used to verify the model designed. In addition, the percentage
of train data should be more significant than test data for data splitting percentages of train and test datasets. This research
dataset, 80:20 ratio, was used to split the dataset for ball dataset, which accumulated to 900 ball images.
Computer Vision Setup
Computer vision uses machine learning approaches to model image recognition to identify patterns for picture
perception [9]. It can help to classify the object according to its classes and detect the object. It is a type of signal
processing in which an image is entered, and it is possible to output the function associated with that image. In this project
computer, vision will be focussing on ball detection. For ball detection, transfer learning techniques were implemented
using a pre-trained model from different object detection algorithms: YOLOv2, YOLOv3 and Faster R-CNN.
Transfer Learning
Transfer learning is a deep learning technique in which the neural network model is first trained on a problem identical
to the problem being resolved. One or more layers of a trained model are then used in a new model trained on the topic
of concern. The pre-trained model used is from YOLOv2, YOLOv3, as YOLO's successful object detection was trained
to detect 80 different objects, and Faster R-CNN, where its softmax layer has been used to predict the target of the
proposed region. An easier understanding of transfer learning is depicted in Figure 4. Model A is the model that has
already been trained with multiple objects which are in a large dataset. Then, after model A are fully trained, include
model B, which detects specifically ball, therefore during the transfer learning, the training and testing set should be only
referred to as class 'ball', as described in Table 1.


Figure 4. Transfer Learning flowchart

Table 1. Called out 'ball' for training model pseudocode

Algorithm: called out ball
1: runMode
2: classes
= “train”
= [ “Ball” ]

RESULTS AND DISCUSSION
Condition and position accuracy performance
The accuracy performance of the ball detection is selected according to its condition and position. There are three
types of position and condition: floating ball, ball condition when tangle with net and the farthest and small ball position
refer to Figure 5. From the average accuracy, the result shows in Figure 6, and the result is taken for floating, net tangle
and farthest position of the ball, YOLOv3 improve to 9%, 20% and 22%, respectively from the YOLOv3 model. However,

Alwi et al. │ Mekatronika │ Vol. 2, Issue 2 (2020)
53 journal.ump.edu.my/mekatronika ◄
72%
32%
48%
81%
52%
70%
99% 99% 99%
Floating Net tangle farthest and small ball
YOLOv2 YOLOv3 Faster R-CNN
Faster R-CNN has the best accuracy performance with steady 99% accuracy in detecting the ball compare to YOLO in
all conditions.




Figure 5. (a) Frame 181 of floating condition (b) Frame 21 of ball tangle on the goal net (c) Frame 576 of farthest and
small condition ball













Figure 6. Average accuracy comparison in different conditions and position

Discussion
As illustrated in Figure 5, the prediction bounding box for the detection was accurately within the size of the actual
bounding box of the ball for floating, net tangle, and farthest and small ball. It shows that the Faster R-CNN was
adequately trained to detect the ball compared to the other YOLO versions accurately. The Faster R-CNN model shows
the best accuracy performance in detecting the high-speed ball with an average accuracy of 99%. Even though some
drawbacks, such as ghosting detection, where the model detects empty areas or other inanimate objects as the ball, it
manages to detect the ball efficiently.
CONCLUSION
In conclusion, the objective of this project in detecting the ball is successful by using the Faster R-CNN model. The
model gives 99% accuracy in detecting the object in all frames. Even though the ball was located at different locations,
either further away or floating, the accuracy detection is between 97% to 100%, albeit the high-speed movement. The
current research findings recommend to focus on the real-time implementation of the developed machine learning and
increase the training model so that the machine can recognise and have a better accuracy
(a)
(b)
(c)

Alwi et al. │ Mekatronika │ Vol. 2, Issue 2 (2020)
54 journal.ump.edu.my/mekatronika ◄
ACKNOWLEDGEMENT
The authors would like to thank the Innovative Manufacturing, Mechatronics and Sports Laboratory (iMAMS Lab) and
Faculty of Manufacturing and Mechatronic Engineering Technology of Universiti Malaysia Pahang for cooperating with
this research.
REFERENCES

[1] C. Manchado et al., "High-Performance Handball Player's Time-Motion Analysis by Playing Positions," Int. J.
Environ. Res. Public Heal. 2020, Vol. 17, Page 6768, vol. 17, no. 18, p. 6768, Sep. 2020.
[2] J. C. Zapardiel Cortés, C. Ferragut Fiol, C. Manchado, J. A. Abraldes Valeiras, and H. Vila Suárez, "Difference
of the speed of handball throwing during the competition in relation to efficiency: Analysis between the first and
the second half," Jan. 2018.
[3] S. K. Albzeirat, A. Elmetwaly, M. K. Albzeirat, and N. Z. Noriman, "Developing a Smart Monitoring System for
Refereeing Goal Setting in Football Developing a Smart Monitoring System for Refereeing Goal Setting in
Football Matches," no. April, 2020.
[4] M. N. A. Shapiee, M. A. R. Ibrahim, M. A. M. Razman, M. A. Abdullah, R. M. Musa, and A. P. P. A. Majeed,
"The Classification of Skateboarding Tricks by Means of the Integration of Transfer Learning and Machine
Learning Models," Lect. Notes Electr. Eng., vol. 678, pp. 219–226, 2020.
[5] D. Whiteside, O. Cant, M. Connolly, and M. Reid, "Monitoring hitting load in tennis using inertial sensors and
machine learning," Int. J. Sports Physiol. Perform., vol. 12, no. 9, pp. 1212–1217, Oct. 2017.
[6] B. Hollaus, S. Stabinger, A. Mehrle, and C. Raschner, "Using wearable sensors and a convolutional neural
network for catch detection in American football," Sensors (Switzerland), vol. 20, no. 23, pp. 1–16, 2020.
[7] Y. C. Huang, I. N. Liao, C. H. Chen, T. U. Ik, and W. C. Peng, "TrackNet: A deep learning network for tracking
high-speed and tiny objects in sports applications," arXiv, 2019.
[8] N. Ancona, G. Cicirelli, A. Branca, and A. Distante, "Goal detection in football by using support vector machines
for classification," Proc. Int. Jt. Conf. Neural Networks, vol. 1, pp. 611–616, 2001.
[9] R. Sagar, "What Is The Difference Between Computer Vision And Image Processing," Analytics India Magazine,
26-Dec-2018. [Online]. Available: https://analyticsindiamag.com/what-is-the-difference-between-computer-
vision-and-image-processing/.