4
$\begingroup$
conv = conv_2d (strides=)

I want to know in what sense a non-strided convolution differs from a strided convolution. I know how convolutions with strides work but I am not familiar with the non-strided one.

The given convolutional function is from tflearn, should i just set it to zero or something else?

I am trying to implement pilotNet which I found here.

$\endgroup$
8
$\begingroup$

Stride is the distance between spatial locations where the convolution kernel is applied. In the default scenario, the distance is 1 in each dimension. This is also the default value in Tensor Flow, as @Axel Varanes mentions.

I suppose this is sometimes referred to as non-strided convolution, although that is incorrect: the stride is one. When the stride is larger than one, one usually talks about strided convolution to make the difference explicit.

To visualize the difference:

  • Stride-1 convolution ("non-strided"):

  • Stride-2 convolution ("strided"):

Images from https://github.com/vdumoulin/conv_arithmetic

$\endgroup$
1
$\begingroup$

There's always a stride. The whole idea of convolution is that you stride the window over the input vector, matrix or tensor otherwise.

Stride parameter tells you the length of the step in your stride. By default it's probably 1 in any framework. You can increase the stride (step) length in order to save space or cut calculation time. You'll be foregoing some information when doing so, it's a trade-off between resource consumption (whether it's CPU or memory) and information retrieved.

$\endgroup$
0
$\begingroup$

Applying convolution means sliding a kernel over an input signal outputting a weighted sum where the weights are the values inside the kernel. The stride is the sliding step. You can not have a stride of 0, this would mean not sliding at all. In the paper they use a convolution with a 2X2 stride, the step is 2 in both x and y direction, followed by non-strided convolution, stride 1, step 1. You can observe from fig2 from the paper that the output of a convolution with stride 2 halves the width and height of the input (first 3 conv layer) whereas the output of a convolution with stride 1 (last 2 conv layers) has width = input_width-2 and height = height-2 because the kernel is 3x3.

$\endgroup$
0
$\begingroup$

First of all, there is no such thing as a non-strided convolution. Using the low-level API, the following statement will give an error because every element in strides argument must be greater than zero!

y = tf.nn.conv2d(x, strides=[1, 0, 0, 1]) # error !
y = tf.nn.conv2d(x, strides=[1, 1, 1, 1]) # OK

Note that the first (=sample index) and the last (=channel) dimension must equal to one.

Secondly, when using the TF Layers API, the strides argument has a default value:

tf.layers.conv2d(
    inputs,
    filters,
    kernel_size,
    strides=(1, 1), 
    ...

Note that there are only two entries in the strides tuple which correspond to the second and the third entry in the Layers API. The first and the last dimension are dropped.

So if you haven't set the strides argument, the convolution filters will move with of one pixel by default and I suppose this is what they mean with non-strided convolutions in the paper.

$\endgroup$
  • $\begingroup$ Did you mean that it is not what you want? The sentence using the "with of:" is not proper English. You probably mean "will move just one pixel at a time". $\endgroup$ – Michael R. Chernick Aug 6 '18 at 13:42
  • $\begingroup$ Sorry, that was a typo. I edited the post and hopefully it is clear now. $\endgroup$ – Axel Vanraes Aug 7 '18 at 14:54
  • $\begingroup$ + I think default strides = [1, 1, 1, 1] in TFLearn should be fine in your case $\endgroup$ – Axel Vanraes Aug 7 '18 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy