Skip to main content
Crowdfunding
Python + AI for Geeks
Practice

Adjusting Convolution Operation with Strides

In CNNs, stride refers to the step size by which the filter (kernel) moves during the convolution operation.

Increasing the stride value extracts the features of the image in coarser units, while a smaller value allows learning more detailed features.


How do strides work?

Strides determine how many cells the filter moves at a time while scanning an image.

By default, a stride=1 means the filter moves one cell at a time, whereas stride=2 means it moves two cells at a time.

The behavior of the stride value is as follows:

  • Stride=1: The filter moves one cell at a time, analyzing every region in detail. This allows for the extraction of many features but increases computation.

  • Stride=2: The filter moves two cells at a time, analyzing features more broadly. This reduces computation but may result in the loss of detailed features.

  • Larger stride values (e.g., 3~4): Computation decreases sharply, but there is a higher chance of missing smaller features of the image.


What are the effects of adjusting strides?

Strides have a direct impact on the output size of the convolution operation.

A larger stride results in a smaller output size, while a smaller stride results in a larger output size.

This allows for control over the CNN's memory usage and learning speed.

Additionally, a larger stride may focus on extracting only significant features of an image, which can be advantageous for learning overall patterns of objects.

Conversely, using a smaller stride allows for more precise learning of detailed patterns.


When are strides used?

The setting of strides depends on the model's objectives.

  • Using small strides (1~2) allows learning of high-resolution features, making it suitable for models requiring precise analysis, such as facial recognition.

  • Utilizing larger strides (2~3 or more) reduces computation and quickly analyzes overall patterns, which is beneficial for real-time object detection or simple image classification models.

In CNNs, strides are adjusted alongside filter sizes and are a key factor in determining how finely or efficiently features are learned.

In the next lesson, we will delve into padding which is often used in conjunction with strides.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.