A convolution kernel is the learned weight tensor behind a filter. It transforms a small patch of an input feature map, then applies that same transformation as the window moves across the image. Instead of looking for a pattern only in one place, the filter produces a response at many locations. section 8.1.1
A filter over an MNIST digit
A Conv2D(64, (3, 3)) layer uses 3 × 3 patches and computes 64 filters. For a (28, 28, 1) MNIST input, the illustrated output is (26, 26, 64). Each output channel is a 26 × 26 response map: it shows where one filter responded. The input’s single channel represents grayscale; the output’s 64 channels represent learned filters, not colors. section 8.1.1
Figure 8.4 How convolution works
Follow one window across the input to see why a single kernel yields responses at multiple locations. section 8.1.1
Keep two layer choices separate:
- Window size determines the size of each local patch; 3 × 3 and 5 × 5 are typical choices. section 8.1.1
- Output depth determines how many filters—and therefore how many response maps—the layer computes. In Keras, these are the arguments in Conv2D(output_depth, (window_height, window_width)). section 8.1.1
What a filter responds to changes through a ConvNet. Earlier filters may detect edges or basic textures; later ones may respond to more abstract concepts. A response map shows *where* a filter responds in an image. To inspect *what pattern* prompts that response, start with a blank image and adjust its pixels to maximize the chosen filter’s activation. section 10.2 section 10.5
Inspecting a trained filter
With a KerasHub Xception model trained on ImageNet, select a Conv2D or SeparableConv2D layer, then make a feature extractor from its output: keras.Model(inputs=model.input, outputs=layer.output). After model-specific image preprocessing, measure one output channel’s mean activation and optimize the input image to increase it. The resulting image illustrates the pattern that filter responds to; it is not the filter’s weight tensor. section 10.2










