I have a problem and at the same time a question. I want to make an image classifier with Keras using Theano as Backend and a Sequential model.
>>> keras.__version__
'2.0.1'
>>> theano.__version__
'0.9.0'
My input shape: INPUT_SHAPE = (3, 28, 28) #depth, size, size
Let's come to my problem. If I run my script at Windows 7 32 Bit, it gives me the error below out:
ValueError: ('The specified size contains a dimension with value <= 0', (-1024, 512))
If run it with the the input shape: INPUT_SHAPE = (28, 28, 3) #size, size, depth
It gives me out this error below:
ValueError: Error when checking model input: expected conv2d_1_input to have shape (None, 48, 48, 3) but got array with shape (1000, 3, 48, 48)
If I run the code on Elementary OS 64 Bit, it runs without any problems (INPUT_SHAPE = (3, 28, 28)
).
My keras.json file for windows is:
{
"backend": "theano",
"epsilon": 1e-07,
"floatx": "float32",
"image_dim_ordering": "tf"
}
So, my question is: Is there such a big difference between different Operating Systems or where is my mistake? Just to remind, I used exactly the same code for both systems.
If your problem is not solved yet try using:
from keras import backend as K
K.set_image_dim_ordering('th')
This would work good if you wish to use theano backend and have to use channels first configuration for image dimension ordering.
The problem you are having has to do with the expected dimension ordering.
If you change the ordering line in the keras.json file to "image_dim_ordering": "th" it should work. (i'd bet that's what's in your Elementary OS keras.json).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With