【发布时间】:2019-04-02 22:12:24
【问题描述】:
我想知道是否有可能在通过卷积然后反卷积滤波器传播后得到相同的张量。例如:
random_image = np.random.rand(1, 6, 6, 3)
input_image = tf.placeholder(shape=[1, 6, 6, 3], dtype=tf.float32)
conv = tf.layers.conv2d(input_image, filters=6, kernel_size=[3, 3], strides=(1, 1), data_format="channels_last")
deconv = tf.layers.conv2d_transpose(conv, filters=3, kernel_size=[3, 3], strides=(1, 1), data_format="channels_last")
sess = tf.Session()
sess.run(tf.global_variables_initializer())
print(random_image)
# Get an output which will be same as:
print(sess.run(deconv, feed_dict={input_image: random_image}))
也就是说,如果生成的random_image向量例如是:[1,2,3,4,5],经过卷积和反卷积后deconv向量就是[1,2,3,4,5]。
但是,我无法让它工作。
期待您的回答!
【问题讨论】:
-
定义“相同”。您是在追求完全相同的数组值还是某种视觉相似性?也许您在实际图像上进行测试并分享结果?
-
我的意思是随机图像向量为:
[1,2,3,4,5],经过卷积和反卷积后的输出为:[1,2,3,4,5]。我还根据您的评论更新了问题。 -
有可能获得某种程度的视觉相似性,但数学上的相等性,我猜不是。看看stackoverflow.com/questions/37890989/…
-
感谢您的帮助!这就是我需要的澄清。请随时发布答案,以便我接受它是正确的。
标签: tensorflow conv-neural-network deconvolution