tensorflow中的padding类型SAME和VALID

SAME:意味着输出的特征图与输入的特征图有相同的空间维度。zero padding被引入使输入图与输出图的形状匹配。

VALID:没有padding

tensorflow中的padding操作适用于卷积和池化操作。

VALID:只会舍弃最右面的列

SAME:均匀地在左右两端加入pad,如果这个列数为奇数,那么则会向最右边加入一个额外的一列。

对于SAME和VALID我们给出两组计算公式,同时适用于池化和卷积操作。

1、对于SAME padding,输出的高度和宽度可以计算为:

out_height = ceil(float(in_height) / float(strides[1]))

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

2、对于VALID padding,输出的高度和宽度可以计算为:

out_height = ceil(float(in_height - filter_height + 1) / float(strides1))

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

猜你喜欢

转载自blog.csdn.net/qq_22152499/article/details/82867163