tensorflow - Tensorflow/Keras - 从通道重新组装 RAW
问题描述
我在 RAW 图像 (RGGB) 中使用 tensorflow 训练 CNN。我的客户要求神经网络在没有任何后处理的情况下重新组装输出图像,因此不能对输出做任何事情。这是输入:
input_img = Input(shape=(None, None, 1), name='input') # 1 channel RAW image
separate = tf.stack([input_img[:, 0::2, 0::2, 0],
input_img[:, 0::2, 1::2,0],
input_img[:, 1::2, 0::2, 0],
input_img[:, 1::2, 1::2, 0]], axis=3) # separate in four channels and stack them in a single tensor
model = Conv2D(filters=filters, kernel_size=(3,3), strides=(1,1), padding='same')(separate) # from here there are several CNN layers and other stuff.
我的神经网络的输出如下:
# 4 channels representing RGGB
model = Conv2D(filters=4, kernel_size=(3,3), strides=(1,1), padding='same', activation="sigmoid")
我尝试使用 reshape 如下:
output = tf.keras.layers.Reshape((height, width, 1))(model)
但它没有用。在这种情况下,我如何对 RAW 图像进行巧妙的重塑,使其恢复到与输入相同的形状,并且每种颜色的位置都在正确的位置?
问候!
解决方案
推荐阅读
- python - 在不使用 for 循环的情况下获取带有数字的用户名
- biztalk - BizTalk WCF-自定义行为扩展未显示
- android - GPS不准确时如何计算可能位置的面积(如在谷歌地图中)
- c - 为什么我的 head->node 为 NULL 但我的链表充满了数据,有时 foo 循环有效,有时不在链表中。AMONG_US 游戏
- node.js - 错误:监听EADDRINUSE:地址已在使用3000;
- javascript - 如何从 w3schools 向多步表单添加验证
- php - Google People API(如何使用 API 密钥进行身份验证)
- android - androidTest错误AAPT:错误:属性android:forceQueryable未找到
- unity3d - 输入字段在 Windows 构建版本上不起作用
- command - 从首选应用程序中的 DFileManager 启动路径中删除 file:// 前缀