keunwoochoi / music-auto_tagging-keras

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

Why this error happens? -Input dimension mis-match #22

Closed exeex closed 7 years ago

exeex commented 7 years ago

When I run example_tagging.py , This error message shows up.

ValueError: Input dimension mis-match. (input[0].shape[2] = 96, input[1].shape[2] = 1366)
Apply node that caused the error: Elemwise{Composite{(((i0 - i1) * i2) + i3)}}(input_1, InplaceDimShuffle{x,x,0,x}.0, Elemwise{Composite{(i0 / sqrt((i1 + i2)))}}.0, InplaceDimShuffle{x,x,0,x}.0)
Toposort index: 56
Inputs types: [TensorType(float32, 4D), TensorType(float32, (True, True, False, True)), TensorType(float32, (True, True, False, True)), TensorType(float32, (True, True, False, True))]
Inputs shapes: [(4, 1, 96, 1366), (1, 1, 1366, 1), (1, 1, 1366, 1), (1, 1, 1366, 1)]
Inputs strides: [(524544, 524544, 5464, 4), (5464, 5464, 4, 4), (5464, 5464, 4, 4), (5464, 5464, 4, 4)]
Inputs values: ['not shown', 'not shown', 'not shown', 'not shown']
Outputs clients: [[if{inplace}(keras_learning_phase, Elemwise{Composite{(((i0 - i1) * i2 * i3) + i4)}}.0, Elemwise{Composite{(((i0 - i1) * i2) + i3)}}.0)]]

HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

I have apply the setting in keras.json

    "backend": "theano",
    "image_dim_ordering": "th"

The enviroment is:

OS : macOS
Python version : 3.5.3 (with Pycharm venv)
Backend: Theano 0.9.0rc3

It looks like the tensor dim / input data type is not correctly set. How do I fix it up?

keunwoochoi commented 7 years ago

Same as #21, seems like something is not compatible with recent version of theano (and tensorflow, too). I also got the same message on my mac. Will test on vm/etc. Meanwhile, you can try compact_cnn which works on the recent keras/theano/tensorflow.

exeex commented 7 years ago

Thank you very much! That work on my mac well.

emurina commented 7 years ago

Hi keunwoochoi,

I have the same errors exeex... which versions of tensorflow, theano and keras have you used in the example_tagging.py?

I am using tf version 1.0.1 theano 0.9.0 and keras 2.0.0

This is the Error:

ValueError: Input dimension mis-match. (input[0].shape[2] = 96, input[2].shape[2] = 1440) Apply node that caused the error: Elemwise{Composite{(((i0 - i1) i2 i3) + i4)}}(IncSubtensor{InplaceSet;::, ::, int64:int64:, int64:int64:}.0, mean, InplaceDimShuffle{x,x,0,x}.0, Elemwise{Composite{inv(sqrt(((((i0 / i1) / i2) / i3) + i4)))}}[(0, 0)].0, InplaceDimShuffle{x,x,0,x}.0) Toposort index: 125 Inputs types: [TensorType(float32, 4D), TensorType(float32, (True, True, False, True)), TensorType(float32, (True, True, False, True)), TensorType(float32, (True, True, False, True)), TensorType(float32, (True, True, False, True))] Inputs shapes: [(4, 1, 96, 1440), (1, 1, 96, 1), (1, 1, 1440, 1), (1, 1, 96, 1), (1, 1, 1440, 1)] Inputs strides: [(552960, 552960, 5760, 4), (384, 384, 4, 4), (5760, 5760, 4, 4), (384, 384, 4, 4), (5760, 5760, 4, 4)] Inputs values: ['not shown', 'not shown', 'not shown', 'not shown', 'not shown'] Outputs clients: [[if{inplace}(keras_learning_phase, Elemwise{Composite{(((i0 - i1) i2 i3) + i4)}}.0, Elemwise{Composite{(((i0 - i1) * i2) + i3)}}[(0, 0)].0)]]

HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'. HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.