ValueError: The shape of the input to "Flatten" is not fully defined
Hello @pplonski,
Thank you for this tutorial to convert simple keras to cpp.
when I run the first command to generate ".h5 " and ".json" file I get following error:
I tried changing backends to both Theano and Tensorflow in keras.json file but still could not resolve this error.
$ python example/mnist_cnn_one_iteration.py
error:
Using Theano backend.
X_train shape: (60000, 1, 28, 28)
60000 train samples
10000 test samples
example/mnist_cnn_one_iteration.py:49: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(4, (3, 3), padding="same", input_shape=(1, 28, 28...)
model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='same',input_shape=(1, img_rows, img_cols)))
example/mnist_cnn_one_iteration.py:51: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(4, (3, 3), padding="same")
model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='same'))
Traceback (most recent call last):
File "example/mnist_cnn_one_iteration.py", line 56, in
My keras.json file looks like:
{ "image_dim_ordering": "th", "epsilon": 1e-07, "floatx": "float32", "backend": "theano" }
Please let me know about it.
Thank you.
Regards, Bhushan
Hi! I think it can be problem with keras 2.0, it is not tested, could you try with keras 1.2.2 ?
Hello pplonski,
I resolved that issue by changing to keras 1.2.2 but now another issue with Theano ifelse condition
$ python example/mnist_cnn_one_iteration.py
Using Theano backend.
Downloading data from https://s3.amazonaws.com/img-datasets/mnist.pkl.gz
15302656/15296311 [==============================] - 2s
X_train shape: (60000, 1, 28, 28)
60000 train samples
10000 test samples
Traceback (most recent call last):
File "example/mnist_cnn_one_iteration.py", line 54, in
Thanks for your help.
Bhushan
Probably you have resolved this issue, just for the sake of completeness.
You can modify the .../theano_backend.py according to this: https://stackoverflow.com/questions/46253744/getting-error-attributeerror-module-object-has-no-attribute-ifelse