imageInput = Input(image_shape) #often, image_shape is (pixelsX, pixelsY, channels)
floatInput = Input(float_shape) #if one number per image, shape is: (1,)
#Please make sure you use compatible shapes
#You should probably not have spatial dimensions anymore at this point
#Probably some kind of GloobalPooling:
convOut = GlobalMaxPooling2D()(convOut)
#concatenate the values:
joinedOut = Concatenate()([convOut,floatInput])
#or some floatOut if there were previous layers in the float side
1 回答
两个独立的输入:
卷积部分:
如有必要,请执行与其他输入类似的操作 .
加入两个分支:
使用您的联接输出执行更多操作:
使用两个输入创建模型:
火车:
其中
classes
是"one-hot encoded"张量,包含每个图像的正确类别 .但是,没有“一个正确的解决方案” . 你可以尝试很多不同的东西,例如在卷积中间的某处“添加数字”,或者将它相乘,或者在你设法以某种方式连接数值后创建更多的卷积......这就是艺术 .
输入数据
输入和输出数据应为 numpy arrays .
阵列的形状应为:
Keras将从这些形状知道所有必要的东西,所有阵列中的第0行将是图像0,第1行将是图像1,依此类推 .