﻿# SegGPT visual prompts: the example mask defines the segmentation request

Build a SegGPT segmentation request from a prompt image and mask while preserving label colors, preprocessing and the separation from the query target.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-seggpt-visual-prompt-mask-contract/
Language: en

## Recognize a visual example as input

SegGPT performs segmentation with context supplied by example imagery and masks. The [paper](https://arxiv.org/abs/2304.03284) formulates a generalist approach to segmentation in context. The application therefore supplies more than the query photograph. A successful example mask is not merely a decorative explanation shown to a user: it helps define what the model should segment. Preserve it when recording an experiment or reproducing a published demonstration on a new image.

## Keep the prompt pair consistent

The [Transformers integration](https://huggingface.co/docs/transformers/model_doc/seggpt) distinguishes prompt images, prompt masks and query images. Their geometry and semantic correspondence must agree. A mask resized independently with unsuitable interpolation can change region identity or boundaries. Check the processor's treatment of mask values and colors rather than assuming any visually similar colored overlay is equivalent to the original segmentation example supplied to the model.

## Avoid exposing the query answer

An evaluation pipeline can use a labeled reference example without including the held-out query mask in its model inputs. Keep these roles explicit in the dataset adapter. Accidentally passing the query's own target as a prompt produces a different experiment from transferring an example to an unseen query. The record should identify which image supplied context and which image was evaluated, including their relationship within any sequence or shared source collection.

## Use the released inference procedure

The [official project](https://github.com/baaivision/Painter/tree/main/SegGPT) provides the SegGPT inference implementation within the Painter repository. Follow the selected release's preprocessing and output interpretation rather than treating the result as a standard fixed-class detector output. When comparing prompt examples, keep the query image and processing constant. The observed change then answers a question about context selection instead of mixing several unrelated changes in checkpoint, canvas and target definition.

## Review transfer on hard query cases

Include a query with a similar-looking distractor and another where the intended object is absent. A visually persuasive mask in the easy demonstration does not establish general transfer from every possible prompt example. The guides to [image annotation identities](/journal/data-guide-coco-instance-caption-identities/) and [split leakage](/journal/document-level-data-split-leakage/) clarify related data boundaries. SegGPT's independent contract is visual context: the prompt image and mask must remain inspectable inputs, while the query target stays a separate source of evaluation evidence.
