Visformer: The Vision-friendly Transformer

Zhengsu Chen, Lingxi Xie, Jianwei Niu, Xuefeng Liu, Longhui Wei, Qi Tian · DOI

Introduction

Vision Transformers (ViT) have demonstrated a high performance "upper-bound," outperforming traditional Convolutional Neural Networks (CNNs) when trained on massive datasets with extensive augmentation. However, they often suffer from a low "lower-bound," exhibiting poor training stability and significant performance degradation on smaller datasets or with standard training recipes. Conversely, CNNs like ResNet possess a high "lower-bound" due to inductive biases like locality but may have a lower performance ceiling. Visformer aims to bridge this gap by creating a hybrid architecture that combines the strengths of both paradigms.

Methodology: The Transition Study

The development of Visformer was guided by a systematic "transition study." Starting from a standard DeiT-S (Transformer), the researchers iteratively modified components until the model resembled a ResNet-50 (CNN). This process identified specific design choices that enhance vision performance.

Architectural evolution from a standard Transformer view to the vision-friendly Visformer design.

Key Design Evolutions

  • Stage-wise Hierarchical Design: Unlike the isotropic structure of ViT, Visformer adopts a pyramid-like hierarchy common in CNNs, processing higher resolutions in early stages and lower resolutions in later stages.
  • Selective Self-Attention: Self-attention is computationally expensive at high resolutions. Visformer utilizes 3x3 convolutional bottleneck blocks in early stages to capture local patterns and reserves self-attention for later, low-resolution stages where global context is most beneficial.
  • Normalization and Pooling: The model replaces the NLP-centric classification token ([CLS]) with global average pooling. Furthermore, Batch Normalization is preferred over Layer Normalization for improved stability in this hybrid context.
  • Numerical Stability: To facilitate training in 16-bit precision (FP16) without overflow, a specific normalization factor was introduced for attention scores.

Experimental Results

Visformer was evaluated primarily on ImageNet-1K and COCO 2017. A critical finding was the model's robustness across different training settings. While Transformers are often "elite" performers that require 300 epochs and heavy augmentation, Visformer maintains high accuracy even under "base" settings (90 epochs, light augmentation).

Comparison of FLOPs, parameters, and accuracy across full and partial data regimes for ResNet, DeiT, and Visformer.

As shown in the results, Visformer-S achieves 82.2% top-1 accuracy on ImageNet, surpassing both DeiT-S (80.1%) and ResNet-50 (78.7%). Notably, in low-data regimes (e.g., using only 10% of labels), Visformer-S (58.74%) significantly outperforms DeiT-S (40.41%), demonstrating its superior "vision-friendliness" and efficiency.

Conclusion

Visformer successfully integrates the inductive biases of CNNs with the expressive power of Transformers. By employing a stage-wise design and selective self-attention, it achieves a high performance ceiling while remaining robust to data scarcity and standard training protocols. Future work will focus on optimizing the architecture for real-world GPU throughput and exploring its utility in self-supervised learning tasks.

Summary updated

BibTeX
@inproceedings{chen2021visformer,
  author = {Zhengsu Chen and Lingxi Xie and Jianwei Niu and Xuefeng Liu and Longhui Wei and Qi Tian},
  title = {{Visformer: The Vision-friendly Transformer}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00063},
}
Figure