本文介绍了卷积中的2D stride是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 stride 只是一个整数时,我知道它的含义(您应该通过哪个步骤将过滤器应用于图像).但是 (1, 1) 甚至更多维的 stride 呢?

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 定义了过滤器如何沿输入图像(张量)移动.没有什么可以阻止您以不同的方式沿着不同的轴跨步,例如,stride=[1, 2] 表示沿 0 轴一次移动 1px,沿 1 轴一次移动 2px.这种特殊的组合并不常见,但可能.

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 stride是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 13:03