<!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>MediaEval 2020 Emotion and Theme Recognition in Music Task: Loss Function Approaches for Multi-label Music Tagging</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Dillon Knox</institution>
          ,
          <addr-line>Timothy Greer, Benjamin Ma, Emily Kuo, Krishna Somandepalli</addr-line>
          ,
          <institution>Shrikanth Narayanan Signal Analysis and Interpretation Laboratory (SAIL) University of Southern California</institution>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2020</year>
      </pub-date>
      <fpage>14</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>We present USC SAIL's submission to the 2020 Emotions and Themes in Music challenge: an ensemble-based convolutional neural network (CNN) model trained using various loss functions. In this work, we investigate the efect of diferent loss functions and resampling strategies on prediction performance, finding that using focal loss improves overall performance on the provided imbalanced, multi-label dataset. Additionally, we report results from varying the receptive field on our base classifier-a CNN-based architecture trained using Mel spectrograms-which also results in better model performance. We conclude that the choice of the loss function is paramount for improving on existing methods in music tagging, particularly in the presence of class imbalance.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        Content-based automatic music tagging is a challenging task: a
robust system must accurately predict multi-label tags (such as
mood, theme, or genre) associated with a piece of music, regardless
of the frequency of such labels. Great strides in the field have been
enabled recently by the release of large high-quality music datasets,
like the MTG-Jamendo dataset [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. In MediaEval’s Emotions and
Themes in Music challenge, participants are tasked with building
models that maximize multi-label tag prediction performance on
the autotagging-moodtheme subset of this dataset [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>
        Models based on convolutional neural networks (CNNs) are an
efective choice for a wide variety of audio-based tasks, including
speech recognition [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], acoustic scene classification [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], and
musicrelated tasks, like the 2019 MediaEval Emotions and Themes in
Music challenge [
        <xref ref-type="bibr" rid="ref13 ref8">8, 13</xref>
        ]. Inspired by the success of CNNs in previous
music tagging applications, we utilize a VGGish-based short-chunk
CNN with residual connections, as implemented in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], extending
this work by experimenting with diferent loss functions designed
to address label imbalance.
      </p>
      <p>
        In sparse multi-label tasks, loss functions are susceptible to
being overwhelmed by the large number of negative labels [
        <xref ref-type="bibr" rid="ref4 ref7">4, 7</xref>
        ]. We
attempt to resolve this issue by using mixup [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], class-aware
sampling [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], and novel loss functions. In our experiments, changing
loss functions shows the greatest increase in performance, so we
focus our reporting on various loss function approaches in this
study.
      </p>
      <p>
        We test focal loss, originally developed for computer vision
models, as a way to train the model to emphasize improving predictions
on samples that have lower confidence [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. We also examine
classbalanced loss, which increases loss penalties for under-represented
classes [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Finally, we evaluate the recently-proposed
distributionbalanced loss, which attempts to overcome the confounding issues
of label co-occurrence and negative-class dominance by
rebalancing weights with respect to class co-occurrence and incorporating
negative-tolerant regularization [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. Using these diferent loss
functions, we improve on the performance achieved by last year’s
best model ensemble [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>DATA PREPARATION</title>
      <p>
        We use the provided subset of data from MTG-Jamendo and expand
the training set by using instances from the Music4All dataset [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]
that exactly match the challenge label set, resulting in an additional
5,666 instances. Additionally, we pretrain the low-level
convolutional layers of our models using the Million Song Dataset (MSD) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ],
in the manner presented by Won et al. [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ].
      </p>
      <p>For feature extraction, we first resample all audio to 16 kHz, and
then extract 128-bin Mel spectrograms using a 512-sample FFT,
with a window size of 32 ms and 50% window overlap.
3
3.1</p>
    </sec>
    <sec id="sec-3">
      <title>APPROACH</title>
    </sec>
    <sec id="sec-4">
      <title>Model Architecture</title>
      <p>
        We use a modified short-chunk CNN with residual connections for
our model, based on the architecture presented by Won et al. [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ],
with some modifications. We investigate increasing the receptive
ifeld of the CNN, given that our label set is generally composed of
high-level music descriptors, such as emotions and themes. The
original model has seven convolutional layers; we modify the kernel
size of the final two layers to increase the receptive field along the
temporal dimension from 3.69 seconds [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] to 4.6 seconds, which
results in a better overall performance.
3.2
      </p>
    </sec>
    <sec id="sec-5">
      <title>Loss Functions</title>
      <p>We explore three loss functions aimed at increasing average
classwise performance on an imbalanced dataset. Where applicable, we
modify the loss functions for multi-label classification.</p>
      <p>
        3.2.1 Focal Loss. We implement a multi-label version of focal
loss [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. The focal loss for a sample  is given as
  () = −
      </p>
      <p>(1 −  ) ( )
(1)

Õ</p>
      <sec id="sec-5-1">
        <title>Approach PR-AUC ROC-AUC</title>
        <p>BCE Loss 0.150 0.766
Focal Loss 0.156 0.778
CB Focal Loss 0.153 0.773
DB Focal Loss 0.153 0.768
Ensemble 0.161 0.781
VGG-ish-Baseline 0.107 0.725</p>
        <p>
          Popular-Baseline 0.031 0.500
Table 1: Test-set performance of our model trained
using various loss functions. BCE stands for "binary
crossentropy"; CB for "class-balanced"; DB for
"distributionbalanced."
where  and  are equal to  and  , respectively, if  is a label for
the sample . Conversely,  and  are equal to 1 −  and 1 −  if
 is not a label for . In our experiments, we use  = 0.25 and  = 2,
as recommended by [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ].
        </p>
        <p>Here,  suppresses the contribution to loss from the relatively
well-classified examples, focusing instead on harder-to-classify
examples. In the case of our dataset, where no single label is present
in a majority of instances, the negative classes may be easy for the
model to learn. Thus, we instead want to focus on the harder cases
where a given label is present.  provides an additional weight
term for positive and negative classes.</p>
        <p>
          3.2.2 Class-Balanced Loss. We also implement a class-balanced
version of focal loss [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]. Here, the focal loss weight  is replaced
by a ratio based on the number of samples containing a given label.
Concretely:
 () = −
Õ 1 −
        </p>
        <p>1 −  (1 −  ) ( )
=1
where  is the number of samples in the training set in which
label  appears and  is a hyperparameter. We set  to 0.995 for our
experiments.</p>
        <p>
          3.2.3 Distribution-Balanced Loss. Lastly, we use
distributionbalanced loss, which was first presented by Wu et al. [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]:
 () =
+
1 Õ
        </p>
        <p>(1 + −( − ) )
 =1
1
 (1 −  )(1 +  ( − ) )
Here,  is a scale factor for the negative logits, controlling for
the preponderance of negative labels, while  is a class-specific
rebalancing weight that tries to close the gap between the expected
number of samples and actual number of samples for a given class
after resampling. Wu et al. used a BCE variant of this equation, as
shown above; we implement a focal-loss-based function for our
study.
4
4.1</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>SUBMISSIONS AND RESULTS</title>
    </sec>
    <sec id="sec-7">
      <title>Submitted Models</title>
      <p>We submitted three models to the challenge: the short-chunk CNN
model described above using focal loss, an ensemble model which
combines multiple CNN-based models trained using the above four
(2)
(3)</p>
      <sec id="sec-7-1">
        <title>Approach Head Middle Tail</title>
        <p>BCE Loss 0.179 0.163 0.101
Focal Loss 0.174 0.171 0.113
CB Focal Loss 0.173 0.170 0.104
DB Focal Loss 0.173 0.170 0.105</p>
        <p>Ensemble 0.182 0.179 0.109
Table 2: Class-wise subset performance of various loss
functions in terms of PR-AUC.
diferent loss functions, and an identical ensemble model that is
trained without any outside data (Million Song Dataset or
Music4All).1
4.2</p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>Results</title>
      <p>We display the PR-AUC and ROC-AUC test-set performance of each
loss function approach against provided baselines in Table 1.</p>
      <p>We find that the model trained using focal loss produces the
best performance both in terms of PR-AUC and ROC-AUC. All
variants of focal loss outperform binary cross-entropy, and our final
ensemble of averaging the predictions from models trained using
the four diferent loss functions achieves the highest performance.</p>
      <p>Additionally, to further investigate the efects of using diferent
loss functions on class-wise performance, we split the label set into
head, middle, and tail classes, based on frequency in the training
set. Head classes contain over 550 samples, middle classes contain
between 200 and 550 samples, and tail classes contain at most 200
samples. The results in terms of PR-AUC are displayed in Table 2.</p>
      <p>Indeed, we find that the focal loss-based methods perform better
than BCE loss on the less-frequent classes (both middle and tail
subsets). In our experiments, this comes with a slight penalty in
performance on the head classes, but leads to overall better
performance, as well as a better-performing ensemble model.</p>
      <p>
        Lastly, we try class-aware sampling [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] for all models, but
observe a performance degradation in each. We further experiment
with mixup [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], which has been shown to lead to performance
increases on this task [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. We find that mixup does indeed increase
performance using binary cross-entropy, but shows lower
performance for focal loss and its variants.
5
      </p>
    </sec>
    <sec id="sec-9">
      <title>CONCLUSION</title>
      <p>We present an ensemble-based CNN model trained using focal loss
for this year’s submission to the 2020 Emotions and Themes in
Music challenge. We find that focal loss helps predict labels that do
not occur frequently in the dataset, and that emphasizing correct
predictions of these labels results in better model performance. We
posit that the choice of a loss function is an essential consideration
when developing a prediction model for multi-label classification,
particularly in music processing. Future work will determine if
our approach generalizes to other methods for automatic music
tagging.</p>
    </sec>
    <sec id="sec-10">
      <title>ACKNOWLEDGMENTS</title>
      <p>This study is done at the Center for Computational Media
Intelligence at University of Southern California’s Signal Analysis and
Interpretation Laboratory and supported by research awards from
Google and the U.S. Chamber of Commerce Foundation.
1Our code can be found at https://github.com/usc-sail/media-eval-2020</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Thierry</given-names>
            <surname>Bertin-Mahieux</surname>
          </string-name>
          , Daniel PW Ellis, Brian Whitman, and
          <string-name>
            <given-names>Paul</given-names>
            <surname>Lamere</surname>
          </string-name>
          .
          <year>2011</year>
          .
          <article-title>The Million Song Dataset</article-title>
          . (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Dmitry</given-names>
            <surname>Bogdanov</surname>
          </string-name>
          , Won Minz, Philip Tovstogan,
          <string-name>
            <given-names>Alastair</given-names>
            <surname>Porter</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Xavier</given-names>
            <surname>Serra</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>The MTG-Jamendo Dataset for Automatic Music Tagging</article-title>
          .
          <source>In Machine Learning for Music Discovery Workshop, International Conference on Machine Learning (ICML</source>
          <year>2019</year>
          ). Long Beach, CA, United States. http://hdl.handle.
          <source>net/10230/42015</source>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Dmitry</given-names>
            <surname>Bogdanov</surname>
          </string-name>
          , Alastair Porter,
          <string-name>
            <given-names>Philip</given-names>
            <surname>Tovstogan</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Minz</given-names>
            <surname>Won</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>MediaEval 2020: Emotion and Theme Recognition in Music Using Jamendo</article-title>
          .
          <source>Proc. of the MediaEval 2020 Workshop</source>
          , Online,
          <fpage>14</fpage>
          -
          <lpage>15</lpage>
          December
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Mateusz</given-names>
            <surname>Buda</surname>
          </string-name>
          ,
          <source>Atsuto Maki, and Maciej A Mazurowski</source>
          .
          <year>2018</year>
          .
          <article-title>A Systematic Study of the Class Imbalance Problem in Convolutional Neural Networks</article-title>
          .
          <source>Neural Networks</source>
          <volume>106</volume>
          (
          <year>2018</year>
          ),
          <fpage>249</fpage>
          -
          <lpage>259</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Yin</given-names>
            <surname>Cui</surname>
          </string-name>
          , Menglin Jia,
          <string-name>
            <surname>Tsung-Yi</surname>
            <given-names>Lin</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yang Song</surname>
            , and
            <given-names>Serge</given-names>
          </string-name>
          <string-name>
            <surname>Belongie</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Class-Balanced Loss Based on Efective Number of Samples</article-title>
          .
          <source>In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition</source>
          .
          <fpage>9268</fpage>
          -
          <lpage>9277</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Md</given-names>
            <surname>Amaan</surname>
          </string-name>
          <string-name>
            <surname>Haque</surname>
          </string-name>
          , Abhishek Verma, John Sahaya Rani Alex, and
          <string-name>
            <given-names>Nithya</given-names>
            <surname>Venkatesan</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>Experimental Evaluation of CNN Architecture for Speech Recognition</article-title>
          .
          <source>In First International Conference on Sustainable Technologies for Computational Intelligence</source>
          , Ashish Kumar Luhach, Janos Arpad Kosa, Ramesh Chandra Poonia,
          <string-name>
            <surname>Xiao-Zhi Gao</surname>
          </string-name>
          , and Dharm Singh (Eds.). Springer Singapore, Singapore,
          <fpage>507</fpage>
          -
          <lpage>514</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Grant</given-names>
            <surname>Van</surname>
          </string-name>
          Horn and
          <string-name>
            <given-names>Pietro</given-names>
            <surname>Perona</surname>
          </string-name>
          .
          <year>2017</year>
          .
          <article-title>The Devil is in the Tails: FineGrained Classification in the Wild</article-title>
          .
          <article-title>(</article-title>
          <year>2017</year>
          ).
          <source>arXiv:cs.CV/1709.01450</source>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Khaled</given-names>
            <surname>Koutini</surname>
          </string-name>
          , Shreyan Chowdhury, Verena Haunschmid,
          <article-title>Hamid Eghbal-zadeh, and</article-title>
          <string-name>
            <given-names>Gerhard</given-names>
            <surname>Widmer</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Emotion and Theme Recognition in Music with Frequency-Aware RF-Regularized CNNs</article-title>
          .
          <source>Proc. of the MediaEval 2019 Workshop</source>
          , Sophia Antipolis, France,
          <fpage>27</fpage>
          -
          <lpage>30</lpage>
          October
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Tsung-Yi</surname>
            <given-names>Lin</given-names>
          </string-name>
          , Priya Goyal, Ross Girshick, Kaiming He, and
          <string-name>
            <given-names>Piotr</given-names>
            <surname>Dollár</surname>
          </string-name>
          .
          <year>2017</year>
          .
          <article-title>Focal Loss for Dense Object Detection</article-title>
          .
          <source>In Proceedings of the IEEE International Conference on Computer Vision</source>
          . 2980-
          <fpage>2988</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>I. A.</given-names>
            <surname>Pegoraro Santana</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Pinhelli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Donini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Catharin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. B.</given-names>
            <surname>Mangolin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y. M. e. G.</given-names>
            <surname>da Costa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Delisandra Feltrim</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Domingues</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>Music4All: A New Music Database and Its Applications</article-title>
          .
          <source>In 2020 International Conference on Systems, Signals and Image Processing (IWSSIP)</source>
          .
          <volume>399</volume>
          -
          <fpage>404</fpage>
          . https://doi.org/10.1109/IWSSIP48289.
          <year>2020</year>
          .9145170
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Li</surname>
            <given-names>Shen</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Zhouchen</given-names>
            <surname>Lin</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Qingming</given-names>
            <surname>Huang</surname>
          </string-name>
          .
          <year>2016</year>
          .
          <article-title>Relay Backpropagation for Efective Learning of Deep Convolutional Neural Networks</article-title>
          .
          <source>Computer</source>
          Vision - ECCV
          <year>2016</year>
          9911 (
          <year>2016</year>
          ),
          <fpage>467</fpage>
          -
          <lpage>482</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Sangwon</surname>
            <given-names>Suh</given-names>
          </string-name>
          , Sooyoung Park, Youngho Jeong, and
          <string-name>
            <given-names>Taejin</given-names>
            <surname>Lee</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>Designing Acoustic Scene Classification Models with CNN Variants</article-title>
          .
          <source>Technical Report. DCASE2020 Challenge.</source>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>Manoj</given-names>
            <surname>Sukhavasi</surname>
          </string-name>
          and
          <string-name>
            <given-names>Sainath</given-names>
            <surname>Adapa</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Music Theme Recognition Using CNN and Self-Attention</article-title>
          .
          <source>Proc. of the MediaEval 2019 Workshop</source>
          , Sophia Antipolis, France,
          <fpage>27</fpage>
          -
          <lpage>30</lpage>
          October
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Minz</surname>
            <given-names>Won</given-names>
          </string-name>
          , Andres Ferraro, Dmitry Bogdanov, and
          <string-name>
            <given-names>Xavier</given-names>
            <surname>Serra</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>Evaluation of CNN-based Automatic Music Tagging Models</article-title>
          .
          <source>17th Sound and Music Computing Conference (SMC2020)</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Tong</surname>
            <given-names>Wu</given-names>
          </string-name>
          , Qingqiu Huang, Ziwei Liu,
          <string-name>
            <given-names>Yu</given-names>
            <surname>Wang</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Dahua</given-names>
            <surname>Lin</surname>
          </string-name>
          .
          <year>2020</year>
          .
          <article-title>Distribution-Balanced Loss for Multi-Label Classification in LongTailed Datasets</article-title>
          . (
          <year>2020</year>
          ).
          <article-title>arXiv:cs</article-title>
          .CV/
          <year>2007</year>
          .09654
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>Hongyi</surname>
            <given-names>Zhang</given-names>
          </string-name>
          , Moustapha Cisse,
          <string-name>
            <given-names>Yann N.</given-names>
            <surname>Dauphin</surname>
          </string-name>
          , and David LopezPaz.
          <year>2018</year>
          .
          <article-title>mixup: Beyond Empirical Risk Minimization</article-title>
          . In International Conference on Learning Representations. https://openreview.net/ forum?id=
          <fpage>r1Ddp1</fpage>
          -Rb
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>