我有一个Unet模型,其中输入是图像(m * n * 3)。现在,我有两个图像,我想使用Unet提取特征并构建模型。代码是:
model = Unet(
backbone_name='resnet101',
# input_shape=(HEIGHT,WIDTH,CHANNELS),
input_shape=(None, None, 3),
encoder_weights=None,
classes=6,
activation='softmax',
)
img_input = keras.layers.Input(shape=(None, None, 6))
img1 = img_input[:, :, :, :3]
img2 = img_input[:, :, :, 3:]
features = model.layers[-4]
featuresModel = keras.Model(model.input, features.output)
feature1 = featuresModel(img1)
feature2 = featuresModel(img2)
imgFeature = keras.layers.Concatenate()([feature1, feature2])
x = keras.layers.Conv2D(1, (3,3), padding='same', name='merge_final_conv', activation='sigmoid')(imgFeature)
finalModel = keras.Model(img_input, x)
img_input的大小为m * n * 6,表示两个图像(m * n * 3)。因此,我将img_input分为两个图像(img1,img2)。然后,我将要素提取为feature1,feature2。
但是,当我想从img_input到x建立模型时,会出现错误:
'NoneType' object has no attribute '_inbound_nodes'
我的代码有什么问题?