Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Back to Deep Learning Notes
Topic #354

Feature Map

A feature map is the complete output of sliding one filter across an entire input — a 2-D grid where each value represents how strongly that filter's specific pattern was detected at that spatial location.

What a Feature Map Represents

A high value at position \((i,j)\) in a feature map means the filter's pattern (whatever it learned to detect — an edge, a color transition, a texture) is strongly present in the input around that location. A low or negative value means that pattern is largely absent there. Because each filter learns to detect something different, different feature maps within the same layer highlight entirely different aspects of the same input.

From Filters to Stacked Feature Maps

\[ \text{Input}: (C_{\text{in}}, H, W) \quad\xrightarrow{\ \text{layer with } C_{\text{out}} \text{ filters}\ }\quad \text{Output}: (C_{\text{out}}, H', W') \]

Each of the layer's \(C_{\text{out}}\) filters produces one feature map of shape \((H', W')\); stacking all of them together gives the layer's full output tensor, with \(C_{\text{out}}\) now playing the role of "channels" for the next layer — exactly the same shape convention as the original input image, but now representing learned patterns instead of raw pixel color.

Diagram

Input filter 1 → feature map 1 filter 2 → feature map 2 filter 3 → feature map 3

Each filter independently scans the same input, producing its own feature map — stacked together, these become the layer's multi-channel output.

Code — Visualizing a Feature Map's Shape

import torch
import torch.nn as nn

conv = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1)
x = torch.randn(1, 3, 64, 64)   # one 64x64 RGB image
output = conv(x)
print(output.shape)   # torch.Size([1, 16, 64, 64]) -- 16 feature maps, each 64x64

# Each of these 16 "channels" is one filter's feature map
one_feature_map = output[0, 0]   # the first filter's feature map
print(one_feature_map.shape)   # torch.Size([64, 64])

Common Mistakes

  • Assuming every feature map corresponds to something a human could easily interpret visually — this is often true for early layers (edges, colors) but becomes increasingly abstract in deeper layers, where feature maps respond to complex, learned combinations of patterns with no simple visual analog.
  • Confusing a "channel" in the output with a "channel" in the original input (like RGB) — after the first layer, channels represent learned feature maps, not raw color information.

Interview Relevance

Q: "What does one value in a feature map actually represent?" How strongly that filter's learned pattern was detected at that specific spatial location in the input — a high value means the pattern is strongly present there, a low or negative value means it's largely absent. Each filter in a layer produces its own feature map, and the full set of feature maps (stacked as channels) becomes that layer's output.

Practice Question

A convolutional layer has 128 filters and processes a batch of 8 images, each producing 32×32 feature maps. What is the shape of this layer's complete output tensor?

Related DL Notes

Want to go beyond the notes?

Join Coding Hubs School of AI's Deep Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →