Hguimaraes / gtzan.keras

[REPO] Music Genre classification on GTZAN dataset using CNNs
MIT License
201 stars 57 forks source link

gtzan.py #1

Closed HIN0209 closed 7 years ago

HIN0209 commented 7 years ago

Hello,

I do not see gtzan.py here.

Hguimaraes commented 7 years ago

Hello, @HIN0209

It's current under development, I'm still changing some things and didn't update the README file. I will work on this and let you know on how to use.

Cheers,

Hguimaraes commented 7 years ago

Hi @HIN0209,

I've update the project and tried to improve the description in the README. Any trouble feel free to contact me.

Cheers,

HIN0209 commented 7 years ago

@Hguimaraes, Thank you for updating. I will check how it works!

HIN0209 commented 7 years ago

@Hguimaraes, Yes, it works as shown. I have a question. Is it possible to train/test other than melspectrogram (e.g., spectrogram) by changing the code below (or else)? I could not find description of AudioUtils.

Thanks.

split the train, test and validation data in size 128x128

X_Val, y_val = AudioUtils().splitsongs_melspect(X_Val, y_val, CNN_TYPE)
X_test, y_test = AudioUtils().splitsongs_melspect(X_test, y_test, CNN_TYPE)
X_train, y_train = AudioUtils().splitsongs_melspect(X_train, y_train, CNN_TYPE)

# Construct the model
if CNN_TYPE == '1D':
  cnn = ModelZoo.cnn_melspect_1D(input_shape)
elif CNN_TYPE == '2D':
  cnn = ModelZoo.cnn_melspect_2D(input_shape)
Hguimaraes commented 7 years ago

The name convention is not good, I already have change a lot of the code... Sorrya bout that. This function splitsongs_melspect receives an array of melspectrograms and split in N pieces (In this case, 10 pieces).

To work fast and occupy few memory as possible I already read the file as melspectrograms in the file src/audiomanip/audiostruct. You can change this file but probably will need to change other parts of the code.

This repo is almost a guide for my undergraduate-thesis, a lot of code is specific for my needs and not general goals, but I would be happy to help you with something, just ask. I don't know if I will instantly answer you because I'm in the middle of my exams at university, but I will try.

I tested other structures such as spectrogram and MFCC... MFCC gave a better accuracy, (But I don't recall the parameters of the CNN) but a higher accuracy is not my only goal in this work.

HIN0209 commented 7 years ago

Great answers. I do not like to bother you during the exams. Let me understand your code and librosa at this point.

Thanks a lot!