Skip to content

Implementation for "SoundCLR: Contrastive Learning of Representations For Improved Environmental Sound Classification," in pytorch.

License

Notifications You must be signed in to change notification settings

alireza-nasiri/SoundCLR

Repository files navigation

Contrastive-Learning-in-ESC

Implementation for the paper SoundCLR: Contrastive Learning of Representations For Improved Environmental Sound Classification

Three Training Schemes For The Audio Classifiers:

overview of our three models

Data Augmentation:

data augmentation process

Setup and Dependencies:

First, install the above dependencies.

Second, download ESC50 and US8K datasets and put them inside the 'data' directory, and assign True to the dataset that you want to use to train your model, in config.py

###Quickstart

Training with Cross-Entropy Loss

To train a classifier with ResNet-50 with cross-entropy loss:

$ python train_crossEntropyLoss.py

Training with Supervised-Contrastive Loss

Stage 1: To train a classifier with ResNet-50 with supervised-contrastive loss:

$ python train_contrastiveLoss.py

Stage2: and then update path_to_classifierModel in config.py with the path to the ResNet model trained in stage1, and:

$ python train_classifier.py

Training with Hybrid Loss

To train a classifier with ResNet-50 with hybrid loss:

$ python train_hybridLoss.py

Configuration Options

By modifying config.py file, you can change:

  • training hyperparameters
  • the alpha value for the hybrid loss
  • maximul-length and number of the masking segments

About

Implementation for "SoundCLR: Contrastive Learning of Representations For Improved Environmental Sound Classification," in pytorch.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages