Abstract
Object detection is a central downstream task used to test if pre-trained network parameters confer benefits, such as improved accuracy or training speed. The complexity of object detection methods can make this benchmarking non-trivial when new architectures, such as Vision Transformer (ViT) models, arrive. These difficulties (e.g., architectural incompatibility, slow training, high memory consumption, unknown training formulae, etc.) have prevented recent studies from benchmarking detection transfer learning with standard ViT models. In this paper, we present training techniques that overcome these challenges, enabling the use of standard ViT models as the backbone of Mask R-CNN. These tools facilitate the primary goal of our study: we compare five ViT initializations, including recent state-of-the-art self-supervised learning methods, supervised initialization, and a strong random initialization baseline. Our results show that recent masking-based unsupervised learning methods may, for the first time, provide convincing transfer learning improvements on COCO, increasing box AP up to 4% (absolute) over supervised and prior self-supervised pre-training methods. Moreover, these masking-based initializations scale better, with the improvement growing as model size increases.
Introduction
For nearly a decade, Convolutional Neural Networks (CNNs) like ResNet have been the undisputed backbone of object detection. When Vision Transformers (ViTs) arrived, they dominated image classification but proved difficult to adapt for detection tasks. The challenges were primarily three-fold: the quadratic memory cost of self-attention at high resolutions, the architectural mismatch between single-scale ViTs and multi-scale Feature Pyramid Networks (FPN), and a lack of established training recipes for detection.
This work establishes a robust, "plug-and-play" protocol for using standard ViTs as backbones for object detection. By employing a modernized training recipe and simple architectural adapters, we demonstrate that standard ViTs can outperform traditional CNNs, revealing that masking-based pre-training (such as MAE and BEiT) is significantly more effective and scalable than supervised learning for downstream detection.
Methodology
We propose a minimalist approach to integrating standard ViTs into the Mask R-CNN framework without redesigning the transformer to be hierarchical.
- Multi-scale Adaptors: Simple upsampling and downsampling modules are applied to intermediate ViT blocks to generate the multi-scale features required by an FPN.
- Windowed Attention: To manage memory consumption at high resolutions (e.g., $1024 \times 1024$), we utilize "windowed" self-attention within local $14 \times 14$ patches for most layers. Global information flow is maintained by keeping full global attention in four blocks spaced throughout the network.
- Modernized Training: We adopt an upgraded training formula including Large-Scale Jitter (LSJ) augmentation, the AdamW optimizer, and "Drop Path" regularization, which allows even from-scratch training to be competitive.
Key Results and Insights
Our benchmarking on the COCO 2017 dataset reveals several critical insights regarding ViT initializations:
The Masking Advantage
The most significant finding is that masking-based pre-training (MAE and BEiT) provides a substantial leap in performance. For the first time, unsupervised pre-training convincingly outperforms supervised pre-training for detection, adding up to 4% $AP^{box}$. Using a ViT-L backbone with MAE pre-training, the model achieves a state-of-the-art 53.3 $AP^{box}$ on COCO.
Scaling and Convergence
The performance gap between masking-based methods and other initializations widens as model size increases from ViT-Base to ViT-Large. Furthermore, pre-trained models converge roughly 4x faster than those trained from scratch. Error analysis using the TIDE toolbox indicates that masking-based models significantly reduce "missed" detections and localization errors compared to supervised or contrastive (MoCo) models.
Simplicity and Baselines
Our results suggest that complex, specialized transformer architectures are not strictly necessary for high-performance detection. A "plain" ViT with simple adapters is highly effective when paired with the right training recipe. Notably, with modern augmentations, training from scratch can outperform supervised pre-training, highlighting how traditional supervised pre-training may limit a model's downstream potential.
Limitations
Despite their high accuracy, ViTs currently face challenges regarding inference speed. A ViT-L backbone runs at approximately 2.5 frames per second (fps) on a V100 GPU, significantly slower than the 13.7 fps achieved by a ResNet-101. Additionally, performance is highly sensitive to hyperparameters like the "Drop Path" rate, requiring careful tuning for different model scales.
Summary updated