Imad Sabbani
Imad Sabbani

Reputation: 11

ValueError: The shape of the input to "Flatten" is not fully defined (got (0, 3, 16)

When run the following model:

l0 = Input(shape=(1, height, width), name='l0')

l1 = Convolution2D(9, 5, 5, border_mode='same', activation='relu', name='l1')(l0)
l1_mp = MaxPooling2D(pool_size=(2, 2), name='l1_mp')(l1)

l2 = Convolution2D(9, 5, 5, border_mode='same', activation='relu', name='l2')(l1_mp)
l2_mp = MaxPooling2D(pool_size=(2, 2), name='l2_mp')(l2)

l3 = Convolution2D(16, 3, 3, border_mode='same', activation='relu', name='l3')(l2_mp)
l3_mp = MaxPooling2D(pool_size=(2, 2), name='l3_mp')(l3)

flat = Flatten(name='flat')(l3_mp)

l4 = Dense(25, activation='relu', name='l4')(flat)

l5 = Dense(n_classes, activation='softmax', name='l5')(l4)

model = Model(input=l0, output=l5)
model.summary()

I get the following error:

/home/imad/anaconda2/lib/python2.7/site-packages/keras/legacy/interfaces.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(9, (5, 5), padding="same", activation="relu", name="l1") '` call to the Keras 2 API: ' + signature)

Please help.

Upvotes: 1

Views: 1305

Answers (1)

Tinto James
Tinto James

Reputation: 121

With Keras 2.0 There are interfaces changes. Please have a look at the below link for more details

https://github.com/fchollet/keras/wiki/Keras-2.0-release-notes

Upvotes: 1

Related Questions