Angular Distance Distribution Loss for Audio Classification

Antonio Almudévar, Romain Serizel, Alfonso OrtegaarXiv 2024 · DOI · arXiv

Abstract

This paper introduces the Angular Distance Distribution (ADD) loss, a novel objective function designed to optimize embedding spaces for audio classification. Unlike traditional losses that focus solely on clustering and separation, ADD loss enforces statistical uniformity (equidistance) within and between classes by constraining the first and second-order moments of angular distances. Experimental results on ESC-50, Speech Commands V2, and IEMOCAP datasets demonstrate that ADD loss consistently improves classification accuracy and stability across various state-of-the-art architectures.

Introduction

In deep learning-based audio classification, the primary goal is to map input signals into a low-dimensional embedding space where semantically similar samples are grouped together. Ideally, embeddings of the same class should exhibit high intra-class clustering, while different classes should maintain significant inter-class separation.

However, standard loss functions often inadvertently introduce hierarchies within the embedding space. For instance, some samples may reside much closer to the class centroid than others, or specific class pairs may be naturally closer to each other than to the rest of the dataset. In canonical classification tasks where all errors are weighted equally, these structural biases act as a nuisance. This research aims to eliminate such biases by ensuring all samples and classes are treated with statistical "fairness" through the enforcement of equidistance.

Methodology: Angular Distance Distribution (ADD) Loss

The core innovation of this work is the Angular Distance Distribution (ADD) loss. Rather than optimizing raw distances, the ADD loss imposes constraints on the first and second-order statistical moments—mean and variance—of the angular distances between embeddings.

The loss function targets four fundamental properties:

  1. Intra-class clustering: Minimizing the average distance between embeddings of the same class.
  2. Intra-class equidistance: Minimizing the variance of distances within a class to ensure all samples are equally similar to the centroid.
  3. Inter-class separation: Maximizing the distance between different classes, specifically targeting orthogonality.
  4. Inter-class equidistance: Minimizing the variation of distances between different class pairs to remove inter-class hierarchies.
Comparison of non-uniform (left) and uniform (right) intra-class distributions achieved by ADD loss.

Additionally, the authors incorporate a Soft Label Adaptation mechanism. To accommodate modern training techniques like "mixup," the loss is modified to ensure that the angular distance between embeddings reflects the similarity of their corresponding soft label distributions.

Experimental Setup

The ADD loss was evaluated using two state-of-the-art architectures: the Audio Spectrogram Transformer (AST) and BEATs. Performance was benchmarked across three diverse audio datasets:

  • ESC-50: Environmental sound classification featuring 50 classes of ambient noise.
  • Speech Commands V2 (KS2): Keyword spotting with 35 distinct word classes.
  • IEMOCAP (ER): Speech emotion recognition across 4 emotion categories.

Results and Discussion

The ADD loss achieved superior accuracy compared to standard Cross-Entropy, Focal Loss, and Orthogonal Projection Loss (OPL) across nearly all benchmarks. On the ESC-50 dataset, accuracy reached 94.68% with AST, outperforming Cross-entropy (93.97%). A more significant jump was observed in Speech Commands (KS2), where accuracy rose to 97.54% from 92.05%.

Beyond raw accuracy, the ADD loss provided more stable results with lower standard deviations across training runs. Ablation studies revealed that while each of the four targeted properties contributes to performance, the combination of all four—particularly the inclusion of intra-class and inter-class equidistance—yields the best results.

Visualization of a well-separated and equidistant multi-class embedding space.

The use of orthogonality as a goal for inter-class separation allows the model to utilize the high-dimensional hypersphere more efficiently. Qualitatively, visualizations confirm that the ADD loss successfully creates a more uniform and well-separated embedding space compared to traditional methods.

Conclusion

The Angular Distance Distribution loss represents a significant step forward in optimizing embedding spaces for canonical classification. By focusing on the variance of distances, the model achieves a more balanced and fair representation of data. While this approach is highly effective for independent classes, future work will explore its applicability in domains where hierarchical relationships are desirable, such as anomaly detection or biometric recognition.

Reference: Antonio Almudevar, Romain Serizel, Alfonso Ortega. "Angular Distance Distribution Loss for Audio Classification." DCASE 2024.

Summary updated

Abstract

Classification is a pivotal task in deep learning not only because of its intrinsic importance, but also for providing embeddings with desirable properties in other tasks. To optimize these properties, a wide variety of loss functions have been proposed that attempt to minimize the intra-class distance and maximize the inter-class distance in the embeddings space. In this paper we argue that, in addition to these two, eliminating hierarchies within and among classes are two other desirable properties for classification embeddings. Furthermore, we propose the Angular Distance Distribution (ADD) Loss, which aims to enhance the four previous properties jointly. For this purpose, it imposes conditions on the first and second order statistical moments of the angular distance between embeddings. Finally, we perform experiments showing that our loss function improves all four properties and, consequently, performs better than other loss functions in audio classification tasks.
BibTeX
@misc{almudevar2024angular,
  author = {Antonio Almudévar and Romain Serizel and Alfonso Ortega},
  title = {{Angular Distance Distribution Loss for Audio Classification}},
  year = {2024},
  eprint = {2411.00153},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.00153},
}
Figure