小编Wan*_*ang的帖子

对输入图像进行卷积池化后如何计算输出大小

当我通过 tensorflow 教程学习深度 mnist 时,在卷积和池化到输入图像后,我遇到了关于输出大小的问题。在教程中我们可以看到:

W_conv1 = weight_variable([5, 5, 1, 32])
b_conv1 = bias_variable([32])
x_image = tf.reshape(x, [-1,28,28,1])

We then convolve x_image with the weight tensor, add the bias, apply 
the ReLU function, and finally max pool. The max_pool_2x2 method 
will reduce the image size to 14x14.

h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
h_pool1 = max_pool_2x2(h_conv1)
Run Code Online (Sandbox Code Playgroud)

我认为处理输入图像有两个步骤:第一个卷积和第二个最大池?!卷积后,输出大小为(28-5+1)*(28-5+1) = 24*24。那么最大池化的输入大小为 24*24。如果池大小为 2*2,则输出大小为 (24/2)*(24/2) = 12*12 而不是 14*14。那有意义吗?请告诉我有关如何计算卷积和池化后的输出大小的详细信息。非常感谢。下图是一篇论文中CNN的过程。 CNN 过程的图像

我已经明白问题出在哪里了。

def conv2d(x, W):
  return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') …
Run Code Online (Sandbox Code Playgroud)

python tensorflow

6
推荐指数
2
解决办法
3万
查看次数

标签 统计

python ×1

tensorflow ×1