Skip to main content
QUICK REVIEW

[Paper Review] Towards In-context Scene Understanding

Ivana Balažević, David Steiner|arXiv (Cornell University)|Jun 2, 2023
Multimodal Machine Learning ApplicationsComputer Science6 citations
TL;DR

This paper introduces Hummingbird, a vision transformer model pre-trained with a novel contextual pretraining protocol that enhances feature representations for in-context learning via nearest neighbor (NN) retrieval. By leveraging cross-image attention and spatial attention pooling, Hummingbird achieves state-of-the-art zero-shot performance on dense scene understanding tasks like semantic segmentation and depth estimation without fine-tuning, approaching the accuracy of task-specific finetuned models while enabling rapid, data-efficient adaptation to new tasks.

ABSTRACT

In-context learning$\unicode{x2013}$the ability to configure a model's behavior with different prompts$\unicode{x2013}$has revolutionized the field of natural language processing, alleviating the need for task-specific models and paving the way for generalist models capable of assisting with any query. Computer vision, in contrast, has largely stayed in the former regime: specialized decoders and finetuning protocols are generally required to perform dense tasks such as semantic segmentation and depth estimation. In this work we explore a simple mechanism for in-context learning of such scene understanding tasks: nearest neighbor retrieval from a prompt of annotated features. We propose a new pretraining protocol$\unicode{x2013}$leveraging attention within and across images$\unicode{x2013}$which yields representations particularly useful in this regime. The resulting Hummingbird model, suitably prompted, performs various scene understanding tasks without modification while approaching the performance of specialists that have been finetuned for each task. Moreover, Hummingbird can be configured to perform new tasks much more efficiently than finetuned models, raising the possibility of scene understanding in the interactive assistant regime.

Motivation & Objective

  • To enable in-context learning for dense computer vision tasks such as semantic segmentation and depth estimation, which traditionally require task-specific fine-tuning.
  • To develop a pretraining protocol that produces representations suitable for non-parametric retrieval, enabling fast adaptation without parameter updates.
  • To investigate whether self-supervised vision models can achieve strong zero-shot performance on dense scene understanding tasks using only prompt-based retrieval.
  • To compare the effectiveness of different pretraining objectives and architectural components in enabling retrieval-based scene understanding.
  • To demonstrate that a single generalist model can efficiently adapt to new vision tasks via prompt engineering, reducing reliance on costly fine-tuning.

Proposed method

  • Proposes a new pretraining protocol called contextual pretraining, which applies cross-image attention by updating each image’s spatial features using a memory bank of features from other images.
  • Introduces spatial attention pooling to summarize the contextualized feature grid into a single image-level representation, improving representation quality for downstream retrieval.
  • Uses a contrastive self-supervised objective enhanced by retrieval-based supervision, where the model learns to retrieve correct features from a memory bank of annotated examples.
  • Employs a dual-memory mechanism: a pretraining memory bank for feature retrieval during self-supervision and an evaluation memory bank for inference via nearest neighbor search.
  • Applies nearest neighbor retrieval at inference time using the encoder’s features, enabling zero-shot adaptation to new tasks without any model updates.
  • Trains the model on ImageNet-22k using ViT-B and ViT-L encoders, with ablations on memory bank size, sampling strategies, and pretraining objectives.
Figure 1: In-context scene understanding with nearest neighbor retrieval. On the left, we provide the system with a “prompt” of annotated images. On the right, we ask the system to describe new query images. The network computes dense features for each location and uses them to query features comput
Figure 1: In-context scene understanding with nearest neighbor retrieval. On the left, we provide the system with a “prompt” of annotated images. On the right, we ask the system to describe new query images. The network computes dense features for each location and uses them to query features comput

Experimental results

Research questions

  • RQ1Can vision transformers be pre-trained to support in-context learning for dense scene understanding tasks like semantic segmentation and depth estimation?
  • RQ2How does contextual pretraining with cross-image attention improve zero-shot retrieval performance compared to standard self-supervised pretraining?
  • RQ3What is the impact of spatial attention pooling versus global pooling or [CLS] tokens on retrieval-based scene understanding?
  • RQ4To what extent does retrieval-based supervision during pretraining improve generalization to downstream tasks?
  • RQ5How does the performance of retrieval-based inference compare to fine-tuned models in terms of accuracy, data efficiency, and adaptation speed?

Key findings

  • Hummingbird achieves 70.5% mIoU on PASCAL VOC semantic segmentation and 30.7% mIoU on ADE20K using only nearest neighbor retrieval, approaching the performance of fully fine-tuned models.
  • With ViT-L and ImageNet-22k pretraining, Hummingbird reaches 84.1% mIoU on PASCAL VOC and 50.8% mIoU on ADE20K, demonstrating strong zero-shot generalization.
  • The model trained with both self-supervised and retrieval-based objectives (Hummingbird++) achieves 76.2% mIoU on ADE20K, outperforming purely self-supervised or retrieval-supervised baselines.
  • Nearest neighbor retrieval is 10× less variable across runs than fine-tuning and does not require hyperparameter sweeps, making it a reliable and efficient online evaluation proxy.
  • Larger pretraining and evaluation memory banks (e.g., 153,600 features) significantly improve performance, especially on larger datasets like ADE20K.
  • The proposed contextual pretraining and spatial attention pooling lead to representations that are significantly more effective for retrieval than standard self-supervised methods like MAE or DINO.
Figure 2: Hummingbird model components.
Figure 2: Hummingbird model components.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.