[英]Concatenate flatten layer with input layer
我正在尝试连接几个展平层和一个输入层:
navigation_flatten = Flatten()(navigator_conv)
# speed is float (0.0-1.0)
speed_input = keras.layers.Input(shape=(1,))
images_output = Concatenate()([dashcam_flatten, navigation_flatten])
image_and_speed = Concatenate()([speed_input, images_output])
并检查输出形状等:
model = keras.models.Model([Dashcam_input, RADAR_INPUT], image_and_speed)
model.compile(loss=MSE,
optimizer=keras.optimizers.Adam(lr=0.0001),
metrics=['accuracy'])
print(model.summary())
并得到这个错误:
ValueError:图形断开连接:无法在“input_3”层获得张量 Tensor("input_3:0", shape=(?, 1), dtype=float32) 的值。 访问以下先前层没有问题:['input_2', 'batch_normalization_2', 'input_1', 'conv2d_8', 'batch_normalization_1', 'max_pooling2d_4', 'conv2d_1', 'batch_normalization_3', 'conv2d_2', 'conv2d' 'conv2d_3', 'batch_normalization_4', 'max_pooling2d_1', 'conv2d_10', 'conv2d_4', 'batch_normalization_5', 'conv2d_5', 'conv2d_11', 'max_pooling2d_2', '6,2d_conv2d_2d_conv2d', '6_conv2d_2d_conv2d_normalization' ', 'max_pooling2d_5', 'max_pooling2d_3', 'flatten_1', 'flatten_2']
如何将扁平层与输入层正确连接?
问题是您没有将speed_input
包含到模型的输入中。 添加它将解决问题:
model = keras.models.Model([Dashcam_input, RADAR_INPUT, speed_input], image_and_speed)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.