keunwoochoi / music-auto_tagging-keras

Music auto-tagging models and trained weights in keras/theano
MIT License
616 stars 142 forks source link

Shapes are not compatible #2

Closed pribadihcr closed 7 years ago

pribadihcr commented 7 years ago

Hi @keunwoochoi

I got the following error:

  File "example.py", line 92, in <module>
    main(net)
  File "example.py", line 67, in main
    model = AudioConvnet()
  File "/home/rudy/AOITEK/DeepLearning/music-auto_tagging-keras/audio_convnet.py", line 121, in AudioConvnet
    model.load_weights('data/%s_weights_%s.h5' % ('cnn', K._BACKEND))
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2489, in load_weights
    self.load_weights_from_hdf5_group(f)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2563, in load_weights_from_hdf5_group
    K.batch_set_value(weight_value_tuples)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 926, in batch_set_value
    assign_op = x.assign(assign_placeholder)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 501, in assign
    return state_ops.assign(self._variable, value, use_locking=use_locking)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 45, in assign
    use_locking=use_locking, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 703, in apply_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2319, in create_op
    set_shapes_for_outputs(ret)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1711, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/state_ops.py", line 210, in _AssignShape
    return [op.inputs[0].get_shape().merge_with(op.inputs[1].get_shape())]
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_shape.py", line 570, in merge_with
    (self, other))
ValueError: Shapes (3, 3, 1, 32) and (32, 1, 3, 3) are not compatible
keunwoochoi commented 7 years ago

Ah, is image_dim_ordering tf? I will test it. Could you also try if it works when image_dim_ordering is th? You can change it at ~/.keras/keras.json.

keunwoochoi commented 7 years ago

Oh, I forgot that I don't have the pre-trained weights for image_dim_ordering=tf cases. It is written in readme.md and I added a runtimeError to make it clear.