jsalbert / Music-Genre-Classification-with-Deep-Learning

Using deep learning to predict the genre of a song.
https://jsalbert.github.io/Music-Genre-Classification-with-Deep-Learning/
MIT License
145 stars 36 forks source link

Issue while running quick_test.py #3

Open pandey1996 opened 6 years ago

pandey1996 commented 6 years ago

Using TensorFlow backend. /home/user/Downloads/Music-Genre-Classification-with-Deep-Learning-master/tagger_net.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), padding="same", trainable=False, name="conv1") x = Convolution2D(64, 3, 3, border_mode='same', name='conv1', trainable=False)(x) /home/user/Downloads/Music-Genre-Classification-with-Deep-Learning-master/tagger_net.py:87: UserWarning: Update your BatchNormalization call to the Keras 2 API: BatchNormalization(trainable=False, name="bn1", axis=3) x = BatchNormalization(axis=channel_axis, mode=0, name='bn1', trainable=False)(x) 2018-02-23 10:25:43.298633: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA Traceback (most recent call last): File "quick_test.py", line 36, in model = MusicTaggerCRNN(weights=None, input_tensor=(1, 96, 1366)) File "/home/user/Downloads/Music-Genre-Classification-with-Deep-Learning-master/tagger_net.py", line 89, in MusicTaggerCRNN x = MaxPooling2D(pool_size=(2, 2), strides=(2, 2), name='pool1', trainable=False)(x) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 617, in call output = self.call(inputs, **kwargs) File "/usr/local/lib/python2.7/dist-packages/keras/layers/pooling.py", line 158, in call data_format=self.data_format) File "/usr/local/lib/python2.7/dist-packages/keras/layers/pooling.py", line 221, in _pooling_function pool_mode='max') File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 3654, in pool2d data_format=tf_data_format) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 2043, in max_pool name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 3018, in _max_pool data_format=data_format, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3162, in create_op compute_device=compute_device) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3208, in _create_op_helper set_shapes_for_outputs(op) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2427, in set_shapes_for_outputs return _set_shapes_for_outputs(op) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2400, in _set_shapes_for_outputs shapes = shape_func(op) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2330, in call_with_requiring return call_cpp_shape_fn(op, require_shape_fn=True) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn require_shape_fn) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl raise ValueError(err.message) ValueError: Negative dimension size caused by subtracting 2 from 1 for 'pool1/MaxPool' (op: 'MaxPool') with input shapes: [?,1,170,64].

habib-baig commented 6 years ago

How did you solve this issue?

akhi1312 commented 6 years ago

You need to add dim_ordering="th" under all four conv block like this in file tagger_net.py

x = MaxPooling2D(pool_size=(4, 4), strides=(4, 4), name='pool3', trainable=False , dim_ordering="th")(x) .. it shoud work

kvpratama commented 6 years ago

You can put this line after all import statements

K.set_image_dim_ordering('th')