当我执行以下代码时,遇到了上述问题。问题的原因是什么?错误语句出现在倒数第二行。 整个过程只使用keras,为什么会出现此问题?
input_tensor = Input(shape=(320, 320, 4))
y = ZeroPadding2D((1, 1))(input_tensor)
y = Conv2D(64, (3, 3), activation='relu', name='conv1_1')(y)
y = ZeroPadding2D((1, 1))(y)
y = Conv2D(64, (3, 3), activation='relu', name='conv1_2')(y)
y = MaxPooling2D((2, 2), strides=(2, 2))(y)
x1 = y
...
y = ZeroPadding2D((1, 1))(y)
y = Conv2D(512, (3, 3), activation='relu', name='conv5_1')(y)
y = ZeroPadding2D((1, 1))(y)
y = Conv2D(512, (3, 3), activation='relu', name='conv5_2')(y)
y = ZeroPadding2D((1, 1))(y)
y = Conv2D(512, (3, 3), activation='relu', name='conv5_3')(y)
y = MaxPooling2D((2, 2), strides=(2, 2))(y)
x5=y
# Decoder
# x = Conv2D(4096, (7, 7), activation='relu', padding='valid', name='conv6')(x)
# x = BatchNormalization()(x)
# x = UpSampling2D(size=(7, 7))(x)
y = UpSampling2D(size=(2, 2))(x5)
y= Conv2D(512, (5, 5), activation='relu', padding='same', name='deconv1_1', kernel_initializer='he_normal',
bias_initializer='zeros')(y)
...
y = BatchNormalization()(y)
y =Conv2D(64, (5, 5), activation='relu',padding='same', name='deconv5_1' ,kernel_initializer='he_normal',
bias_initializer='zeros')(y) +Conv2D(64, (5, 5), activation='relu',padding='same', name='deconv5_2',
kernel_initializer='he_normal',bias_initializer='zeros')(x1)
y = UpSampling2D(size=(2, 2))(y)
y = Conv2D(64, (5, 5), activation='relu', padding='same', name='deconv5_3', kernel_initializer='he_normal',bias_initializer='zeros')(y)
y = Conv2D(64, (5, 5), activation='relu', padding='same', name='deconv1', kernel_initializer='he_normal',bias_initializer='zeros')(y)
y = BatchNormalization()(y)
y = Conv2D(1, (5, 5), activation='sigmoid', padding='same', name='pred', kernel_initializer='he_normal',
bias_initializer='zeros')(y)
model = Model(inputs=input_tensor, outputs=y)
return model