Closed srinivasjdi closed 6 years ago
I've got a similar issue:
Exception: Error when checking : expected convolution2d_input_1 to have shape (None, 30, 30, 3) but got array with shape (1, 30, 3, 3)
My model:
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
import tensorflow as tf
tf.python.control_flow_ops = tf
n_input = (30, 30, 3)
model = Sequential()
model.add(Convolution2D(64, 2, 2, border_mode='valid', activation='relu', input_shape=n_input))
model.add(Convolution2D(64, 2, 2, activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.25))
model.add(Convolution2D(128, 2, 2, border_mode='valid', activation='relu'))
model.add(Convolution2D(128, 2, 2, activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.25))
model.add(Convolution2D(256, 2, 2, border_mode='valid', activation='relu'))
model.add(Convolution2D(256, 2, 2, activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dropout(0.1))
model.add(Dense(1, activation='sigmoid'))
from quiver_engine import server
server.launch(
model, # a Keras Model
# where to store temporary files generatedby quiver (e.g. image files of layers)
temp_folder='./quiverdata',
# a folder where input images are stored
input_folder='./quiverdata',
# the localhost port the dashboard is to be served on
port=5000
)
I double checked and my images are indeed (30, 30, 3) shaped.
EDIT: changing theano backend to tensorflow fixed the issue for me. I guess it has to do with the channel location diff between both libraries. Line 106-108 of server.py seems to take care of this:
if keras.backend.backend() == 'theano':
#correct for channel location difference betwen TF and Theano
layer_outputs = np.rollaxis(layer_outputs, 0,3)
however, with tensorflow backend the error dissapears. Hope it helps!
I was getting a No data for this layer error. I noticed from the terminal log, the issue was due to the lack of a tmp directory. I made a tmp directory and then was able to load data for the layers.
@rajshah4 solved for me too! Deserves a PR I guess
Switching to Tensorflow & adding a tmp folder solved the issue for me, too.
Duplicate of https://github.com/keplr-io/quiver/issues/11
Hi, I'm just trying to follow your demo with pre-trained VGG-19 model . But I keep getting this error after selecting the layer : No data for this layer
On the terminal, i get the following message : Exception: Error when checking : expected zeropadding2d_input_1 to have shape (None, 3, 224, 224) but got array with shape (1, 3, 3, 224)
Is this a problem due to my images ?
my code : model = VGG_19('vgg19_weights.h5') server.launch(model,input_folder='./input_images')