Music Genre Classification
Recognizing music genre is a challenging task in the area of music information retrieval. Two approaches are studied here:
- Spectrogram based end-to-end image classification using a CNN (VGG-16)
- Feature Engineering Approach using Logistic Regression, SVMs, Random Forest and eXtreme Gradient Boosting.
For a detailed description about the project, please refer to Music Genre Classification using Machine Learning Techniques, published on arXiv.
The Audio Set data released by Google is used in this study. Specifically, only the wav files that correspond to the following class labels are extracted from YouTube based on the video link, start and end times.
- First, the audio wav files need to be downloaded using the tool youtube-dl. For this run
audio_retrieval.py. Note that the each file is about 880 KB, totally upto 34 GB!
- Next, generate MEL spectrograms by running
generate_spectrograms.py. If needed, you may modify the same file to change the Short Time Fourier Transform (STFT) parameters.
- The next step is to run the models. Please refer to the corresponding Jupyter notebooks. The deep learning based models are present in notebooks 3.1, 3.2 and 3.3. Notebooks 4 and 5 contains steps for feature extraction (run
feature_extraction.py) and building the classifiers using
The most important 20 features based on the XGB classifier are shown below. The metric on the x-axis refers to the number of times a given features appears as a decision node in all of the decision trees used to build the gradient boost predictor.