Convolutional Layers: Finding Features Anywhere
A convolutional layer is like a flashlight sliding over an image, looking for a specific pattern like an edge or corner. It's the core of computer vision, letting networks find features anywhere.
WHY IT EXISTS: Traditional neural networks are inefficient for images. They require too many parameters and ignore the spatial structure of pixels, treating a pixel in the top-left corner the same as one in the bottom-right. Convolutional layers were created to recognize local patterns efficiently, exploiting the fact that nearby pixels are more related than distant ones.
THE MENTAL MODEL: Imagine you have a small magnifying glass that can only see a 3x3 square of pixels. This magnifying glass is a "filter" or "kernel," and it's trained to recognize one specific micro-pattern, like a horizontal edge. A convolutional layer slides this filter across every possible 3x3 patch of the input image. When the filter finds a patch that looks like its target pattern, it records a high value in a new grid, called a "feature map." The network uses hundreds of these filters, each looking for a different pattern.
HOW IT WORKS: The core operation is a convolution. A filter, which is a small matrix of numbers (weights), is placed over a patch of the input image. You multiply the filter's numbers with the corresponding pixel values in the patch and sum the results. This sum becomes a single pixel in the output feature map. The filter then slides over by a certain number of pixels (the "stride") and repeats the process until it has covered the entire image. The network learns the optimal weights for these filters during training.
WHEN TO USE IT: Use convolutional layers for any data with spatial locality, where values near each other are related. This is ideal for images, video (treating time as a dimension), audio spectrograms, and even some time-series data. It's the foundation of modern computer vision for tasks like image classification and object detection.
WHEN NOT TO USE IT: Do not use it for data where feature order is arbitrary, like tabular data (e.g., a spreadsheet of customer information with columns for age, zip code, and last purchase date). The concept of "local patterns" doesn't apply, and a standard fully connected layer is more appropriate.
ONE CANONICAL EXAMPLE: A simple edge detection filter. A 3x3 kernel like [[ -1, -1, -1 ], [ 0, 0, 0 ], [ 1, 1, 1 ]] will produce a high positive value when it slides over a horizontal edge from dark to light, and a high negative value for light to dark. This allows the network to "see" edges, which are the first step to identifying shapes and objects.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.