A machine learning engineer notices that after several convolutional layers, the feature maps have shrunk considerably. Which technique is designed to prevent this shrinkage by preserving the spatial size of the input?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Every time a filter slides across an image without any buffer around the edges, you lose a little bit of size at each pass — the borders just get cut off. Padding fixes that by adding a ring of (usually zero-valued) pixels around the input before convolution, giving the filter enough room to fully cover the edges and keep the output the same size as the input. That's answer B, often called 'same' padding. Increasing stride does the opposite of what we want here — it makes the filter jump further and shrinks the output even more. Max pooling also shrinks feature maps on purpose, it's a downsampling tool, not a size-preserving one. And adding more filters changes the depth of the output (how many feature maps you get), not its height and width. Padding is specifically the tool for keeping spatial dimensions intact.
Full explanation below image
Full Explanation
Padding is the technique used to preserve the spatial dimensions of an input as it passes through a convolutional layer. Without padding, a filter can only be centered on positions where it fully fits within the input, meaning the output feature map is necessarily smaller than the input, with more shrinkage as filter size increases. By adding extra pixels (typically zeros) around the border of the input, 'same' padding ensures the filter can be applied to every original pixel, including those at the edges, resulting in an output feature map with the same height and width as the input (assuming a stride of 1). This is important in deep architectures, since without padding, feature maps would shrink rapidly across many layers, potentially discarding useful spatial information and limiting network depth.
The first distractor, increasing stride, actually has the opposite effect of what's being asked: a larger stride causes the filter to skip more positions between applications, which reduces the output's spatial dimensions rather than preserving them. The second distractor, max pooling, is a deliberate downsampling operation that reduces the spatial resolution of feature maps by taking the maximum value within a window, which is useful for reducing computation and achieving some translation invariance, but it works against dimension preservation rather than for it. The third distractor, increasing the number of filters, affects the depth (number of channels) of the output feature map, since each filter produces its own feature map, but has no effect on the output's height or width.
A useful memory aid: padding answers 'how do I keep the same footprint,' stride and pooling both answer 'how do I shrink the footprint,' and filter count answers 'how many feature maps do I produce.' Keeping these three effects (spatial size via padding/stride, downsampling via pooling, and channel depth via filter count) distinct is essential for correctly computing output shapes in CNN architecture questions.