Skip to content

OfenPower/MusicGenreClassification

Repository files navigation

Music Genre Classification
-------------------------------------------------------------------------------------

Dataset: GTZAN, 1000 Songs in 10 Genres (100 Songs per Genre)
Link to Dataset: http://marsyas.info/downloads/datasets.html

Used Libraries:
- numpy		(Installation: pip install numpy)
- tensorflow	(Installation: pip install tensorflow)
- matplotlib	(Installation: pip install matplotlib)
- librosa	(Installation: pip install librosa )
- scikit-learn	(Installation: pip install scikit-learn)


-------------------------------------------------------------------------------------

---------------------------- .py Script Documentation -------------------------------

-------------------------------------------------------------------------------------

Script "file_processor.py":

The script "file_processor.py" loads the GTZAN data set and extracts 4 Audio Feaures: 
Spectral Centroid, Spectral Rolloff, Chroma Frequencies, MFCCs. As a result, a .json 
file is saved, which contains all features and the corresponding genre label. 
This .json file is used by the other scripts for genre classification.

-------------------------------------------------------------------------------------

Script "main_cnn_adjusted.py"

This script contains the customized CNN to which the paper refers. The file "main_cnn_adjusted.py" 
loads a .json file, which was created by the "file_processor.py" script. The data contained 
in it is then prepared and used for input in a CNN and divided into training/testing and 
validation data. Afterwards the CNN training process starts. When the training is finished,
the classification of the test data set, as well as the visualization of the result
in a confusion matrix follows. At the end the training process is graphically shown.


-------------------------------------------------------------------------------------

Script "main_cnn_original.py"

This script contains the original CNN from https://www.youtube.com/watch?v=dOG-HxpbMSw.
The procedure is identical to the script "main_cnn_adjusted.py". The original CNN is
therefore included here again, so that you can compare both CNNs.

-------------------------------------------------------------------------------------

Script "main_tsne.py"

When this script is executed, a .json file created by the "file_processor.py" script
is read and visualized with the t-SNE method. Parameters are: perplexity=20 and n_iter=1000.

About

Machine Learning Models for Music Genre Classification with the GTZAN Dataset

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages