Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Audio Classification (ESC-50) - SVM & Random Forest

A classical machine learning pipeline for environmental sound classification, built on the ESC-50 dataset. The project covers manual feature extraction, feature analysis, model training, hyperparameter tuning, and evaluation using SVM and Random Forest classifiers.

Best model accuracy: 86% - surpassing human-level performance (~81%) on ESC-50


Overview

The ESC-50 dataset is an industry-standard benchmark for environmental sound classification. This project focuses on 10 selected classes of diverse sound categories, using manually extracted acoustic features to train and tune classical ML classifiers.

The supervised learning component was developed independently as part of the Applied Machine Learning course at Hanze University of Applied Sciences (2024–2025).

Selected Classes

Category Classes
Animals Chirping birds, Frog, Insects
Natural Thunderstorm
Urban Airplane, Car horn, Vacuum cleaner
Human Breathing, Brushing teeth
Mechanical Clock tick

Pipeline

  1. Import required libraries and modules
  2. Read audio file metadata
  3. Select 10 classes (2 from each major ESC-50 category)
  4. Split data using predefined folds (to prevent data leakage)
  5. Visualize waveforms and spectrograms (1 instance per class)
  6. Extract features: MFCC, RMS, Zero Crossing Rate, Spectral Centroid, Spectral Roll-off, Spectral Contrast
  7. Aggregate features using mean and standard deviation
  8. Visualize features using pair plots
  9. Analyze correlation coefficients to ensure feature decorrelation
  10. Create feature subsets for comparative experiments
  11. Find initial hyperparameter ranges using GridSearchCV
  12. Fine-tune hyperparameters on selected ranges
  13. Select best model per feature set
  14. Evaluate using Confusion Matrix and ROC-AUC curves
  15. Train and compare Random Forest classifier

Results

Model Feature Set Test Accuracy
SVM (Linear, C=0.1) All features 86%
SVM Feature Set 1 ~65%
SVM Feature Set 2 ~74%
SVM PCA-reduced ~37%
Random Forest (1000 trees) All features Comparable to SVM

ROC-AUC (best SVM): 0.97–0.98

Human-level performance on ESC-50 is reported at ~81%. The best model in this project surpasses that benchmark using only classical ML and manually extracted features.


Key Techniques

  • Feature extraction: MFCC, ZCR, RMS, Spectral Centroid, Roll-off, Contrast via Librosa
  • Cross-validation: PredefinedSplit (respects ESC-50 fold structure to avoid data leakage)
  • Hyperparameter tuning: Two-stage, GridSearchCV and manual (broad → narrow)
  • Evaluation: Confusion matrix, per-class ROC-AUC, macro-average F1

Project Structure

audio-classification-esc50/
│
├── audio_classification_esc50.ipynb   # Full pipeline notebook
├── requirements.txt                   # Dependencies
└── README.md

Note: The ESC-50 dataset is not included. Download it from the official repository.


How to Run

  1. Clone the repository:
git clone https://github.com/MostafaJahanian/audio-classification-esc50.git
cd audio-classification-esc50
  1. Install dependencies:
pip install -r requirements.txt
  1. Download the ESC-50 dataset and update the file paths in the notebook accordingly.

  2. Run the notebook top to bottom.


Author

Mostafa Jahanian LinkedIn · GitHub

About

Tuned SVM for classifying 10 classes form ESC-50 dataset using acoustic features manually extracted. The final model achieved 86 percent accuracy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages