๐Ÿ”ฅLimited Offer: Get 50% OFFon AI & Full Stack Courses๐Ÿ”ฅ
Back to Deep Learning Notes
Topic #165

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?

Want to go beyond the notes?

Join CodingNow 2.0's Deep Learning course โ€” live mentorship, real projects, and 100% placement support.

Enroll Now โ€” Free Demo Available

Feature Map โ€“ FAQs

Quick answers about learning Feature Map in Deep Learning.

This free note from CodingNow 2.0 explains Feature Map in Deep Learning โ€” concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Deep Learning topic on CodingNow 2.0, including Feature Map, is 100% free with no signup required.
With focused practice, most students grasp Feature Map in 1โ€“3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) โ€” expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now