我正在使用 Keras 模型进行训练,但它抛出了错误。
我用 Conv2D 替换了 Convolution2D,但不起作用。
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-99-e85c5751f266> in <module>()
26 model.compile(loss='mse', optimizer=optimizer)
27 return model
---> 28 model = nvidia_model()
29 print(model.summary())
5 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message)
776 for kwarg in kwargs:
777 if kwarg not in allowed_kwargs:
--> 778 raise TypeError(error_message, kwarg)
779
780
TypeError: ('Keyword argument not understood:', 'subsample')
修改后的代码
我目前正在使用 keras 2.2.4 我目前正在使用 keras 2.2.4 我目前正在使用 keras 2.2.4 我目前正在使用 keras 2.2.4
定义 nvidia 模型
def nvidia_model():
model = Sequential()
model.add(Conv2D(24, 5, 5, strides=(2, 2), input_shape=(66, 200, 3), activation='elu'))
model.add(Conv2D(36, 5, 5, strides=(2, 2), activation='elu'))
model.add(Conv2D(48, 5, 5, strides=(2, 2), activation='elu'))
model.add(Conv2D(64, 3, 3, activation='elu'))
model.add(Conv2D(64, 3, 3, activation='elu'))
# model.add(Dropout(0.5))
model.add(Flatten())
model.add(Dense(100, activation = 'elu'))
# model.add(Dropout(0.5))
model.add(Dense(50, activation = 'elu'))
# model.add(Dropout(0.5))
model.add(Dense(10, activation = 'elu'))
# model.add(Dropout(0.5))
model.add(Dense(1))
optimizer = Adam(lr=1e-3)
model.compile(loss='mse', optimizer=optimizer)
return model
model = nvidia_model()
print(model.summary())
RISEBY
江户川乱折腾