What is a squeeze-and-excitation (SE) block?
A squeeze-and-excitation (SE) block is a lightweight CNN component that learns how important each feature channel is for the current input, then rescales the channels accordingly. It adds *channel attention*: the network can emphasize useful features and reduce less useful ones.
How does an SE block work?
- Squeeze: Apply global average pooling to each channel, turning a feature map of shape
C × H × WintoCsummary values. - Excitation: Pass these values through two small learned layers, typically with ReLU and then sigmoid, to produce one weight between 0 and 1 for each channel. The layers learn relationships between channels.
- Scale: Multiply every spatial value in a channel by that channel's weight. The output keeps the same shape as the input.
Beginner-friendly example
Imagine a flower-recognition CNN with three feature channels that respond to petal edges, leaf texture, and background patterns.
The SE block might produce illustrative channel weights [0.9, 0.7, 0.2] for one image.
- Petal-edge features are multiplied by
0.9. - Leaf-texture features are multiplied by
0.7. - Background-pattern features are multiplied by
0.2.
If a value in the third channel was 10, it becomes 10 × 0.2 = 2. A feature tensor shaped (1, 3, 8, 8) stays (1, 3, 8, 8).
These weights are learned from the input features, not manually selected. Their values above are only an illustration.
Why is it useful?
- Adaptive channel importance: The same convolutional features can be reweighted differently for different images.
- Easy integration: SE blocks can be inserted into CNN architectures such as ResNet to strengthen feature representations, usually with modest extra computation.
Limitation: A standard SE block gives one weight to each *whole channel*; it does not decide which individual pixel locations matter. This makes it channel-wise, not spatial, attention.
PyTorch example: torchvision.ops.SqueezeExcitation(input_channels=64, squeeze_channels=16).
Related: “What is global average pooling in a CNN?”
Research: Squeeze-and-Excitation Networks — Hu et al. (CVPR 2018). Documentation: Torchvision SqueezeExcitation.
Sources & Research References
Learning Sequence
Deep Learning Curriculum
Explore Related Questions
Deepen your understanding across related Deep Learning topics.