NazarPonochevnyi / Trained-CNN-for-Genre-classification

🎵 Trained CNN model for Genre classification on GTZAN dataset [CNN Model: https://github.com/Hguimaraes/gtzan.keras]
MIT License
21 stars 5 forks source link
cnn-keras genre-classification gtzan-dataset machine-learning mir music-genre-classification neural-network tensorflow trained-models

Trained CNN for Genre classification

🎵 Trained CNN model for Genre classification on GTZAN dataset [CNN Model: https://github.com/Hguimaraes/gtzan.keras]

Test trained CNN model

In the ./weights/ you can find trained model weights and model architecture. Also, you can download .h5 file and place it manually to ./weights/ directory using this link.

For test this trained model, you can run python3 predict_vgg16.py.

Also, if you want to test your custom song or turn off debug messages, you can change code in the get_genre()'s function arguments. For example, you can input your song path instead default ./audios/classical_music.mp3 path or toggle next boolean function's argument to turn off debug messages.

Overview

For train CNN model of deep learning:

  1. Read the audios as melspectrograms, spliting then into 3s windows with 50% overlaping resulting in a dataset with the size 19000x129x128x1 (samples x time x frequency x channels)**.
  2. Shuffle the input and split into train and test (70%/30%)
  3. Train the CNN and validate using the validation dataset

** In the case of the VGG, the channel need to have 3 channels

Dependencies

Accuracy, Loss and Confusion matrix graphs

alt text alt text

License

MIT Licence