问题描述
我知道stride只是一个整数时的意义(通过此步骤,您应该对图像应用过滤器).但是(1, 1)
甚至更大的跨度又如何呢?
I know what meaning stride has when it is just an integer number (by which step you should apply filter to image). But what about (1, 1)
or even more dimensional stride?
推荐答案
步幅定义滤镜如何沿输入图像(张量)移动.没有什么可以阻止您沿着不同的轴进行不同的跨步,例如,stride=[1, 2]
意味着沿0轴一次移动1像素,沿1轴一次移动2像素.这种特殊的组合并不常见,但有可能.
The stride defines how the filter is moved along the input image (tensor). Nothing stops you from striding along different axes differently, e.g., stride=[1, 2]
means move 1px at a time along 0 axis, and 2px at a time along 1 axis. This particular combination isn't common, but possible.
Tensorflow API更进一步,并允许针对4D输入张量的所有轴进行自定义跨步(请参见 tf.nn.conv2d
).使用此API设置strides=[1, 2, 2, 1]
并不少见,这很有意义:它应该处理每个图像(第一个1
)和每个输入通道(最后一个1
),但对空间进行2x2
跨步方面.就卷积而言,该操作对于任何strides
数组适用,但是值不是同等有用的.
Tensorflow API goes even further and allows custom striding for all axes of the 4D input tensor (see tf.nn.conv2d
). Using this API it's not uncommon to set strides=[1, 2, 2, 1]
, which makes perfect sense: it should process each image (the first 1
) and each input channel (the last 1
), but apply 2x2
striding of the spatial dimensions. As far as the convolution is concerned, the operation is applicable for any strides
array, however not values are equally useful.
强烈推荐本CS231n教程,以获取更多详细信息.
Highly recommend this CS231n tutorial for more detail on this.
这篇关于卷积中2D跨步的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!