我正在使用顺序keras API构建CNN模型,但是在第12行(model.add(UpSampling2D((2, 2), padding='same')))
上遇到以下错误
TypeError: ('Keyword argument not understood:', 'padding')
我正在使用Keras 2.2.4和Tensorflow 1.12.0
关于为什么发生这种情况的任何想法吗?
我的代码是:
# Fit regression DNN model
print("Creating/Training CNN")
model = Sequential()
model.add( Conv2D(16, (3, 3), input_shape=(128,128,1), activation='relu', padding = 'same') )
model.add(MaxPooling2D((2, 2), padding='same'))
model.add( Conv2D(8, (3, 3), activation='relu', padding='same') )
model.add(MaxPooling2D((2, 2), padding='same'))
model.add( Conv2D(8, (3, 3), activation='relu', padding='same') )
model.add(MaxPooling2D((2, 2), padding='same', name = 'grab_that'))
model.add( Conv2D(8, (3, 3), activation='relu', padding='same') )
model.add(UpSampling2D((2, 2), padding='same'))
model.add( Conv2D(8, (3, 3), activation='relu', padding='same') )
model.add(UpSampling2D((2, 2), padding='same'))
model.add( Conv2D(16, (3, 3), activation='relu', padding='same') )
model.add(UpSampling2D((2, 2), padding='same'))
model.add( Conv2D(1, (3, 3), activation='sigmoid', padding='same') )
model.compile(optimizer='adadelta', loss='binary_crossentropy', metrics=[binary_accuracy])
history = model.fit(data_train,data_train,verbose=1,epochs=1)