Conv2Former: A Simple Transformer-Style ConvNet for Visual Recognition

Qibin Hou, Cheng-Ze Lu, Ming-Ming Cheng, Jiashi Feng

Introduction

Vision Transformers (ViTs) have redefined visual recognition by leveraging self-attention to capture global dependencies. However, the quadratic computational complexity of self-attention relative to image resolution remains a significant bottleneck. While modernized convolutional networks (ConvNets) like ConvNeXt have attempted to bridge this gap, they often fail to fully exploit the benefits of very large receptive fields, with performance typically saturating at kernel sizes beyond $7 \times 7$.

Conv2Former introduces a streamlined, hierarchical ConvNet that replaces complex self-attention with a more efficient "convolutional modulation" operation. This approach captures the spatial re-weighting strengths of Transformers while maintaining the linear-complexity advantages of convolutions.

Methodology

Convolutional Modulation

The primary innovation of Conv2Former is the Convolutional Modulation Block. In traditional Transformers, spatial dependencies are modeled through a Query-Key ($QK^T$) similarity matrix. Conv2Former simplifies this by generating a spatial weight map ($A$) using a large-kernel depthwise convolution on a projected version of the input. This weight map is then applied to the value representation ($V$) via an element-wise Hadamard product.

Comparison between traditional self-attention (left) and the proposed convolutional modulation (right).

This mechanism effectively treats attention as a modulation process. By using depthwise convolutions to generate weights, the model avoids the $N \times N$ attention matrix, ensuring that computational complexity grows linearly with the number of pixels. Notably, the authors found that removing activation and normalization layers immediately before the Hadamard product improved performance, allowing for "raw" feature modulation.

Hierarchical Architecture

Conv2Former adopts a standard four-stage hierarchical (pyramid) structure. As the network progresses, the spatial resolution is reduced via patch embedding layers while the channel dimension increases. This design allows the model to be easily integrated into various downstream tasks like object detection and segmentation.

The hierarchical architecture of Conv2Former, showing the progression through four stages with decreasing resolution and increasing channel depth.

Unlike previous ConvNets, Conv2Former scales effectively with kernel sizes. While an $11 \times 11$ kernel is used by default, the architecture demonstrates continued performance gains with kernels as large as $21 \times 21$, suggesting that modulation is a superior way to utilize large receptive fields compared to standard additive residual blocks.

Key Results and Insights

Conv2Former achieves state-of-the-art results across multiple benchmarks, demonstrating high efficiency and scalability:

  • ImageNet-1K: Conv2Former-T (27M parameters) achieves 83.2% top-1 accuracy, outperforming both ConvNeXt-T (82.1%) and Swin-T (81.5%).
  • Object Detection (MS COCO): Within a Mask R-CNN framework, Conv2Former-T reaches 48.0 AP, a significant improvement over Swin-T's 46.0 AP.
  • Semantic Segmentation (ADE20k): Conv2Former-L achieves a 54.3% mIoU, surpassing the Large variants of both Swin and ConvNeXt.
  • Efficiency: The "Nano" variant (Conv2Former-N) matches the performance of the much larger Swin-T while utilizing significantly fewer FLOPs.

Conclusion

Conv2Former demonstrates that the core benefit of self-attention—spatial feature modulation—can be achieved more efficiently through correctly structured convolutions. By simplifying the block design and embracing large kernels, Conv2Former provides a powerful and scalable alternative to both traditional ConvNets and modern Transformers. Future work may explore hybrid architectures that combine this modulation block with lightweight attention mechanisms to further push the boundaries of visual recognition.

Summary updated

BibTeX
@article{hou2022conv,
  author = {Qibin Hou and Cheng-Ze Lu and Ming-Ming Cheng and Jiashi Feng},
  title = {{Conv2Former: A Simple Transformer-Style ConvNet for Visual Recognition}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2022},
}
Figure