<!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>Tracking of Spermatozoa by YOLOv5 Detection and StrongSORT with OSNet Tracker</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Martin Kosela</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jakub Aszyk</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mateusz Jarek</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jakub Klimek</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tomasz Prokop</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Poznan University of Technology</institution>
          ,
          <country country="PL">Poland</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Warsaw</institution>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper describes the solution to Medical Multimedia Task: Transparent Tracking of Spermatozoa using YOLOv5 object detection and StrongSORT with OSNet tracking algorithms. Using these techniques and carefully adjusted parameters and custom methods for motility analysis we achieve the tracking accuracy of   = 0.283 for normal sperm detection task. Furthermore, we propose a novel method for determining the sperm motility by comparing average cell velocity at diferent sampling rates.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        Object detection is a well-studied computer vision task with numerous good solutions using
deep neural networks. We decided to use the state of the art approach YOLO, first described
by Redmon et al. in 2015[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], which ofers high accuracy while preserving fast inference time.
Among many existing solutions to the object tracking problems [
        <xref ref-type="bibr" rid="ref3 ref4 ref5 ref6 ref7">3, 4, 5, 6, 7</xref>
        ], we decided to use
StrongSORT, first described by Du et al. in 2022 [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] with OSNet by Zhou et al. from 2019 [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
Previous studies of sperm analysis [
        <xref ref-type="bibr" rid="ref10 ref8 ref9">8, 9, 10</xref>
        ] show great potential of machine learning approach
to the problem, however they are all based only on raw, unlabeled video frames and do not
leverage the information of bounding boxes manually annotated by human raters.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Approach</title>
      <p>
        For stages 1 and 2 (object detection and object tracking) we used the publicly available
implementation of YOLOv5 + StrongSORT and OSNet [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. We found that adjusting the training
parameters and the train-validation split of the dataset are critical for the final results of the
model.
      </p>
      <sec id="sec-3-1">
        <title>3.1. Train-validation split of the dataset</title>
        <p>The task organizers provided a sample code for object detection using YOLOv5 on the task
dataset. In the solution, the full dataset was split by taking 16 full videos as a training set and
the reminding 4 videos as a validation set. We found that in this setup the network learns well
the training set, while for the validation the precision stays at the level of 0.5 ∼ 14%,
0.5:0.95 ∼ 4%. This means that the diferences between the videos from the training set
and the validation set are large and the network does not generalize well beyond the training
set.</p>
        <p>The other split we tried was to take every 5th frame (frame 0, 5, 10, 15, ...) as a validation set
while keeping the rest as a training set. In this setup the network quickly overfits and reaches
the precision of 0.5 ∼ 99.5%, 0.5:0.95 ∼ 90% on the validation set. This means that
the validation set is too similar to the training set and we are not able to verify how much
the network generalizes beyond the training set and hence we cannot optimize the training
parameters.</p>
        <p>Finally, we decided to construct the training set from the first 24 s of each video and the
validation set from the last 6 s of each video. In this setup the network achieved the accuracy of
0.5 ∼ 91%, 0.5:0.95 ∼ 66% on the validation set. In this approach we are sure that
the network has a chance to learn on each of the diferent videos and at the same time the
validation set is independent enough that we can adjust the training parameters and analyze
their impact on the precision on the validation set.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Confidence threshold for object detection</title>
        <p>We noticed that for the default confidence threshold ( conf_thres) equal to 0.25 for object
detection with YOLOv5, the trained model detects more sperm per frame that it should, according
to a manual assessment — it returns on average 78 sperm per frame in the test set, while there
is only 22 sperm per frame in the labeled training set. We have manually estimated the actual
number of sperm in the test videos and compered it to the average number of sperm returned by
the model for a few diferent thresholds and found out the most accurate number of sperm per
frame are returned for threshold of 0.75. The average number of sperm detected for diferent
thresholds are presented in table 1.</p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Computing the motility of sperm</title>
        <p>To compute the motility of sperm, we use a novel approach of comparing the average (vector)
velocities of cells for two diferent sampling intervals:  and ℎ. The approach is based
on the observation, that progressive sperm have high velocity, independent of sampling interval,
while non progressive sperm have high velocity when sampling on short interval but low
velocity when sampling on longer intervals. We determine the motility of a sperm by comparing
its two average velocities , ℎ and comparing them with two threshold velocities: 
and . The exact formula is as follows:
⎧
⎪
 = ⎨
⎪⎩
 if ℎ &gt;  ∧  ≤ ,
if ℎ ≤ ,
if ℎ &gt;  ∧  &gt; .</p>
        <p>We found that the most accurate results are obtained for ℎ = 5/50 s,  = 20/50 s,
 = 0.003 and  = 0.01 where  is the maximum sperm velocity,
measured at the 1/50 s sampling intervals.</p>
      </sec>
      <sec id="sec-3-4">
        <title>3.4. Finding the fastest sperm</title>
        <p>We achieved the best accuracy in determining the fastest sperm by comparing the average
velocity computed at 4 s sampling intervals. Moreover, to filter out the outliers coming from
wrongly tracked sperms (the same sperm id jumping between two diferent sperm cells), we
skip the cells with standard deviation of the average velocity higher than 0.05.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Results and Analysis</title>
      <p>
        For sub-task 1, the performance of the model was evaluated using the HOTA metric [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
This metric combines two components: Localization Accuracy and Association Accuracy and
therefore can serve a single number to quantify the performance of both, detection and tracking
parts of the workflow. The detailed HOTA numbers for detecting normal sperm are presented
in table 2.
      </p>
      <p>seq
66
68
73
76
80
combined
 
23.8%
24.6%
29.0%
37.6%
28.6%
28.3%</p>
      <p>Sub-task 2 was evaluated by measuring diferent statistical errors between the predicted
and ground-truth distribution of progressive/non-progressive/immotile sperm. The results are
presented in table 3.</p>
      <p>variable
progressive %
non progressive %
immotile %
average %</p>
      <p>mean
absolute error
15.6
8.6
22.2
15.5</p>
      <p>mean
squared error
295
84
551
310</p>
      <p>root mean
squared error
17.2
9.2
23.5
16.6
root squared
log error
1.36
0.26
0.24
0.62</p>
      <p>median
absolute error
17
10
23
17</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>V.</given-names>
            <surname>Thambawita</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Hicks</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. M.</given-names>
            <surname>Storås</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Andersen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Witczak</surname>
          </string-name>
          , T. B.
          <string-name>
            <surname>Haugen</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          <string-name>
            <surname>Hammer</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          <string-name>
            <surname>Nguyen</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Halvorsen</surname>
            ,
            <given-names>M. A.</given-names>
          </string-name>
          <string-name>
            <surname>Riegler</surname>
          </string-name>
          , Medico Multimedia Task at MediaEval 2022:
          <article-title>Transparent Tracking of Spermatozoa</article-title>
          ,
          <source>in: Proceedings of MediaEval 2022 CEUR Workshop</source>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>J.</given-names>
            <surname>Redmon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. K.</given-names>
            <surname>Divvala</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. B.</given-names>
            <surname>Girshick</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Farhadi</surname>
          </string-name>
          ,
          <article-title>You only look once: Unified, real-time object detection</article-title>
          ,
          <source>CoRR abs/1506</source>
          .02640 (
          <year>2015</year>
          ). URL: http://arxiv.org/abs/1506.02640. arXiv:
          <volume>1506</volume>
          .
          <fpage>02640</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>N.</given-names>
            <surname>Wojke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bewley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Paulus</surname>
          </string-name>
          ,
          <article-title>Simple online and realtime tracking with a deep association metric</article-title>
          ,
          <source>CoRR abs/1703</source>
          .07402 (
          <year>2017</year>
          ). URL: http://arxiv.org/abs/1703.07402. arXiv:
          <volume>1703</volume>
          .
          <fpage>07402</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Du</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Song</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhao</surname>
          </string-name>
          , Strongsort: Make deepsort great again,
          <year>2022</year>
          . URL: https://arxiv. org/abs/2202.13514. doi:
          <volume>10</volume>
          .48550/ARXIV.2202.13514.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>K.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Cavallaro</surname>
          </string-name>
          , T. Xiang,
          <article-title>Omni-scale feature learning for person re-identification</article-title>
          , CoRR abs/
          <year>1905</year>
          .00953 (
          <year>2019</year>
          ). URL: http://arxiv.org/abs/
          <year>1905</year>
          .00953. arXiv:
          <year>1905</year>
          .00953.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>J.</given-names>
            <surname>Cao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Weng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Khirodkar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Pang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Kitani</surname>
          </string-name>
          ,
          <article-title>Observation-centric sort: Rethinking sort for robust multi-object tracking</article-title>
          ,
          <year>2022</year>
          . URL: https://arxiv.org/abs/2203.14360. doi:
          <volume>10</volume>
          .48550/ARXIV. 2203.14360.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , P. Sun,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Jiang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Yu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Yuan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Luo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Bytetrack: Multi-object tracking by associating every detection box</article-title>
          ,
          <source>CoRR abs/2110</source>
          .06864 (
          <year>2021</year>
          ). URL: https://arxiv.org/abs/2110. 06864. arXiv:
          <volume>2110</volume>
          .
          <fpage>06864</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Hicks</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Andersen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Witczak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Thambawita</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Hammer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Haugen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Riegler</surname>
          </string-name>
          ,
          <article-title>Machine learning-based analysis of sperm videos and participant data for male fertility prediction</article-title>
          ,
          <source>Scientific Reports</source>
          (
          <year>2019</year>
          ). doi:
          <volume>10</volume>
          .1038/s41598-019-53217-y.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>V.</given-names>
            <surname>Thambawita</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Halvorsen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Hammer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Riegler</surname>
          </string-name>
          , T. B.
          <string-name>
            <surname>Haugen</surname>
          </string-name>
          ,
          <article-title>Extracting temporal features into a spatial domain using autoencoders for sperm video analysis</article-title>
          ,
          <source>CoRR abs/1911</source>
          .03100 (
          <year>2019</year>
          ). URL: http://arxiv.org/abs/
          <year>1911</year>
          .03100. arXiv:
          <year>1911</year>
          .03100.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>V.</given-names>
            <surname>Thambawita</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Halvorsen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Hammer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Riegler</surname>
          </string-name>
          , T. B.
          <string-name>
            <surname>Haugen</surname>
          </string-name>
          ,
          <article-title>Stacked dense optical flows and dropout layers to predict sperm motility and morphology, 2019</article-title>
          . URL: https://arxiv.org/abs/
          <year>1911</year>
          .03086. doi:
          <volume>10</volume>
          .48550/ARXIV.
          <year>1911</year>
          .
          <volume>03086</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>M.</given-names>
            <surname>Broström</surname>
          </string-name>
          ,
          <article-title>Real-time multi-camera multi-object tracker using yolov5 and strongsort with osnet</article-title>
          , https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>J.</given-names>
            <surname>Luiten</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Osep</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Dendorfer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Torr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Geiger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Leal-Taixé</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Leibe</surname>
          </string-name>
          ,
          <article-title>Hota: A higher order metric for evaluating multi-object tracking</article-title>
          ,
          <source>International Journal of Computer Vision</source>
          (
          <year>2020</year>
          )
          <fpage>1</fpage>
          -
          <lpage>31</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>