Skip to main content
QUICK REVIEW

[Paper Review] SoundCLR: Contrastive Learning of Representations For Improved Environmental Sound Classification

Alireza Nasiri, Jianjun Hu|arXiv (Cornell University)|Mar 2, 2021
Music and Audio ProcessingComputer Science44 references16 citations
TL;DR

SoundCLR proposes a hybrid loss training framework combining supervised contrastive learning and cross-entropy loss for environmental sound classification, using strong data augmentation on raw audio and log-mel spectrograms. It achieves state-of-the-art accuracy of 99.75% on ESC-10, 93.4% on ESC-50, and 86.49% on US8K by disentangling class representations and improving robustness to noise.

ABSTRACT

Environmental Sound Classification (ESC) is a challenging field of research in non-speech audio processing. Most of current research in ESC focuses on designing deep models with special architectures tailored for specific audio datasets, which usually cannot exploit the intrinsic patterns in the data. However recent studies have surprisingly shown that transfer learning from models trained on ImageNet is a very effective technique in ESC. Herein, we propose SoundCLR, a supervised contrastive learning method for effective environment sound classification with state-of-the-art performance, which works by learning representations that disentangle the samples of each class from those of other classes. Our deep network models are trained by combining a contrastive loss that contributes to a better probability output by the classification layer with a cross-entropy loss on the output of the classifier layer to map the samples to their respective 1-hot encoded labels. Due to the comparatively small sizes of the available environmental sound datasets, we propose and exploit a transfer learning and strong data augmentation pipeline and apply the augmentations on both the sound signals and their log-mel spectrograms before inputting them to the model. Our experiments show that our masking based augmentation technique on the log-mel spectrograms can significantly improve the recognition performance. Our extensive benchmark experiments show that our hybrid deep network models trained with combined contrastive and cross-entropy loss achieved the state-of-the-art performance on three benchmark datasets ESC-10, ESC-50, and US8K with validation accuracies of 99.75\%, 93.4\%, and 86.49\% respectively. The ensemble version of our models also outperforms other top ensemble methods. The code is available at https://github.com/alireza-nasiri/SoundCLR.

Motivation & Objective

  • To improve environmental sound classification (ESC) by learning disentangled representations that separate samples of different classes.
  • To address the limited generalization of standard cross-entropy loss by introducing a supervised contrastive loss that enhances inter-class margins.
  • To leverage transfer learning and strong data augmentation to improve performance on small ESC datasets.
  • To evaluate the effectiveness of hybrid loss training (contrastive + cross-entropy) in improving model accuracy and robustness.
  • To demonstrate that contrastive learning enhances model robustness to background noise in real-world audio.

Proposed method

  • The model uses a ResNet-50 backbone pre-trained on ImageNet for feature extraction, fine-tuned on audio spectrograms.
  • A hybrid loss function combines supervised contrastive loss and cross-entropy loss, with a hyperparameter α balancing their contributions.
  • Contrastive loss pulls together positive pairs (augmented views of the same sample) and pushes apart negative pairs (different-class samples) in the representation space.
  • Data augmentation is applied to both raw audio signals and their log-mel spectrograms, including masking on spectrograms to improve robustness.
  • The model is trained end-to-end using the combined loss, with α = 0.5 found optimal across all datasets.
  • Ensemble models are created by averaging predictions from five independently trained ResNet-50 models using the hybrid loss.

Experimental results

Research questions

  • RQ1Can supervised contrastive learning improve representation learning in environmental sound classification compared to standard cross-entropy training?
  • RQ2How does combining contrastive and cross-entropy loss affect classification accuracy on small-scale audio datasets?
  • RQ3What is the impact of masking-based data augmentation on log-mel spectrograms in improving model generalization?
  • RQ4How does the hybrid loss framework enhance robustness to background noise in test sets?
  • RQ5Can the proposed method achieve state-of-the-art performance on standard ESC benchmarks like ESC-10, ESC-50, and US8K?

Key findings

  • The hybrid loss with α = 0.5 achieved the highest validation accuracy across all three datasets, confirming complementary optimization.
  • SoundCLR achieved 99.75% accuracy on ESC-10, 93.4% on ESC-50, and 86.49% on US8K, setting new state-of-the-art results.
  • The ensemble of five ResNet-50 models trained with the hybrid loss reached 93.6% accuracy on ESC-50 and 88.01% on US8K, outperforming prior ensemble methods.
  • Models trained with contrastive loss showed slower accuracy degradation under white noise, indicating improved robustness due to larger inter-class margins.
  • Masking-based augmentation on log-mel spectrograms significantly improved recognition performance, especially in noisy conditions.
  • The hybrid training strategy outperformed both pure cross-entropy and pure contrastive loss training, demonstrating the benefit of combined supervision.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.