当我尝试运行build_model
def Conv3d_BN(x, nb_filter, kernel_size, strides=1, padding='same', name=None):
x = Conv3D(nb_filter, kernel_size, padding=padding, data_format='channels_first', strides=strides,
activation='relu')(x)
x = BatchNormalization()(x)
return x
def identity_Block(inpt, nb_filter, kernel_size, strides=1, with_conv_shortcut=False):
x = Conv3d_BN(inpt, nb_filter=nb_filter, kernel_size=kernel_size, strides=strides, padding='same')
x = Conv3d_BN(x, nb_filter=nb_filter, kernel_size=kernel_size, padding='same')
if with_conv_shortcut:
shortcut = Conv3d_BN(inpt, nb_filter=nb_filter, strides=strides,
kernel_size=kernel_size)
x = Dropout(0.2)(x)
x = add([x, shortcut])
return x
else:
x = add([x, inpt])
return x
def build_model(inp_shape, k_size=3):
data = Input(shape=inp_shape)
print ("data", bk.int_shape(data))
conv1 = identity_Block(32, (3, 3,3), activation='relu', padding='same',data_format='channels_last')(data)
.....
我收到此错误
identity_Block()获得了意外的关键字参数“激活”
当我添加activation= 'relu'
和padding='same',data_format='channels_last'
我收到此错误
TypeError:identity_Block()至少接受3个参数(给定5个参数)
答案 0 :(得分:0)
您必须在activation
中添加另一个参数def identity_Block()
而且您只需要传递3个变量的值:inpt
,nb_filter
和kernel_size
,其他变量已经具有值1和False