<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>YOLOv5 for Stroke Detection and Classification in Table Tennis</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Bhuvana J</string-name>
          <email>bhuvanaj@ssn.edu.in</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>T.T. Mirnalinee</string-name>
          <email>mirnalineett@ssn.edu.in</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>B. Bharathi</string-name>
          <email>bharathib@ssn.edu.in</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jayasooryan S</string-name>
          <email>jayasooryan19042@cse.ssn.edu.in</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Lokesh N N</string-name>
          <email>lokesh19055@cse.ssn.edu.in</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Sri Sivasubramaniya Nadar College of Engineering</institution>
          ,
          <addr-line>Tamil Nadu</addr-line>
          ,
          <country country="IN">India</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <fpage>13</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>Sports action detection and classification is one of the most researched topics in video analytics. It is very useful in order to make ifne tuned athletic training and get a better analysis of the athlete's performance. We present a model to detect and classify table tennis strokes made by players as a part of the MediaEval 2021 benchmark. Our approach extracts features using a YOLOv5 model trained on the MediaEval Fine Grained Action Detection and Classification of Table Tennis Strokes dataset provided to us, to detect and classify the moves/actions made.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        Action recognition is the task where predefined set of actions will
be associated with the video. An automatic analysis of actions in
the videos is the need of the day. In this paper we have proposed
a method to detect and classify strokes in a dataset consisting of
various strokes in table tennis performed during a match or during
practice. Localization of the objects and identifying them followed
the classification is the sequence of tasks involved in the action
recognition. Strategic decisions can be taken once the actions are
detected and classified. The dataset consists of 20 diferent classes [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
of strokes which the detection and classification is based upon, and
these moves are shot in natural conditions. Application of machine
learning in this specific domain can improve athletic performance
by computer-aided analysis of moves. We implemented a YOLOv5
model which is based on CNNs for this problem and discussed our
results with the given dataset.
      </p>
    </sec>
    <sec id="sec-2">
      <title>RELATED WORK</title>
      <p>
        Sports action classification is a topic in which there has been a lot
of research been carried out which tend to focus on recognising
a large number of actions using spatio-temporal models, using
videos. Feature extraction, dictionary learning , and classification
[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] are the steps involved in Action localization and recognition
of sports videos. Sliding window approach is used to choose the
maximum score of the classifier in the spatio-temporal volume.
Siamese Spatio-Temporal Convolutional Neural Network (SSTCNN)
has been used to detect the table tennis strokes [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. It uses the
RGB video frames and Optical Flow normalization to enhance their
performance. Similar action recognition research has been found
in literature [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] using 3D ConvNets and extracting HOG of
the Temporal Diference Map (TDMap) respectively. Long-term
Recurrent Convolutional Network (LRCN) has been used to classify
the table tennis strokes [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] that extracts the features using VGG16,
a pretrained model. Our approach does not use optical flow data to
detect the moves and instead directly uses the frame sequences.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>APPROACH</title>
      <p>
        The dataset had many videos which consisted of actions and moves
made by players which had very subtle diferences amongst them.
So we took into account temporal information in the frames in
an efective manner. Since the actions had very subtle diferences
with the low inter-class variability, it was a dificult task to handle.
CNN models found to be optimal to classify if the data is highly
spatial with proper discrimination among the classes. We decided
to study this with object detection and recognition deep learning
framework, YOLOv5 architecture [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
3.1
      </p>
    </sec>
    <sec id="sec-4">
      <title>Data Pre-processing</title>
      <p>The YOLO model takes fixed input sizes for each mini batch. The
frames were downscaled to 512 × 512 in order to keep the size of the
ifles manageable. CVAT (Computer Vision Annotation Tool) was
used to annotate the actions of the players, by drawing bounding
boxes over the body, focused on the hand holding the bat, in the
videos as per the given frame number in the dataset. The strokes
annotated are of varying duration with some being very short while
others more lengthy. This meant we had to ensure the extracted
frames had information on the entire move in it, irrespective of the
duration. Since there were two diferent annotation data sets i.e
training and classification, we observed that the detection frame
sequences were overlapping with the classification ones, we
annotated only using the detection data set using the stroke-classes
when present, or marked it as just "stroke" if no class was present.
We then split the annotated files in the required two file types. This
saved us a lot of work, as we did not have to annotate the same
video twice or draw two bounding boxes.
3.2</p>
    </sec>
    <sec id="sec-5">
      <title>Proposed Model</title>
      <p>Our approach uses the complete RGB frame sequence of the whole
video that consisted of some subset. The YOLOv5 architecture is
a modified version of the YOLOV4 implemented by Ultralytics.
YOLOv5 has three functional components namely the Backbone,
CSPDarknet, its Neck, PANet and the Head, Yolo Layer. CSPDarknet
helps to extract the features from the frames of the table tennis
videos. Feature pyramids are constructed using the PANet stage
that helps in generalizing with diferent sized objects. By applying
the bounding boxes on the features the head layer performs the
object detection task.</p>
      <p>The YOLOv5 model has been trained for 15 epochs in order to
detect the strokes, classify them and find their respective bounding</p>
      <p>(a) Detected as stroke
(b) Detected as ofensive forehand flip
boxes from the frames. The model is trained to detect 20 diferent
classes of strokes. It has obtained a training and validation loss of
about 0.0039% and 0.0021% with loss function mentioned in Table 1.
Hyper-parameters adopted by our approach is listed in Table 1. As
we considered the whole action sequence during detection,
overiftting was a major problem as even a still position of the player
was fed to the model with a positive label which caused over-fitting
of the model. This could have been prevented by taking only the
frame sequences where a move was performed. In the classification
part, this model seemed to perform better than the detection part
as the classes were in lesser amount in the dataset compared to the
detection part.
4</p>
    </sec>
    <sec id="sec-6">
      <title>RESULTS</title>
      <p>The model was able to classify 13 out of the 20 classes as we could
not annotate the videos which had the other 7 classes. We achieved
an accuracy of 9.95% on the 13 classes where some of the classes
were predicted with a good accuracy and some of them had poor
accuracy. It has been observed with respect to per class accuracy
that the model learnt some of the moves well than the others. A
sample images after detection are shown in Figure 1a and 1b.</p>
      <p>
        But a very poor performance in the test set of the detection
(mAP=0.000525 G-IoU=0.247) showing that using YOLOv5 with
current training was not a probable model for this dataset. The
GIoU is better than mAP shows that the detection is moving towards
the ground truth, that if we have trained the network with diferent
hyper-parameters for more epochs the detection would have been
better. The baseline results for this dataset can be seen in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
Hyperparameters adopted by our approach is listed in Table 1. The model
was not able to completely detect the moves such as serve backhand
topspin, serve backhand backspin, forehand loop and forehand side
spin leading to very poor test accuracy. The model did not perform
well on the detection part as the frame sequences not only moves
but other actions as well such as standing still, walking, etc. This
resulted in incorrect detection of stroke from the frame sequences.
A closer analysis shows that the model fails to distinguish between
the moves belonging to a specific class (such as Serve, Defensive,
Ofensive) as the diferences are very intricate. The model tended
to prefer certain moves significantly more than others on the test
set, which arose due to the distribution of the training set. Using
uniform amounts of data to work with resulted in the number of
examples to train on being very low. The diference in accuracy
on test and validation data might be due to the frequency of the
diferent classes on the test set being diferent from the training
and validation set.
      </p>
    </sec>
    <sec id="sec-7">
      <title>DISCUSSION AND OUTLOOK</title>
      <p>As we processed the data where each move/action was considered
for a very large frame sequence, it resulted in over-fitting. Thus
over-fitting could have been avoided if the moves/actions were
precisely annotated in the video dataset and considered correctly
when fed into the model. We learnt that data of this kind needs to
have precise annotations after pre-processing which could result in
better results. Thus our model could not show comparable accuracy
when compared with the baseline model which was provided for
reference. The performance could have been enhanced further by
annotating all the videos and by training for more number of epochs.
Conv3d with diferent hyper-parameters other than the baseline
model can be attempted to study the performance.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Omar</given-names>
            <surname>Elharrouss</surname>
          </string-name>
          , Noor Almaadeed, Somaya Al-Maadeed,
          <string-name>
            <given-names>Ahmed</given-names>
            <surname>Bouridane</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Azeddine</given-names>
            <surname>Beghdadi</surname>
          </string-name>
          .
          <year>2021</year>
          .
          <article-title>A combined multiple action recognition and summarization for surveillance video sequences</article-title>
          .
          <source>Applied Intelligence</source>
          <volume>51</volume>
          ,
          <issue>2</issue>
          (
          <year>2021</year>
          ),
          <fpage>690</fpage>
          -
          <lpage>712</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Glenn</given-names>
            <surname>Jocher</surname>
          </string-name>
          .
          <year>2020</year>
          . YOLOV5. https://github.com/ultralytics/yolov5. (
          <year>2020</year>
          ).
          <source>Online; accessed 29 October</source>
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Shuiwang</given-names>
            <surname>Ji</surname>
          </string-name>
          , Wei Xu,
          <string-name>
            <given-names>Ming</given-names>
            <surname>Yang</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Kai</given-names>
            <surname>Yu</surname>
          </string-name>
          .
          <year>2012</year>
          .
          <article-title>3D convolutional neural networks for human action recognition</article-title>
          .
          <source>IEEE transactions on pattern analysis and machine intelligence 35</source>
          ,
          <issue>1</issue>
          (
          <year>2012</year>
          ),
          <fpage>221</fpage>
          -
          <lpage>231</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Pierre-Etienne Martin</surname>
          </string-name>
          .
          <year>2021</year>
          .
          <article-title>Spatio-Temporal CNN baseline method for the Sports Video Task of MediaEval 2021 benchmark</article-title>
          . In
          <source>MediaEval (CEUR Workshop Proceedings)</source>
          .
          <source>CEUR-WS.org.</source>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Pierre-Etienne</surname>
            <given-names>Martin</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jordan Calandre</surname>
          </string-name>
          , Boris Mansencal, Jenny Benois-Pineau, Renaud Péteri, Laurent Mascarilla, and
          <string-name>
            <given-names>Julien</given-names>
            <surname>Morlier</surname>
          </string-name>
          .
          <year>2021</year>
          .
          <article-title>Sports Video: Fine-Grained Action Detection and Classification of Table Tennis Strokes from videos for MediaEval 2021</article-title>
          . In MediaEval (CEUR Workshop Proceedings).
          <source>CEUR-WS.org.</source>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Pierre-Etienne</surname>
            <given-names>Martin</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jenny</surname>
            Benois-Pineau,
            <given-names>Renaud</given-names>
          </string-name>
          <string-name>
            <surname>Péteri</surname>
            , and
            <given-names>Julien</given-names>
          </string-name>
          <string-name>
            <surname>Morlier</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>Fine grained sport action recognition with twin spatiotemporal convolutional neural networks</article-title>
          .
          <source>Multimedia Tools and Applications</source>
          <volume>79</volume>
          ,
          <issue>27</issue>
          (
          <year>2020</year>
          ),
          <fpage>20429</fpage>
          -
          <lpage>20447</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Khurram</given-names>
            <surname>Soomro and Amir R Zamir</surname>
          </string-name>
          .
          <year>2014</year>
          .
          <article-title>Action recognition in realistic sports videos</article-title>
          . In Computer vision in sports. Springer,
          <fpage>181</fpage>
          -
          <lpage>208</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Siddharth</given-names>
            <surname>Sriraman</surname>
          </string-name>
          , Srinath Srinivasan, Vishnu K Krishnan,
          <string-name>
            <given-names>J</given-names>
            <surname>Bhuvana</surname>
          </string-name>
          ,
          <source>and TT Mirnalinee</source>
          .
          <year>2019</year>
          .
          <article-title>MediaEval 2019: LRCNs for Stroke Detection in Table Tennis.</article-title>
          .
          <source>In MediaEval.</source>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>