ViT-CoMer: Vision Transformer with Convolutional Multi-scale Feature Interaction for Dense Predictions

Chunlong Xia, Xinliang Wang, Feng Lv, Xin Hao, Yifeng ShiCVPR 2024

Abstract

While Vision Transformers (ViTs) have achieved remarkable success in various computer vision benchmarks, they often struggle with dense prediction tasks such as object detection and semantic segmentation. This performance gap stems from a lack of inner-patch information interaction and limited diversity in feature scales. To address these challenges without the high cost of specialized pre-training, we present ViT-CoMer. This architecture integrates a plain, pre-trained ViT with a feature-enhanced Convolutional Neural Network (CNN) branch through bidirectional interaction. By injecting spatial pyramid multi-receptive field features into the ViT, ViT-CoMer achieves state-of-the-art results, including 64.3% AP on COCO and 62.1% mIoU on ADE20K, providing a robust and efficient backbone for dense prediction research.

Introduction

Vision Transformers (ViTs) have revolutionized the field of computer vision by leveraging self-attention to capture long-range dependencies. However, when applied to dense prediction tasks—which require pixel-level precision—standard ViTs face two primary hurdles. First, they process images as sequences of patches, often neglecting the fine-grained spatial details within those patches. Second, most plain ViTs maintain a single-scale feature representation, whereas real-world objects appear at vastly different scales.

Existing solutions often involve designing entirely new, vision-specific transformer architectures (e.g., Swin Transformer). While effective, these models require massive computational resources for pre-training. ViT-CoMer offers an alternative: a "pre-training-free" enhancement that allows researchers to use existing, high-quality ViT weights (like those from DINOv2 or BEiTv2) while gaining the multi-scale benefits of a CNN.

The ViT-CoMer Architecture

ViT-CoMer employs a dual-branch strategy that facilitates a bidirectional flow of information between a transformer branch and a convolutional branch. The architecture is defined by two innovative modules:

1. Multi-Receptive Field Feature Pyramid (MRFP)

Located within the CNN branch, the MRFP module utilizes depth-wise convolutions with varying kernel sizes (e.g., 3x3, 5x5, 7x7, and 9x9). This structure allows the model to capture spatial information across multiple scales simultaneously. By doing so, it supplements the transformer's global view with the local, multi-scale "inductive bias" inherent in convolutional layers.

2. CNN-Transformer Bidirectional Fusion Interaction (CTI)

Unlike traditional adapters that merely pass information from a CNN to a Transformer, the CTI module enables a two-way exchange:

  • CNN-to-ViT: Multi-scale features from the CNN branch are injected into the ViT using deformable attention, helping the transformer focus on relevant local details.
  • ViT-to-CNN: Global context captured by the transformer is fed back into the CNN branch, refining the multi-scale representations with high-level semantic understanding.

To ensure stability during training, the authors employ a learnable gating mechanism ($\alpha$). Initialized to zero, this gate allows the model to gradually incorporate features from the randomly initialized CNN branch without disrupting the pre-trained transformer weights.

Experimental Results

ViT-CoMer was rigorously tested across the gold-standard benchmarks for dense prediction: COCO val2017 for detection and ADE20K for segmentation.

State-of-the-Art Performance

  • Object Detection: Using DINOv2 pre-trained weights, ViT-CoMer-L achieved 64.3% AP on COCO val2017. This represents a significant milestone for models not utilizing massive external detection datasets like Objects365.
  • Semantic Segmentation: On the ADE20K benchmark, the model reached 62.1% mIoU, outperforming established adapted backbones such as ViT-Adapter.

Efficiency and Scalability

One of the most compelling findings is the efficiency of the multi-scale interaction. The ViT-CoMer-S (Small) variant, with only 50M parameters, outperformed a standard ViT-L (Large) on detection tasks, despite the latter having nearly six times the parameter count. Furthermore, the ViT-CoMer approach proved versatile, showing performance gains when applied to both plain ViTs and hierarchical models like the Swin Transformer.

Discussion and Limitations

While ViT-CoMer provides a powerful bridge between CNNs and Transformers, it does introduce some overhead. The addition of the CNN branch and the CTI modules increases the total parameter count (e.g., from 44M to 50M in the Small version) and adds architectural complexity compared to a standard ViT. However, the trade-off is a significant boost in accuracy and the ability to leverage existing pre-trained models without the need for expensive re-training.

Conclusion

ViT-CoMer demonstrates that the synergy between convolutional multi-scale features and transformer-based global context is essential for dense prediction. By providing a simple yet effective bidirectional interaction mechanism, ViT-CoMer sets new benchmarks in object detection and semantic segmentation. It serves as a versatile backbone that can adapt existing foundation models for high-precision vision tasks, paving the way for more efficient and capable computer vision systems.

For more information and access to the code, visit the official repository: https://github.com/Traffic-X/ViT-CoMer

Summary updated

BibTeX
@inproceedings{xia2024vit,
  author = {Chunlong Xia and Xinliang Wang and Feng Lv and Xin Hao and Yifeng Shi},
  title = {{ViT-CoMer: Vision Transformer with Convolutional Multi-scale Feature Interaction for Dense Predictions}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  url = {https://openreview.net/forum?id=H18AC67AVL},
}
Figure