<!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>Impact of Pretrained Networks For Snake Species Classi cation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Moorthy Gokula Krishnan ID</string-name>
          <email>gokul@eloop</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Eloop Mobility Solutions</institution>
          ,
          <country country="IN">India</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>A robust snake species classi er could aid in the treatment of snake bites. In this report, the technique of transfer learning is revisited to understand the signi cance of the underlying pre-trained network and the supervised datasets used for pre-training. In low data regime, the methodology of transfer learning has been instrumental in building reliable image classi ers. Comparisons are made between the pre-trained networks trained on datasets of di erent sizes and classes. Performance improves signi cantly when the pre-trained network is trained on a much larger supervised dataset. Using country metadata improves the performance considerably. In SnakeCLEF2020 challenge, an F1-score of 0.625 was achieved.</p>
      </abstract>
      <kwd-group>
        <kwd>Snake Species Classi cation</kwd>
        <kwd>Computer Vision</kwd>
        <kwd>Transfer Learning</kwd>
        <kwd>Convolutional Neural Networks</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Snakebite is the second most deadly neglected tropical disease [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], being
responsible for a dramatic humanitarian crisis in global health. Snakebite envenoming
(SBE) a ects as many as 2.7 million people every year[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], most of whom live
in some of the world's remote, poorly developed, and politically marginalized
tropical communities. With annual mortality of 81,000 to 138,000 and 400,000
surviving victims with permanent physical and psychological disabilities, SBE
is a disease in urgent need of attention. Antivenoms can be life-saving when
correctly administered but this often depends on the correct taxonomic
identi cation (i.e. family, genus, and species) of the biting snake. But, snakes are
never identi ed in nearly 50% of cases globally[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. An automated system that
suggests an identi cation to the healthcare provider from a low-quality photo
can speed up the process of treatment. The participants of SnakeCLEF2020 [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]
were challenged to build an accurate snake species classi er that works under
diverse conditions.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Dataset</title>
      <p>
        With the goal of developing biodiversity monitoring systems, LifeCLEF [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
evaluation campaign aims at benchmarking the progress every year in the
identi cation of plants and animals. SnakeCLEF challenge was introduced in 2020
to benchmark the progress in building a snake species classi er. In this
challenge, 245,185 training images are provided split into 783 species. As shown in
Figure 1, several aspects of snake morphology make this task challenging for
computer vision. Evaluation is done using F1-score which ensures the need for
better precision and recall over all the species. The trained model is used to infer
labels on the test images that are hidden to participants on platform AICrowd 1
directly. The dataset is extremely imbalanced as indicated in Figure 2 with the
minimum number of images per class being 17 and the highest class containing
12,201 images. Additional geographical metadata (country and continent) for
the image is also provided. All ablation studies were done locally with the given
validation set comprising of 14,029 images.
With the renaissance of deep learning for building image classi ers since 2012 [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ],
deep convolutional neural networks have become the standard for developing
state of the art of image classi ers that work well under diverse conditions given
that a large supervised dataset is available. In certain domain-speci c cases, the
availability of such large scale dataset comprising of millions of images might
not be possible. The images might not be readily available, geographically
constrained, or rare. In such cases, the technique of transfer learning is used. In this
methodology, the network is trained on a di erent data distribution containing
1
https://www:aicrowd:com/challenges/snake-species-identificationchallenge
millions of images and later ne-tuned to domain-speci c tasks such as snake
species. The dataset used in The ImageNet Large Scale Visual Recognition
Challenge (ILSVRC) [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] which comprises of 1.4 million images categorized into 1000
classes (ImageNet-1k) is often used to benchmark the performance of image
classi ers and the availability of pre-trained models motivates the computer vision
community to use the learned representations from the ImageNet-1k dataset.
However, ImageNet-1k is a small subset of a much larger dataset containing 14.2
million images categorized into 21,841 classes (ImageNet-21k).
      </p>
      <p>
        Recently, an extensive study has been performed [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] to understand the impact
of these learned representations on the downstream task ( ne-tuning to
domainspeci c image classi er). Corollary to popular belief, larger models trained on
larger datasets do not always perform better on the downstream task. The size
of the domain-speci c dataset plays a crucial role in determining the training
strategy and the size of the model. In the context of the SnakeCLEF2020
challenge, experiments were carried out to understand the di erences between the
models trained on both these datasets (ImageNet-1k and ImageNet-21k).
4
      </p>
    </sec>
    <sec id="sec-3">
      <title>Implementation Details</title>
      <p>4.1</p>
      <sec id="sec-3-1">
        <title>Pretrained Classi ers</title>
        <p>
          Vanilla ResNet50-v2 [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] classi er is used for experimentation. Open-source
models that were trained on both ImageNet-1k and ImageNet-21k were used. Both
of the pre-trained classi ers were trained under the same conditions. Speci cally,
this involved keeping the hyperparameters, image resolution, and augmentations
constant. The fully connected (FC) layer di ers depending on the labels speci c
to the dataset. While ne-tuning, the FC layer is replaced with a domain-speci c
FC layer randomly initialized.
        </p>
        <p>The following strategies were adopted during training:
{ Trained for 10,000 steps.
{ The batch size of each step was 512.
{ Mixup augmentation was used.
{ Staircase based Learning rate scheduler.
{ Optimizer: Schocastic gradient descent with momentum 0.9.</p>
        <p>{ Cross Entropy Loss.
4.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Training Techniques</title>
        <p>Preprocessing The given images are of varied sizes. During the training process,
the images are rst resized to 512x512x3 dimensions using bilinear interpolation
method and a random crop of 456x456x3 was taken. The images were also
horizontally ipped with a probability of 0.5. During the validation and the testing
process, the images were only resized to 456x456x3 dimensions using bilinear
interpolation. The images were also normalized with a standard deviation and
mean of 0.5 and 0.5 respectively for training, validation, and testing process.
Batch Accumulation Training can be very ine cient if the mini-batch size is
small due to noisy gradients. To accommodate large mini-batch size into GPU
memory, batch accumulation is generally used. Gradients are accumulated over
16 steps without updating the model and then updated. Although the size of
each mini-batch is 32, the e ective mini-batch size is 512.</p>
        <p>
          Learning Rate Learning rate is the crucial hyperparameter to the task of
netuning. After linear warmup, a stair-case based learning rate scheduler was used
following the hyperrule provided by [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. Base learning rate (lrb) of 0.03 was used.
{ Step 0-500: Linear warmup : lrb 50i0 where i = 0; 1; 2:::; 500
{ Step 500-10000: lrb decayed by a factor of 10 at 3000,6000 and 9000 steps
Normalization Group normalization [14] technique along with weight
standardization [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] was used. The accuracy of Group normalization is stable across a
wide range of batch sizes. It is worth noting that other common techniques like
weight decay and dropout were not used.
        </p>
        <p>Augmentation Deep neural networks are prone to undesirable behaviors such as
memorization, sensitivity to adversarial examples, and sampling bias. To combat
the issues of over tting, mixup augmentation [15] was used. Mixup strategy
trains the network on convex combinations of pairs of examples and their labels.
The combination can be controlled by a factor, . With = 0:1 , a sample
training image is shown in Figure 3. This favours the network to discriminate
between various classes better.</p>
        <p>Fine-tuning is done on two open source models of ResNet50-v2 architecture
pre-trained on ImageNet-1k (Model-A) and ImageNet-21k (Model-B) datasets
respectively under same training conditions. Results are summarized below:
The network pre-trained on ImageNet-21k signi cantly outperforms its
ImageNet-1k counterpart. Especially, classes with fewer data points are discriminated
better re ected by the signi cant improvement in the F1-score.</p>
        <p>Model-A disagrees with Model-B for 1,989 images, where Model-B is correct.
Also, Model-B disagrees with Model-A for 433 images, where Model-A is correct.
By analyzing images with the highest discrepancies (i.e) the images for which
Model-B is correct and the probability of the correct species inferred from
ModelA is very small, further insights could be gained. An attribution technique [13]
to understand which pixels(features) are considered important by the model was
performed. The generated saliency maps for top 3 images where models disagree
the maximum was chosen. A single gradient step with respect to the target
class for the given image was calculated. As shown in Figure 4, by ranking the
pixels with respect to the gradients, the saliency maps generated from
ModelB tend to be much more concentrated in the area of interest indicating better
generalization.
Several snake species are constrained by their geographical location. Metadata
about where the image was taken was given in the form of Country and
Continent. The distribution of images per country follows a long tail distribution and
is concentrated mostly in the United States Of America (61.42%). Images were
taken from 187 countries. In the absence of such information, \UNKNOWN" is
marked. The probability of a species given a country is precomputed from the
training dataset distribution as follows:
p(s j c) = tsc=tc
(1)
p(s j c) = probability of a species, given a country.
tsc = total number of images belonging to the species, s found in the
country, c.
tc = total number of images found in the country, c.</p>
        <p>The generated, p(s j c), is provided at 1 along with the source code used
for training. It is worth noting that the images marked with "UNKNOWN"
data is considered as a country for the purposes of pre-computation. The nal
probabilities are then adjusted as follows:
ps = p s p(s j c)
(2)
ps = probability of the species, given the image and country.
p s = probability of the species inferred from the model.</p>
        <p>The probabilites are normalized to ensure a sum of 1. Using this technique on
Model-B, the scores improved from 0.5813 to 0.6019.</p>
        <p>The test dataset on which the nal scores were calculated, follows a data
distribution similar to validation dataset and the model achieves an F1-score of 0.625
when tested on AICrowd platform.
7</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Conclusion and Future Work</title>
      <p>
        Although the models were trained with the same hyper-parameters, Model-B
performs better than Model-A. These results signify the importance of having
generalized visual representations before ne-tuning is done on a domain-speci c
dataset. Label smoothing[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] could improve the performance and can handle the
noisy images found in the dataset. Bigger models and stronger augmentations
such as rotation and jittering could make the model more resilient.
8
      </p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgements</title>
      <p>The compute resources required to perform the experiments was provided by
hostkey.com 2
1 https://github:com/GokulEpiphany/snakes-round-4-train/tree/master/
metadata
2 https://www:hostkey:com/
13. Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside
convolutional networks: Visualising image classi cation models and saliency maps, 2013.
arXiv:1312:6034.
14. Yuxin Wu and Kaiming He. Group normalization, 2018. arXiv:1803:08494.
15. Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup:
Beyond empirical risk minimization, 2017. arXiv:1710:09412.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <article-title>First medical decision support tool for snake identi cation based on arti cial intelligence and remote collaborative expertise</article-title>
          . URL: https: //www:unige:ch/medecine/isg/en/research/one-health/
          <article-title>snapp-firstmedical-decisionsupport-tool-for-snake-identification-based-onartificial-intelligence-and-remote-collaborative-expe/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <article-title>Image shared on the challenge page</article-title>
          . URL: https:// crowdai-shared:
          <article-title>s3:eu-central-1:amazonaws:com/markdown editor/ f4e927cb3680ceb410ff825a8c0a53c4 picture2 challenge datasets:png.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>3. Snakebite envenoming. URL: https://www:who:int/news-room/fact-sheets/ detail/snakebite-envenoming.</mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Isabelle</given-names>
            <surname>Bolon</surname>
          </string-name>
          ,
          <string-name>
            <surname>Andrew M. Durso</surname>
          </string-name>
          , Sara Botero Mesa, Nicolas Ray, Gabriel Alcoba, Francois Chappuis, and Rafael Ruiz de Castan~
          <article-title>eda. Identifying the snake: First scoping review on practices of communities and healthcare providers confronted with snakebite across the world</article-title>
          .
          <source>PLOS ONE</source>
          ,
          <volume>15</volume>
          :1{
          <fpage>24</fpage>
          ,
          <fpage>03</fpage>
          <lpage>2020</lpage>
          . URL: https: //doi:org/10:1371/journal:pone:
          <fpage>0229989</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Kaiming</surname>
            <given-names>He</given-names>
          </string-name>
          , Xiangyu Zhang, Shaoqing Ren, and
          <string-name>
            <given-names>Jian</given-names>
            <surname>Sun</surname>
          </string-name>
          .
          <article-title>Identity mappings in deep residual networks</article-title>
          .
          <source>In Bastian Leibe</source>
          , Jiri Matas, Nicu Sebe, and Max Welling, editors,
          <source>Computer Vision { ECCV</source>
          <year>2016</year>
          , pages
          <fpage>630</fpage>
          {
          <fpage>645</fpage>
          ,
          <string-name>
            <surname>Cham</surname>
          </string-name>
          ,
          <year>2016</year>
          . Springer International Publishing.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Alexis</given-names>
            <surname>Joly</surname>
          </string-name>
          , Herve Goeau, Stefan Kahl, Benjamin Deneu, Maximilien Servajean, Elijah Cole, Lukas Picek, Rafael Ruiz De Castan~eda, Isabelle Bolon, Titouan Lorieul, Christophe Botella, Herve Glotin, Julien Champ,
          <string-name>
            <surname>Willem-Pier</surname>
            <given-names>Vellinga</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fabian-Robert Sto</surname>
          </string-name>
          ter, Andrew Dorso, Pierre Bonnet, Ivan Eggel, and
          <article-title>Henning Muller. Overview of lifeclef 2020: a system-oriented evaluation of automated species identi cation and species distribution prediction</article-title>
          .
          <source>In Proceedings of CLEF</source>
          <year>2020</year>
          ,
          <article-title>CLEF: Conference and Labs of the Evaluation Forum</article-title>
          , Sep.
          <year>2020</year>
          , Thessaloniki, Greece.,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Alexander</given-names>
            <surname>Kolesnikov</surname>
          </string-name>
          , Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and
          <string-name>
            <given-names>Neil</given-names>
            <surname>Houlsby</surname>
          </string-name>
          .
          <article-title>Big transfer (bit</article-title>
          ):
          <article-title>General visual representation learning</article-title>
          ,
          <year>2019</year>
          . arXiv:
          <year>1912</year>
          :
          <fpage>11370</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Alex</given-names>
            <surname>Krizhevsky</surname>
          </string-name>
          , Ilya Sutskever, and
          <string-name>
            <surname>Geo</surname>
            rey
            <given-names>E</given-names>
          </string-name>
          <string-name>
            <surname>Hinton</surname>
          </string-name>
          .
          <article-title>Imagenet classication with deep convolutional neural networks</article-title>
          . In F. Pereira,
          <string-name>
            <given-names>C. J. C.</given-names>
            <surname>Burges</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Bottou</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          K. Q. Weinberger, editors,
          <source>Advances in Neural Information Processing Systems</source>
          <volume>25</volume>
          , pages
          <fpage>1097</fpage>
          {
          <fpage>1105</fpage>
          . Curran Associates, Inc.,
          <year>2012</year>
          . URL: http://papers:nips:cc/paper/4824-imagenet
          <article-title>-classificationwith-deep-convolutional-neural-networks:pdf.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Rafael</given-names>
            <surname>Mu</surname>
          </string-name>
          <article-title>ller, Simon Kornblith, and Geo rey Hinton</article-title>
          .
          <source>When does label smoothing help?</source>
          ,
          <year>2019</year>
          . arXiv:
          <year>1906</year>
          :
          <fpage>02629</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Lukas</surname>
            <given-names>Picek</given-names>
          </string-name>
          , Rafael Ruiz De Castan~eda,
          <string-name>
            <surname>Andrew M. Durso</surname>
            , Isabelle Bolon, and
            <given-names>P. Mohanty</given-names>
          </string-name>
          <string-name>
            <surname>Sharada</surname>
          </string-name>
          .
          <article-title>Overview of the snakeclef 2020: Automatic snake species identi cation challenge</article-title>
          .
          <source>In CLEF task overview</source>
          <year>2020</year>
          ,
          <article-title>CLEF: Conference and Labs of the Evaluation Forum</article-title>
          , Sep.
          <year>2020</year>
          , Thessaloniki, Greece.,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Siyuan</surname>
            <given-names>Qiao</given-names>
          </string-name>
          , Huiyu Wang, Chenxi Liu, Wei Shen,
          <string-name>
            <given-names>and Alan</given-names>
            <surname>Yuille</surname>
          </string-name>
          . Weight standardization,
          <year>2019</year>
          . arXiv:
          <year>1903</year>
          :
          <fpage>10520</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Olga</surname>
            <given-names>Russakovsky</given-names>
          </string-name>
          , Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein,
          <string-name>
            <surname>Alexander C. Berg</surname>
          </string-name>
          , and
          <string-name>
            <surname>Li</surname>
          </string-name>
          Fei-Fei.
          <article-title>Imagenet large scale visual recognition challenge</article-title>
          ,
          <year>2014</year>
          . arXiv:
          <volume>1409</volume>
          :
          <fpage>0575</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>