Visual in-Context Prompting

Feng Li, Qing Jiang, Hao Zhang, Tianhe Ren, Shilong Liu +7 more
2/14/2026

Official code: IDEA-Research/T-Rex (2,683 stars, last commit 2025-10-15). 1 more implementation below.

Abstract

In-context prompting in large language models (LLMs) has become a prevalent approach to improve zero-shot capabilities, but this idea is less explored in the vision domain. Existing visual prompting methods focus on referring segmentation to segment the most relevant object, falling short of addressing many generic vision tasks like open-set segmentation and detection. In this paper, we introduce a universal visual in-context prompting framework for both tasks, as shown in Fig. 1. In particular, we build on top of an encoder-decoder architecture, and develop a versatile prompt encoder to support a variety of prompts like strokes, boxes, and points. We further enhance it to take an arbitrary number of reference image segments as the context. Our extensive explorations show that the proposed visual in-context prompting elicits extraordinary referring and generic segmentation capabilities to refer and detect, yielding competitive performance to close-set in-domain datasets and showing promising results on many open-set segmentation datasets. By joint training on COCO and SA-1B, DINOv achieves 57.7 PQ on COCO and 23.2 PQ on ADE20K. Code will be available at https://github.com/UX-Decoder/DINOv

View on arXivView PDF

Code Implementations(2)

UX-Decoder/DINOvOfficial100%

[CVPR 2024] Official implementation of the paper "Visual In-context Learning"

54427C++, CudaNov 22, 20232 years ago

[ECCV2024] API code for T-Rex2: Towards Generic Object Detection via Text-Visual Prompt Synergy

2,683171PythonNov 11, 20231 years agoNOASSERTION
interactiveobject-countingobject-detectionopen-settext-prompt+1 more

Similar Papers

Cite this paper

@article{li2026visual,
  title  = {Visual in-Context Prompting},
  author = {Feng Li and Qing Jiang and Hao Zhang and Tianhe Ren and Shilong Liu and Xueyan Zou and Huaizhe Xu and Hongyang Li and Chun-yue Li and Jianwei Yang and Lei Zhang and Jianfeng Gao},
  year   = {2026},
  eprint = {2311.13601},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2311.13601},
  journal = {CVPR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2311.13601.svg)](https://codeofpaper.com/paper/2311.13601)

Discussion