卷积网络中卷积和池化之后,图像的尺寸变化

在卷积和和池化的过程中存在着两种对图像的处理形式:

这里写图片描述
在这个例子中:
输入跨度为13
滤波器宽度为6
步幅为5

“VALID”:只会丢掉最右边的列(或最底部的行)
“SAME”:尝试向左或右均匀填充,但如果添加的列数是奇数,它将向右添加偶数,向左侧添加奇数个列(向下添加偶数个列,向上添加奇数个列)

在 tensorflow 中,tf.nn.conv2d函数和tf.nn.max_pool函数,尺寸变化:
对于SAME填充,输出高度和宽度计算如下:
out_height = ceil(float(in_height)/ float(strides [1]))

out_width = ceil(float(in_width)/ float(strides [2]))

对于VALID填充,输出高度和宽度计算如下:
out_height = ceil( float(in_height - filter_height + 1)/ float(strides[1]))

out_width = ceil( float(in_width - filter_width + 1)/ float(strides [2]))

猜你喜欢

转载自blog.csdn.net/feng_jiakai/article/details/81077773