[Paper Review] Visual Prompting via Image Inpainting
The paper shows that treating visual tasks as grid image inpainting with a learned MAE-VQGAN, trained on a large unlabeled figures dataset, enables test-time visual prompting to perform various image-to-image tasks without fine-tuning.
How does one adapt a pre-trained visual model to novel downstream tasks without task-specific finetuning or any model modification? Inspired by prompting in NLP, this paper investigates visual prompting: given input-output image example(s) of a new task at test time and a new input image, the goal is to automatically produce the output image, consistent with the given examples. We show that posing this problem as simple image inpainting - literally just filling in a hole in a concatenated visual prompt image - turns out to be surprisingly effective, provided that the inpainting algorithm has been trained on the right data. We train masked auto-encoders on a new dataset that we curated - 88k unlabeled figures from academic papers sources on Arxiv. We apply visual prompting to these pretrained models and demonstrate results on various downstream image-to-image tasks, including foreground segmentation, single object detection, colorization, edge detection, etc.
Motivation & Objective
- Motivate prompt-based adaptation of pre-trained visual models to downstream tasks without fine-tuning or architecture changes.
- Propose framing downstream tasks as image inpainting on a visual prompt grid that contains examples and a query.
- Create a large unlabeled figures dataset to train robust inpainting models for prompting tasks.
- Evaluate prompting on multiple vision tasks to assess generalization and task coverage.
- Investigate how prompting design choices affect performance and how data distribution impacts results.
Proposed method
- Build an inpainting model called MAE-VQGAN by combining masked auto-encoding (MAE) with a VQGAN codebook to predict visual tokens for masked regions.
- Train MAE-VQGAN on a curated Computer Vision Figures dataset (88k unlabeled figures from ArXiv) and on ImageNet data to learn grid-like inpainting capable representations.
- Form visual prompts by concatenating one or more input-output task examples with a new query image into a grid-like image, and mask the region to be inpainted.
- Define a simple, hard-coded function g that constructs the visual prompt x_vp from the examples S and query x_q; inpainting then fills the masked region to yield the target output.
- Optionally apply prompt ensembling by generating multiple prompts and averaging predictions to improve robustness.
- Analyze prompting design choices (layout, colors, masking style) and demonstrate performance gains with more examples and ensembling.
Experimental results
Research questions
- RQ1Can a single, pre-trained visual model adapt to multiple downstream image-to-image tasks via test-time visual prompting without fine-tuning?
- RQ2Is image inpainting a viable core mechanism for visual prompting when models are trained on task-agnostic grid data?
- RQ3How does the choice of training data (Figures dataset vs. ImageNet) affect prompting performance across tasks?
- RQ4What is the impact of prompt design (layout, colors, number of examples) on prompting quality and robustness?
- RQ5How does visual prompting compare to traditional fine-tuning and few-shot baselines for segmentation and detection tasks?
Key findings
- MAE-VQGAN trained on the Figures dataset yields strong performance on foreground segmentation and single-object detection when used with visual prompts.
- Prompting models trained on Figures significantly outperform those pretrained only on ImageNet and surpass several unspecialized baselines in multiple tasks.
- Adding more examples in the visual prompt generally improves segmentation mIOU and detection accuracy across Pascal-5i and Pascal VOC datasets.
- Prompt design choices (e.g., vertical vs. horizontal layout, black/white masks) impact prompting quality, with some layouts yielding higher attention to relevant regions.
- Prompt ensembling (averaging predictions from multiple prompts) further improves results and stabilizes performance across tasks.
- MAE-VQGAN trained on Figures produces sharper completions and better task performance than VQGAN or BEiT baselines, particularly for detection and segmentation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.