RSIR Transformer: Hierarchical Vision Transformer using Random Sampling Windows and Important Region Windows

Zhemin Zhang, Xun GongarXiv 2023 · DOI

Abstract

Vision Transformers (ViTs) have revolutionized computer vision but face a fundamental trade-off between global context and computational efficiency. Global self-attention scales quadratically with image resolution, while local window approaches often lack a global view in early layers. We present the RSIR Transformer, which introduces Random Sampling Windows (RS-Win) for global exploration and Important Region Windows (IR-Win) for focused exploitation. By combining these mechanisms, the RSIR Transformer achieves state-of-the-art performance on ImageNet classification, COCO object detection, and ADE20K semantic segmentation with linear complexity.

Introduction

While Vision Transformers have become a standard for many vision tasks, their high computational cost remains a barrier for high-resolution images. Local self-attention models, such as the Swin Transformer, address this by restricting attention to small, fixed windows. However, these models require many layers and complex operations like window shifting to capture global dependencies. The RSIR Transformer aims to provide a more efficient and direct path to global communication by utilizing a hybrid sampling strategy that balances randomness and importance.

Methodology

The core of the RSIR Transformer is the integration of two distinct attention mechanisms that operate in parallel across attention heads.

Random Sampling Windows (RS-Win)

RS-Win addresses the "tunnel vision" of local windows by sampling patches from the entire image based on a uniform distribution. This allows the model to capture global context even in the initial stages of the network, significantly increasing the effective receptive field without the $O(N^2)$ cost of full global attention.

Important Region Windows (IR-Win)

Complementing the exploration of RS-Win, IR-Win focuses on "exploitation." It utilizes an importance map to identify the most salient regions of an image. These high-weight patches are then grouped into windows for concentrated processing, ensuring that the model prioritizes the most informative features for the task at hand.

Visualization of the RSIR sampling mechanism. Green cells represent patches selected via Random Sampling (RS-Win), while orange cells represent patches selected via Important Region sampling (IR-Win) for their respective query points (stars).

Parallel Implementation

The architecture splits its attention heads: half are dedicated to RS-Win and half to IR-Win. The outputs are concatenated, allowing the model to simultaneously learn broad spatial relationships and fine-grained local details.

Experimental Results

The RSIR Transformer was benchmarked against leading models across several standard datasets.

ImageNet-1K Classification

The RSIR-T (Tiny) variant achieved a Top-1 accuracy of 83.9% with 5.0G FLOPs. The RSIR-B (Base) variant reached 85.1%, consistently outperforming Swin and CSWin counterparts.

Object Detection and Segmentation

On the COCO dataset, RSIR-B achieved a 49.2 box mAP, a 0.5-point improvement over the previous state-of-the-art CSWin. For semantic segmentation on ADE20K, the model reached 51.9 SS mIoU, demonstrating its superior ability to handle complex scenes.

Attention heatmap used to generate the importance map for IR-Win, highlighting salient objects like the dog in the foreground.

Data Efficiency

The model showed remarkable robustness on smaller datasets. On Caltech-256, RSIR-T outperformed Swin-T by 5.5%, suggesting that the "random + important" sampling strategy acts as a strong inductive bias that facilitates learning even when training data is limited.

Conclusion

The RSIR Transformer provides a novel solution to the local-global dilemma in Vision Transformers. By combining random exploration with importance-based exploitation, it achieves high efficiency and state-of-the-art performance. Future work will focus on optimizing the sampling operations for specialized hardware to further reduce latency.

Summary updated

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
COCO · object detectionRSIR-Tbox mAP47.6split: val · fine-tuned · detector=Mask R-CNN
Source quote
L279: Results. We compare RSIR Transformer with various backbones, as shown in Table \ref{COCO-Top1}. It shows that the proposed RSIR Transformer variants clearly outperform all the CNN and Transformer counterparts. For object detection, our RSIR-T and RSIR-B achieve 47.6 and 49.2 box mAP for object detection, surpassing the previous best CSWin Transformer by +0.7 and +0.3, respectively. We also achieve similar performance gain on instance segmentation.
COCO · object detectionRSIR-Bbox mAP49.2split: val · fine-tuned · detector=Mask R-CNN
Source quote
L279: Results. We compare RSIR Transformer with various backbones, as shown in Table \ref{COCO-Top1}. It shows that the proposed RSIR Transformer variants clearly outperform all the CNN and Transformer counterparts. For object detection, our RSIR-T and RSIR-B achieve 47.6 and 49.2 box mAP for object detection, surpassing the previous best CSWin Transformer by +0.7 and +0.3, respectively. We also achieve similar performance gain on instance segmentation.
ADE20K · semantic segmentationRSIR-TSS mIoU49.9split: val · fine-tuned · evaluation=single-scale · resolution=224x224 · segmentation-head=UperNet · pretraining-resolution=224×224
Source quote
L292: RSIR-T (ours) │ 57M │ 956G │ 49.9 │ 51.2
ADE20K · semantic segmentationRSIR-BSS mIoU51.9split: val · fine-tuned · evaluation=single-scale · resolution=224x224 · segmentation-head=UperNet · pretraining-resolution=224×224
Source quote
L298: RSIR-B (ours) │ 109M │ 1210G │ 51.9 │ 52.7
BibTeX
@misc{zhang2023rsir,
  author = {Zhemin Zhang and Xun Gong},
  title = {{RSIR Transformer: Hierarchical Vision Transformer using Random Sampling Windows and Important Region Windows}},
  year = {2023},
  eprint = {2304.06250},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.06250},
}
Figure