python - 具有不同大小和颜色深度(RGB 和灰度)的两个输入的神经网络
问题描述
我试图弄清楚如何用两个不同大小的输入构建一个神经网络。
一个 3D、灰度体积
一张 2D 彩色图片
这就是我认为它应该在 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)
我应该如何构建我的输入来解决这个问题?
解决方案
推荐阅读
- javascript - MongoDB,如何创建一个空集合?
- scala - 将多个(任意数量)火花 DataFrame 列连接成一个“|” 分隔字符串
- kubernetes - 使用 operator-sdk 或一般部署的 Kubernetes 中的控制器的协调时间是多少?您可以设置自定义时间进行侦察吗?
- reactjs - 如何修复 Uncaught (in promise) SyntaxError: Unexpected end of JSON input?
- reactjs - React Router URL 和文件夹 URL 之间的冲突
- python - 为什么“j”能识别范围的变化,而“i”却不能?
- python - 从大型组合生成器中随机采样
- python - 如何在 Airflow 上运行 Talend .jar 作业?
- firebase - 使用 Firebase Analytics 如何查看特定 iOS 版本的细分?(例如 iOS 11.1.3、iOS 12.2.1)
- gcc - 一个人如何颠倒“int”值的低 8 位的顺序并保持高 8 位相同?