Veleslavia / EUSIPCO2017

This repository contains code for musical instrument recognition experiments for the paper entitled "Timbre Analysis of Music Audio Signals with Convolutional Neural Networks".
GNU Affero General Public License v3.0
48 stars 10 forks source link

Multilayer Weigth - file match #2

Closed tuffer020 closed 7 years ago

tuffer020 commented 7 years ago

Hello again,

Is the model_build specifications for multilayer.py and the weights provided for it different?

I am getting this error:

ValueError: Dimension 0 in both shapes must be equal, but are 5 and 128 for 'Assign' (op: 'Assign') with input shapes: [5,1,1,128], [128,1,5,1].

Which would suggest they are. Since this is a model building error (from the tensorflow backend), I can only guess that the weights and the model they're being passed into are different.

I tried running my own model, but the accuracy returned did not seem to improve after 10 epochs.

Thanks again!

Veleslavia commented 7 years ago

Hello! Thanks for letting me know!! Actually, it seems that I used Theano backend while training and haven't converted weight for TF.

The simplest solution is just to change keras backend from TF to Theano. I'll convert and update the weights later. Thank you!

tuffer020 commented 7 years ago

Hi, yes, that did half of the trick :) I needed to add some configs since my environment wasn't setup properly.

For reference/documentation purposes, I am adding the following config file content. If you run Keras on your machine, the config file gets created (or you can create it yourself) located at ~/.keras/keras.json. Make sure to

  1. change backend
  2. add "image_dim_ordering":"th"
  3. Add: dim_ordering='th' in Convolution2D (located in multilayer.py)
    {
    "epsilon": 1e-07,
    "floatx": "float32",
    "image_data_format": "channels_last",
    "backend": "theano",
    "image_dim_ordering": "th"
    }

Ref: https://github.com/yanpanlau/Keras-FlappyBird/issues/3

Thank you!