cbam
**CBAM** (Convolutional Block Attention Module) is a **dual attention mechanism that applies both channel attention and spatial attention sequentially** — first recalibrating "what" features are important (channel), then "where" they are important (spatial).
**How Does CBAM Work?**
- **Channel Attention**: Like SE but uses both global avg pooling and max pooling: $M_c = sigma(MLP(AvgPool(F)) + MLP(MaxPool(F)))$.
- **Spatial Attention**: $M_s = sigma(Conv([AvgPool_c(F'); MaxPool_c(F')]))$ — 7×7 conv on channel-pooled features.
- **Sequential**: Channel attention first, then spatial attention: $F'' = M_s otimes (M_c otimes F)$.
- **Paper**: Woo et al. (2018).
**Why It Matters**
- **Complementary**: Channel attention (what) + spatial attention (where) captures richer information than either alone.
- **Lightweight**: Small computational overhead for consistent accuracy improvement.
- **Plug-and-Play**: Can be inserted into any CNN architecture at any stage.
**CBAM** is **the "what" and "where" attention module** — teaching networks to focus on the right features in the right locations.