ValueError:" Flatten"的输入形状。没有完全定义(得到(0,3,16)

时间:2017-03-20 13:59:29

标签: keras-layer

运行以下模型时:

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()

我收到以下错误:

  

/home/imad/anaconda2/lib/python2.7/site-packages/keras/legacy/interfaces.py:86:UserWarning:更新您对Keras 2 API的Conv2D电话:{{1} }     '`致电Keras 2 API:' +签名)

请帮忙。

1 个答案:

答案 0 :(得分:1)

使用Keras 2.0有接口更改。 请查看以下链接了解更多详情

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