ScanFormer: Referring Expression Comprehension by Iteratively Scanning

Wei Su, Peihan Miao, Huanzhang Dou, Xi LiCVPR 2024

Introduction

Referring Expression Comprehension (REC) involves localizing a specific object in an image based on a natural language description. Traditional models often rely on "dense perception," processing every image patch at high resolution. This approach is computationally expensive because the complexity of self-attention in Transformers grows quadratically with the number of visual tokens. Much of this computation is redundant, as large portions of an image are typically irrelevant to the specific linguistic query. ScanFormer addresses this bottleneck by asking: Can we eliminate these irrelevant regions to make the model more efficient without losing accuracy?

The ScanFormer Framework

ScanFormer replaces dense perception with an iterative, "coarse-to-fine" approach that mimics human visual scanning. Instead of processing the entire image at once, it progressively refines its focus on the most informative regions.

The ScanFormer architecture uses a unified Transformer to iteratively process image scales, utilizing a KV cache and MLP-based patch selection to focus on relevant regions.

The framework consists of several key innovations:

  1. Image Scale Pyramid: The input image is represented at multiple resolutions, from coarse to fine.
  2. Iterative Perception: The model starts with the coarsest resolution and predicts which patches are informative based on the text query. It then "zooms in" on these areas in the next scale.
  3. Constant Token Replacement & Merging: To maintain hardware efficiency on GPUs, unselected patches are replaced with a learnable "constant token." These tokens are mathematically merged during the attention mechanism, reducing the workload without altering tensor shapes or breaking parallelization.
  4. Unified Architecture: A single Transformer backbone processes both text and visual modalities together, simplifying the pipeline and improving cross-modal alignment.

Key Results

ScanFormer demonstrates that visual sparsity can lead to significant practical speedups without sacrificing accuracy. On standard benchmarks like RefCOCO, ScanFormer achieved a competitive accuracy of 83.40%.

ScanFormer (red star) achieves a superior balance of accuracy and speed (FPS) compared to existing state-of-the-art REC models.

As shown in the performance comparison, ScanFormer reached an inference speed of 34.9 FPS on an NVIDIA 1080 Ti, making it over twice as fast as comparable models like QRNet. Qualitative analysis confirms that the model successfully ignores background elements like sky or grass, concentrating its computational budget on the target object and its immediate context.

Limitations and Future Outlook

While highly efficient, the current implementation of ScanFormer is optimized for single-target localization. Future work may extend this to "phrase grounding," where multiple objects must be identified simultaneously. Additionally, the authors noted that "early exit" strategies—stopping the scan when confidence is high at a lower resolution—require more robust confidence metrics to be effective in practice. Despite these challenges, ScanFormer provides a powerful bridge between theoretical sparsity and practical hardware acceleration.

Summary updated

BibTeX
@inproceedings{su2024scanformer,
  author = {Wei Su and Peihan Miao and Huanzhang Dou and Xi Li},
  title = {{ScanFormer: Referring Expression Comprehension by Iteratively Scanning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
}
Figure