This repository contains code and experiments for sound classification on the ESC-50 dataset. The goal is to classify audio recordings into one of 50 environmental sound classes.
The ESC-50 dataset consists of 50 environmental sound classes, with each class containing 40 recordings, resulting in a total of 2,000 sound recordings. These classes include sounds such as dog barks, gunshots, and various natural sounds.
- Dataset link: ESC-50 Dataset
With 50 classes, the expected random guessing accuracy is approximately 2% (1/50), assuming each class is equally likely to occur.
The network used for this sound classification task is a Multilayer Perceptron (MLP), which processes spectrograms extracted from the audio files. The model is evaluated using 5-fold cross-validation based on the predefined splits from the ESC-50 dataset.
- The data is split into 5 folds, ensuring that the training and testing data are split evenly across the different classes.
- For each fold, an MLP model is trained on the training data and tested on the hold-out validation data.
- The model architecture is designed to take in spectrograms as input features.
It is recommended to create a new environment:
conda create -n challenge2 python=3.10
conda activate challenge2Clone the repository and install the necessary dependencies:
git clone https://github.com/yourusername/Challenge2_2025.git
cd Challenge2_2025
pip install torch==2.6.0+cu124 --index-url https://download.pytorch.org/whl/cu124
pip install -r requirements.txtTo run the sound classification experiments, use the following command:
python train_crossval.pyThis will start the training process using the MLP model and 5-fold cross-validation.
The model will output the classification results for each fold, including metrics such as accuracy and loss.
To test all cross-validation folds use the following command:
python test_crossval.py results/EXPERIMENT_DIR