ValueError: It seems that you are using the Keras 2 and you are passing both `kernel_size` and `stri

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012193416/article/details/88092816

ValueError: It seems that you are using the Keras 2 and you are passing both `kernel_size` and `strides` as integer positional arguments. For safety reasons, this is disallowed. Pass `strides` as a keyword argument instead.

在 keras 中写 conv 出现了这个错误,因为在 keras 1.0 和keras 2.0 在api上有些变化:

keras 1.0:

 x = Convolution2D(nb_filters, 3, 3, activation="relu", border_mode='same', W_regularizer=l2(weight_decay),bias=False, init='he_uniform')(ip)

keras 2.0:

x = Conv2D(nb_filters, (3, 3), activation='relu', padding='same', kernel_regularizer=l2(weight_decay),use_bias=False, kernel_initializer='he_normal')(ip)

尤其是 stride ,在 2.0 中要用 () 包起来

猜你喜欢

转载自blog.csdn.net/u012193416/article/details/88092816
You