DIP: Unsupervised Dense In-Context Post-training of Visual Representations

Sophia Sirko-Galouchenko, Spyros Gidaris, Antonin Vobecky, Andrei Bursuc, Nicolas Thome

TL;DR

This paper introduces DIP, a novel unsupervised post-training method that enhances visual representations for "in-context" scene understanding. By training vision encoders on automatically generated pseudo-tasks that mimic real-world scenarios, DIP achieves strong performance on downstream tasks without complex self-distillation, offering a more efficient and effective solution.

What Problem Does This Paper Address?

The paper tackles the challenge of improving dense visual representations, particularly for "in-context learning" in vision models. In-context learning, inspired by large language models, allows models to adapt to new tasks with just a few examples provided in the input, without updating their parameters. While this has been successful in NLP, vision models still lag behind. A key hurdle is learning dense representations that capture strong semantic correspondences between image patches, enabling accurate retrieval of similar visual information. Existing methods often rely on complex self-distillation architectures, which can be unstable and difficult to tune. The authors aim to find a simpler, more efficient, and effective way to achieve this for vision models.

Methods

DIP (Dense In-Context Post-training) is a novel unsupervised post-training approach. Instead of complex self-distillation, DIP trains a pretrained vision encoder (like DINOv2R) on automatically generated "pseudo-tasks." These tasks are designed to mimic the in-context learning scenarios encountered downstream.

Here's how it works:

  • Pseudo-Task Generation: The core innovation is an automatic mechanism to create these tasks from unlabeled data. This involves:
  • Class-Agnostic Segmentation: Using a pre-trained diffusion model (Stable Diffusion) and a technique called DiffCut, the system generates fine-grained, class-agnostic segmentation masks for images.
  • Pseudo-Labeling: A pretrained vision encoder (e.g., DINOv2R) is used to extract features from these segments. K-means clustering on these features groups visually similar segments, which are then assigned as "pseudo-labels."
    • Task Construction: Each pseudo-task consists of a query image and a set of support images. One support image is a "positive" example that shares a pseudo-class with the query, while the others are "distractors."
  • In-Context Training: The vision encoder is then trained on these pseudo-tasks. The objective is to predict the query image's pseudo-segmentation using the support images as reference, via a cross-attention mechanism. A pixel-wise cross-entropy loss is used.
  • Downstream Usage: After post-training, the projection head is removed, and the fine-tuned encoder is used for downstream tasks. For in-context learning, a larger memory bank of features is constructed, and cross-attention is applied to retrieve and match features from support examples to the query.

Datasets

  • Training (Pseudo-task Generation & Post-training): COCO and ImageNet are used for generating pseudo-tasks and post-training.
  • Evaluation (Downstream Tasks):
    • Semantic Segmentation: PascalVOC, Pascal-Context, ADE20K, Cityscapes, COCO.
  • Monocular Depth Prediction: NYUv2.
  • Retrieval-based Segmentation (Intra-task Domain Shift): Cityscapes (support) and ACDC (query).

Key Insights and Ideas

  • Meta-Learning Inspiration for Vision: The paper successfully adapts meta-learning principles to unsupervised post-training for vision. By creating tasks that mimic downstream scenarios, the model learns transferable skills.
  • Diffusion Models as Segmentation Tools: Leveraging diffusion models (like Stable Diffusion via DiffCut) for generating high-quality, class-agnostic segmentation masks is a key enabler for unsupervised pseudo-task creation.
  • Simplicity Over Complexity: DIP demonstrates that effective dense representation learning for in-context tasks can be achieved without resorting to complex self-distillation architectures, which are often prone to instability.
  • Pseudo-Labels are Sufficient: The research shows that automatically generated pseudo-labels, even if imperfect, are sufficient to train robust representations that generalize well to real-world tasks.
  • Importance of Distractors: The inclusion of "distractor" support examples in pseudo-tasks is crucial for improving the model's ability to distinguish relevant from irrelevant visual information.

Key Results

  • Strong Performance in Low-Shot Regimes: DIP consistently outperforms its base model (DINOv2R) and prior state-of-the-art methods on in-context semantic segmentation tasks, especially in low-shot scenarios (fewer training examples). For instance, on PascalVOC with 128 examples, DIP achieves 81.0 mIoU, compared to DINOv2R's 79.4.
  • Generalization: The learned representations generalize well to various downstream tasks, including semantic segmentation and monocular depth prediction, even on out-of-domain datasets.
  • Efficiency: Post-training is computationally efficient, requiring under 9 hours on a single A100 GPU.
  • Improved Coherence: Qualitative results show that DIP produces more semantically coherent nearest neighbors compared to DINOv2R, leading to better retrieval and segmentation.
  • Versatility: DIP effectively enhances representations from other base models like CLIP and MAE, demonstrating its broad applicability.

Limitations and Future Work

  • Reliance on Pretrained Models: DIP's performance is dependent on the quality of the initial pretrained vision encoder and the diffusion model used for pseudo-task generation.
  • Pseudo-Label Quality: While effective, the pseudo-labels generated are not perfect and can sometimes be noisy, as acknowledged by the authors.
  • Future Work: The authors suggest exploring other VFMs and further investigating the impact of different pseudo-task generation strategies. The paper also hints at potential for improving robustness to domain shifts, though this wasn't the primary focus.

Summary updated

BibTeX
@inproceedings{sirkogalouchenko2025dip,
  author = {Sophia Sirko-Galouchenko and Spyros Gidaris and Antonin Vobecky and Andrei Bursuc and Nicolas THOME},
  title = {{DIP: Unsupervised Dense In-Context Post-training of Visual Representations}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
  url = {https://openreview.net/forum?id=MliYWtU6vN},
}
Figure