Open muthiyanbhushan opened 6 years ago
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
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
model.add(Flatten())
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 476, in add
output_tensor = layer(self.outputs[0])
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 615, in call
output_shape = self.compute_output_shape(input_shape)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 481, in compute_output_shape
'(got ' + str(input_shape[1:]) + '. '
ValueError: The shape of the input to "Flatten" is not fully defined (got (0, 14, 4). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.
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 yourConv2D
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, inMy 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