类型错误:('关键字参数不理解:','子样本')

我正在使用 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())


弑天下
浏览 127回答 2
2回答

RISEBY

它明确表示子样本未知。尝试将“subsample”替换为“strides”,在最新版本的 keras 中,它是这样调用的。

江户川乱折腾

试试这个方法:def nvidia_model():&nbsp; model = Sequential()&nbsp; model.add(Conv2D(24,(5,5), strides=(2, 2), input_shape=(66, 200, 3), activation='elu'))&nbsp; model.add(Conv2D(36, (5,5), strides=(2, 2), activation='elu'))&nbsp; model.add(Conv2D(48, (5,5), strides=(2, 2), activation='elu'))&nbsp; model.add(Conv2D(64, (3,3), activation='elu'))&nbsp;&nbsp;&nbsp; model.add(Conv2D(64, (3,3), activation='elu'))#&nbsp; &nbsp;model.add(Dropout(0.5))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; model.add(Flatten())&nbsp;&nbsp;&nbsp; model.add(Dense(100, activation = 'elu'))#&nbsp; &nbsp;model.add(Dropout(0.5))&nbsp;&nbsp;&nbsp; model.add(Dense(50, activation = 'elu'))#&nbsp; &nbsp;model.add(Dropout(0.5))&nbsp;&nbsp;&nbsp; model.add(Dense(10, activation = 'elu'))#&nbsp; &nbsp;model.add(Dropout(0.5))&nbsp; model.add(Dense(1))&nbsp;&nbsp;&nbsp; optimizer = Adam(lr=1e-3)&nbsp; model.compile(loss='mse', optimizer=optimizer)&nbsp; return modelmodel = nvidia_model()print(model.summary())
打开App,查看更多内容
随时随地看视频慕课网APP