首页 > 解决方案 > 具有不同大小和颜色深度(RGB 和灰度)的两个输入的神经网络

问题描述

我试图弄清楚如何用两个不同大小的输入构建一个神经网络。

这就是我认为它应该在 tf 中的样子:

# Shape of 3D input [height, width, depth, channels]
input_1 = tf.placeholder(tf.float32, [height, width, depth, 1])
# Shape of 2D input [height, width, channels]
input_2 = tf.placeholder(tf.float32, [height, width, 3])

这些占位符不能合并在一起作为网络的输入,因为它们的形状不同。

我看到将这 2 个输入合并为 1 的唯一方法是将体积的灰度切片附加到彩色图片的 3 个通道。但是,我怀疑这在实际训练网络时会带来好的结果:我想要 2 个损失函数,每个输入一个。

# Shape of 3D input [height, width, depth, channels]
input_1 = [ tf.placeholder(tf.float32, [height, width, 1]) for i in range(0, depth) ]
# Shape of 2D input [height, width, channels]
input_1.append([tf.placeholder(tf.float32, [height, width, 1]) for i in range(0,3)])
input_1 = tf.stack(input_1, axis=-1)

我应该如何构建我的输入来解决这个问题?

标签: pythontensorflow

解决方案


推荐阅读