Vision Transformer with Progressive Sampling

Xiaoyu Yue, Shuyang Sun, Zhanghui Kuang, Meng Wei, Philip H. S. Torr, Wayne Zhang, Dahua LinOxford 2021

TL;DR

This paper introduces PS-ViT, a Vision Transformer variant that addresses the limitations of naive image tokenization by employing a novel, differentiable "progressive sampling" strategy. This approach allows the model to iteratively focus on discriminative regions of an image, leading to improved accuracy and efficiency compared to standard ViT and DeiT, especially when trained from scratch.

What Problem Does This Paper Address?

The Vision Transformer (ViT) revolutionized computer vision by adapting the powerful Transformer architecture, originally designed for natural language processing, to image tasks. However, ViT's initial approach of dividing images into fixed-size patches (tokenization) has significant drawbacks. This "hard splitting" can break up semantically coherent object parts, assign tokens to irrelevant background areas, and introduce noise. Furthermore, the quadratic complexity of Transformers with respect to the number of tokens makes them computationally expensive for high-resolution images. This paper aims to overcome these limitations by developing a more intelligent and adaptive way to select image regions for processing.

Methods

The core innovation is the Progressive Sampling Module (PSM). Instead of fixed patches, PSM iteratively samples image regions. At each iteration:

  1. Feature Extraction: A convolutional backbone (ResNet-based) extracts a dense feature map from the input image.
  2. Iterative Sampling: The PSM takes the feature map and the sampling locations from the previous iteration. It uses a Transformer encoder layer to process these features and predict offsets.
  3. Location Update: These predicted offsets are used to update the sampling locations for the next iteration, effectively guiding the model to focus on more informative areas.
  4. Differentiable Process: Crucially, this entire sampling process is differentiable, allowing it to be trained end-to-end with the rest of the network.

The PSM is integrated into a standard Vision Transformer architecture. The sampled tokens from the PSM are then fed into a Vision Transformer module for classification. This approach mimics how human vision selectively focuses attention on salient parts of a scene.

Datasets

  • ImageNet 2012: Used for training and evaluating image classification models. Experiments were conducted both with and without pre-training on large-scale datasets.
  • CIFAR-10, CIFAR-100, Flowers-102, Stanford Cars: Used for transfer learning experiments to demonstrate the generalization ability of PS-ViT.

Key Insights and Ideas

  • Adaptive Tokenization is Key: The paper strongly suggests that fixed, grid-based tokenization is a bottleneck for Vision Transformers. An adaptive, iterative sampling strategy that mimics human visual attention can significantly improve performance.
  • Differentiable Attention for Location Selection: Making the sampling process differentiable is critical. This allows the model to learn where to look based on the task objective, rather than relying on hand-crafted rules or reinforcement learning.
  • Efficiency Gains: By focusing on discriminative regions, PS-ViT can achieve comparable or better accuracy with significantly fewer parameters and FLOPs compared to existing ViT and DeiT models.
  • Structure Preservation: The progressive sampling helps to preserve object structures by avoiding arbitrary splits and focusing on semantically meaningful parts.

Key Results

  • ImageNet Performance: When trained from scratch on ImageNet, PS-ViT-B/18 achieved 82.3% top-1 accuracy, outperforming the baseline DeiT-B by 0.5% while using approximately 4x fewer parameters and 2x fewer FLOPs.
  • Efficiency: PS-ViT-B/14 was shown to be 2.0 times faster and have 3.3 times fewer FLOPs than DeiT-B at comparable accuracy levels. Compared to ViT-B/16, PS-ViT-B/10 was 13.7 times faster and had 16.9 times fewer FLOPs, while improving accuracy by 2.7%.
  • Transfer Learning: PS-ViT models performed on-par with or better than DeiT-B on downstream tasks like CIFAR-10/100, Flowers-102, and Stanford Cars, with significantly fewer FLOPS and parameters.
  • Ablation Studies: The number of sampling points (n) and iterations (N) were found to be important hyperparameters, with optimal values identified through experiments. Weight sharing across sampling iterations was also shown to reduce parameter count with minimal performance loss.

Limitations and Future Work

  • Hyperparameter Sensitivity: The performance of PS-ViT is influenced by hyperparameters like the number of sampling points (n) and iterations (N). While optimal values were found, further exploration might be beneficial.
  • Computational Cost of Iterations: Although more efficient than standard ViT, the iterative nature of PSM still adds computational overhead compared to a single-pass approach.
  • Future Work: The authors suggest exploring PS-ViT for other vision tasks beyond classification, such as object detection and segmentation, where adaptive region selection could be even more impactful. They also mention the potential for further efficiency gains through architectural optimizations.

Summary updated

BibTeX
@inproceedings{yue2021vision,
  author = {Xiaoyu Yue and Shuyang Sun and Zhanghui Kuang and Meng Wei and Philip H. S. Torr and Wayne Zhang and Dahua Lin},
  title = {{Vision Transformer with Progressive Sampling}},
  booktitle = {Oxford},
  year = {2021},
  url = {https://openreview.net/forum?id=2zOr9ENBgM},
}
Figure