← Neural NetworksToolsInVisionLearning Center
Convolutional Neural Networks · Lesson 50

Filter Size and Visual Context

Compare CNN filter sizes using a ceramic-inspection example, calculate output dimensions, and see how stacked small filters gather wider context.

Watch the lesson

Filter Size and Visual Context explained visually

2:26

Use fine cracks and wider ceramic patterns to understand local context, filter size, computation, output shape, and receptive fields. Narration has been cleaned; this video contains no added music or background sound.

Lesson overview

What you will learn

Follow filters, pooling, flattening, and classification through complete CNN examples.

  1. Connect filter size with visual context
  2. Balance local detail, context, and computation
  3. Calculate output dimensions with fixed settings
  4. Grow the receptive field with stacked small filters
01

Connect filter size with visual context

A small view of a ceramic plate can reveal a fine crack; a wider view can show how the crack connects to its surroundings. In a convolutional layer, the kernel size specifies the spatial neighborhood used for each output position.

A 3 × 3 kernel covers 9 spatial positions, while a 5 × 5 kernel covers 25. For a standard convolution, each output filter also spans all input channels. Spatial width and channel depth are different dimensions.

02

Balance local detail, context, and computation

Small kernels can detect local patterns such as edges and texture changes. Larger kernels gather information from a wider area within one operation. A larger kernel is not automatically more accurate; the task, data, and full architecture matter.

For a standard convolution with the same input and output channel counts, the number of kernel weights is k × k × input channels × output channels. Biases, if used, add one parameter per output channel. A 5 × 5 kernel therefore has 25 spatial weights per input/output channel pair, compared with 9 for a 3 × 3 kernel.

03

Calculate output dimensions with fixed settings

For this example, use a 10 × 10 input, stride 1, no padding, and no dilation. Each output dimension is input size − kernel size + 1.

A 3 × 3 kernel produces an 8 × 8 feature map because 10 − 3 + 1 = 8. A 5 × 5 kernel produces 6 × 6 because 10 − 5 + 1 = 6. A 7 × 7 kernel produces 4 × 4 because 10 − 7 + 1 = 4.

These results depend on the stated settings. Changing stride, padding, or dilation changes the output-size calculation. Do not apply the simplified formula to other settings without checking its assumptions.

04

Grow the receptive field with stacked small filters

Two consecutive 3 × 3 convolutional layers with stride 1 and no dilation give an interior output position a theoretical 5 × 5 receptive field in the original input. The second layer combines neighboring first-layer responses, and each response already depends on a local patch.

This describes the extent of the input that can influence an output. It does not make the two-layer network identical to a single 5 × 5 convolution, especially when a nonlinear activation separates the layers.

The practical takeaway is to consider local detail, wider context, and computational cost together. The next lesson introduces max pooling and spatial reduction.

Knowledge check

Quick check: test your understanding

How many spatial positions does a 5 × 5 filter cover?

25 spatial positions. In a standard convolution, the filter also extends through the input channels.

What is the output size for a 10 × 10 input and a 3 × 3 filter, with stride 1, no padding, and no dilation?

8 × 8. Each dimension is 10 − 3 + 1 = 8.

Do two 3 × 3 layers behave exactly like one 5 × 5 layer?

No. With stride 1 and no dilation, their theoretical receptive-field extent can be 5 × 5, but their operations and learned functions can differ, especially with an activation between the layers.

Accessible referenceLesson 50 transcript326 words · Matches the published narration and captionsOpen transcript

Imagine inspecting a ceramic plate for damage. A close view may reveal a thin crack. A wider view may show that the crack continues toward the edge of the plate. Both views are useful, but they provide different amounts of context. Convolutional filters work with local regions of an image or a feature map. The filter size determines how many spatial positions the filter examines at each step.

A three by three filter covers nine positions. A five by five filter covers twenty five positions. When the input has several channels, the filter also extends through those channels. Small filters can detect local patterns, such as edges and textures. Larger filters examine a wider region in a single operation. However, a larger filter is not automatically a better filter.

If the number of input and output channels stays the same, a larger filter usually requires more weights and more calculations. Filter size also affects the output dimensions. Imagine an input that is ten pixels wide and ten pixels high. We use a stride of one and no padding.

A three by three filter produces an eight by eight output. A five by five filter produces a six by six output. A seven by seven filter produces a four by four output. These sizes would change if we changed the stride or added padding.

A network can also build wider context by stacking smaller filters. With a stride of one and ordinary spacing between filter positions, two consecutive three by three convolutions have a five by five receptive field. This means that one output can depend on a five by five region of the original input. It does not mean that two small convolutions perform exactly the same calculation as one larger convolution. An activation between the layers adds another difference.

The goal is to balance useful detail, wider context, and computation. In the next lesson, we will explore how max pooling makes a feature map smaller.