Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work out of the box #7

Open
JohnTailor opened this issue Oct 8, 2018 · 1 comment
Open

Does not work out of the box #7

JohnTailor opened this issue Oct 8, 2018 · 1 comment

Comments

@JohnTailor
Copy link

Thanks for the code. Without trying to look for reasons, it seems to fail for newer tensorflow/keras versions - though that could also be specific to my setup.

Anyway, I get:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 1 and 3. Shapes are [1] and [3].

Full trace:

Using TensorFlow backend.
C:\Users\Deeplearning.keras\datasets\cifar-10-batches-py
X_train shape: (50000, 32, 32, 3)
50000 train samples
10000 test samples
(32, 32, 3)
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:78: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(96, (3, 3), input_shape=(3, 32, 32..., padding="same")
model.add(Convolution2D(96, 3, 3, border_mode='same', input_shape=(3, 32, 32)))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:80: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(96, (3, 3), padding="same")
model.add(Convolution2D(96, 3, 3, border_mode='same'))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:82: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(96, (3, 3), strides=(2, 2), padding="same")
model.add(Convolution2D(96, 3, 3, border_mode='same', subsample=(2, 2)))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:85: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(192, (3, 3), padding="same")
model.add(Convolution2D(192, 3, 3, border_mode='same'))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:87: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(192, (3, 3), padding="same")
model.add(Convolution2D(192, 3, 3, border_mode='same'))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:89: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(192, (3, 3), strides=(2, 2), padding="same")
model.add(Convolution2D(192, 3, 3, border_mode='same', subsample=(2, 2)))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:92: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(192, (3, 3), padding="same")
model.add(Convolution2D(192, 3, 3, border_mode='same'))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:94: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(192, (1, 1), padding="valid")
model.add(Convolution2D(192, 1, 1, border_mode='valid'))
C:/Users/Deeplearning/Desktop/DeepRepo2/greendatamining/DeepLearn/DeepCodeOwnNetwork/simplenet.py:96: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(10, (1, 1), padding="valid")
model.add(Convolution2D(10, 1, 1, border_mode='valid'))
Traceback (most recent call last):
File "C:\Users\Deeplearning\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1576, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 1 and 3. Shapes are [1] and [3].
From merging shape 0 with other shapes. for 'tower_0/lambda_1/concat/concat_dim' (op: 'Pack') with input shapes: [1], [3].

@RyanZHe
Copy link

RyanZHe commented Nov 6, 2018

Try change K.set_image_dim_ordering('tf') to K.set_image_dim_ordering('th')

Source: https://datascience.stackexchange.com/questions/14467/what-does-theano-dimension-ordering-mean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants