CNN Visualizing CNN Feature Maps 2 — Questions and Answers
Question 1: What does a feature map (activation map) represent in a CNN layer?
- The raw pixel values of the input image
- The output of applying a learned filter across the input (Correct answer)
- The gradient of the loss with respect to weights
- The pooled output after max pooling only
Correct answer: The output of applying a learned filter across the input
A feature map is produced by convolving a learned filter over the input, showing where and how strongly that filter's pattern is detected.
Question 2: When visualizing early-layer feature maps, what kind of patterns are typically detected?
- Complex object parts like eyes or wheels
- Abstract semantic concepts
- Low-level patterns like edges, colors, and textures (Correct answer)
- Class probability distributions
Correct answer: Low-level patterns like edges, colors, and textures
Early CNN layers respond to simple, low-level visual features such as oriented edges, color gradients, and basic textures.
Question 3: Which Python library function is commonly used to extract intermediate layer outputs for feature map visualization in Keras?
- model.predict()
- keras.backend.function()
- Model(inputs, intermediate_layer.output) (Correct answer)
- layer.get_weights()
Correct answer: Model(inputs, intermediate_layer.output)
Creating a new Keras Model with the original input and an intermediate layer's output allows you to forward-pass an image and retrieve that layer's activations.
Question 4: If a feature map appears mostly dark (near-zero activations), what does this indicate?
- The filter is perfectly trained
- The filter's learned pattern is not present in the input region (Correct answer)
- The input image is too large
- The layer uses sigmoid activation
Correct answer: The filter's learned pattern is not present in the input region
Near-zero activations mean the convolutional filter did not detect its corresponding pattern in those spatial locations of the input.
Question 5: What is the spatial dimension relationship between an input feature map and output feature map when using a 3×3 filter with padding='same' and stride=1?
- Output is smaller by 2 in each dimension
- Output is the same spatial size as the input (Correct answer)
- Output is larger by 2 in each dimension
- Output size depends only on the number of filters
Correct answer: Output is the same spatial size as the input
With 'same' padding and stride=1, zero-padding is added so the output spatial dimensions exactly match the input dimensions.
Question 6: In a CNN with 64 filters in a convolutional layer, how many feature maps does that layer produce per input image?
- 1
- 64 (Correct answer)
- Depends on input channels
- 128
Correct answer: 64
Each filter produces exactly one feature map, so 64 filters yield 64 feature maps per input sample.
Question 7: What visualization technique overlays a heatmap on the input image to show which regions most influenced a CNN's prediction?
- t-SNE embedding
- Grad-CAM (Gradient-weighted Class Activation Mapping) (Correct answer)
- PCA projection
- Batch normalization statistics
Correct answer: Grad-CAM (Gradient-weighted Class Activation Mapping)
Grad-CAM uses the gradients of the target class flowing into the final convolutional layer to produce a localization heatmap.
What does a feature map (activation map) represent in a CNN layer?