Skip to content

NazarPonochevnyi/Trained-CNN-for-Genre-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Training (at Epoch 35):

    • Training loss: 0.1283

    • Training accuracy: 0.9596

  • Testing:

    • Test loss: 0.3936

    • Test accuracy: 0.8921

Accuracy, Loss and Confusion matrix graphs

alt text alt text

License

MIT Licence