arXiv(opens in a new tab)cs.CVSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.03384

FoRIS: Progressive Foreground Refinement for Training-Free In-Context Segmentation

Ming Hu, Jianfu Yin, Mingyu Dou, Miaomiao Zhang, Yao Wang, Cong Hu, Bingliang Hu, Quan Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Ming Hu1,2^{1,2}, Jianfu Yin1,2^{1,2}, Mingyu Dou1,2^{1,2}, Miaomiao Zhang1,2^{1,2}, Yao Wang3^{3}

Cong Hu4^{4}, Bingliang Hu1^{1}, Quan Wang1^{1}

1^{1}Xi'an Institute of Optics and Precision Mechanics, Chinese Academy of Sciences

2^{2}University of Chinese Academy of Sciences

3^{3}Xi'an Jiaotong University

4^{4}Zhongnan Hospital of Wuhan University

huming708@gmail.com

Figure

Figure 1: Left: Our core coarse-to-fine progressive refinement paradigm, which sequentially performs Foreground Purification, Foreground Localization, and Foreground Consolidation. Ablation results on COCO-20i^{i} show that each stage progressively improves the segmentation IoU. Right: Performance comparison with existing methods across diverse datasets spanning multiple domains, demonstrating the consistent effectiveness of FoRIS and its improvement in average mIoU.

Abstract

In-Context Segmentation (ICS) aims to precisely segment arbitrary semantic concepts, such as objects or parts, given one or a few annotated visual exemplars. In this paper, we revisit ICS from a more classical segmentation perspective, viewing it as a coarse-to-fine progressive refinement process. Rather than directly predicting the final mask through reference-query matching, we progressively refine the segmentation from coarse and ambiguous foreground responses to precise and complete foreground structures. Building upon this perspective, we propose a training-free in-context segmentation framework, termed FoRIS. Specifically, FoRIS consists of three key stages: Foreground Purification, Foreground Localization, and Foreground Consolidation, which progressively suppress background distractions, localize discriminative target regions, and recover complete foreground structures through semantic aggregation. Experimental results demonstrate that FoRIS achieves SOTA performance across semantic and part segmentation tasks, with average improvements of 4.5 and 4.8 mIoU points over existing approaches in the 1-shot and 5-shot settings, respectively. Code: https://github.com/Xi-Mu-Yu/FoRIS.

1 INTRODUCTION

Segmentation is a fundamental task in computer vision with broad applications across natural, medical, and remote-sensing imagery Hu et al. (2025; 2026b; 2024; 2026a); Ronneberger et al. (2015); Yang et al. (2023; 2025); He et al. (2017); Badrinarayanan et al. (2017); Chen et al. (2017); Arbelaez et al. (2010); Felzenszwalb & Huttenlocher (2004); Achanta et al. (2012); Shi & Malik (2000); Long et al. (2015). Traditional segmentation methods are typically restricted to predefined semantic categories and require substantial task-specific supervision, limiting their flexibility in open-world scenarios Cuttano et al. (2026). With the rapid development of visual foundation models (VFMs) Caron et al. (2021); Oquab et al. (2024); Siméoni et al. (2025); Kirillov et al. (2023); Carion et al. (2025), in-context segmentation (ICS) has emerged as a promising paradigm for open-world

Figure

Figure 2: Motivation for progressive foreground refinement. (a) Existing training-free ICS methods rely on direct reference-query matching, which may confuse visually similar background regions with the target. (b) We reinterpret ICS as a progressive foreground refinement process consisting of foreground purification, foreground localization, and foreground consolidation.

segmentation Cuttano et al. (2026); Zhang et al. (2024b;a); Liu et al. (2024b). Given one or more annotated reference examples at inference time, ICS aims to segment arbitrary target concepts without category-specific retraining, enabling flexible generalization across diverse concepts, domains, and annotation settings Cuttano et al. (2026).

Existing ICS methods generally follow two paradigms. Fine-tuned methods adapt pretrained visual or diffusion architectures with task-specific segmentation supervision, translating pretrained representations into dense pixel-level predictions. Although effective within the training distribution, they require additional optimization and supervision, which can limit open-world generalization. In contrast, training-free methods combine complementary pretrained models, typically leveraging visual representations for reference-query correspondence and segmentation priors for mask generation. While avoiding task-specific optimization, these methods still primarily rely on reference-query correspondence to transfer foreground semantics to the target image.

Despite their methodological differences, existing training-free ICS methods largely adopt a correspondence-centric formulation, where foreground semantics are transferred from reference exemplars to query images through feature correspondence or similarity propagation Liu et al. (2024b); Zhang et al. (2024a); Cuttano et al. (2026). As illustrated in Fig. 2(a), given a reference image containing a white square-shaped refrigerator, such correspondence-based methods may incorrectly associate visually similar white square-shaped wall regions in the query image with the target, resulting in inaccurate segmentation. This failure exposes a fundamental mismatch between visual similarity and target membership: a query region may closely resemble the reference foreground while being semantically irrelevant to the target.

More fundamentally, an annotated foreground mask specifies where the target lies, but does not guarantee that the corresponding frozen features provide a semantically pure representation of the target. Contextual, positional, and background-correlated information may remain entangled with foreground features. Meanwhile, variations in viewpoint, appearance, and object structure can cause true target regions in the query image to produce only partial or fragmented semantic responses. These factors introduce three coupled sources of uncertainty: foreground contamination, ambiguous target localization, and fragmented foreground responses. Consequently, the central challenge of training-free ICS is not simply to establish more accurate correspondence, but to progressively transform noisy visual evidence into reliable, foreground-centric semantic representations.

This observation motivates us to reconsider the role of correspondence in ICS. Rather than discarding correspondence, we view it as an intermediate source of semantic evidence within a progressive foreground refinement process, as illustrated in Fig. 2(b). Specifically, foreground semantics progressively emerge through three stages: foreground purification, foreground localization, and foreground consolidation. Foreground purification suppresses contextual and background interference in reference features, establishing a cleaner semantic basis for correspondence. Foreground localization then exploits the purified foreground cues to identify discriminative target regions in the query image, reducing localization ambiguity. Finally, foreground consolidation aggregates semantically related but spatially scattered responses, progressively recovering complete object structures from fragmented local evidence. In this view, correspondence is not treated as a sufficient endpoint, but as one component of a broader process that progressively refines semantic evidence into coherent object-level predictions.

Based on this perspective, we propose FoRIS (Foreground Refinement for Training-Free In-context Segmentation), a training-free ICS framework that explicitly implements this progressive foreground refinement paradigm. FoRIS sequentially performs foreground purification, foreground localization, and foreground consolidation using a frozen VFM, without additional segmentation supervision or auxiliary segmentation models. By placing correspondence within a progressive refinement pipeline, FoRIS shifts the focus from one-step semantic transfer toward the reliable extraction, localization, and consolidation of foreground evidence.

We further investigate a challenging and underexplored limitation of current VFM-based training-free ICS methods: their limited generalization to slender and fragmented structures. Such structures often exhibit weak semantic responses, limited spatial support, and substantial appearance variations, amplifying the ambiguities that correspondence-based methods struggle to resolve. We systematically evaluate this challenge across diverse slender-structure datasets and find that existing training-free ICS methods remain substantially less reliable in such scenarios. These findings reveal a pronounced generalization gap despite the strong representations provided by VFMs, highlighting the need for training-free ICS methods that can accommodate heterogeneous target geometries and fragmented structures. Our contributions are summarized as follows:

  • We introduce progressive foreground refinement as a new perspective for training-free in-context segmentation, repositioning reference-query correspondence as an intermediate source of semantic evidence within a three-stage refinement process: foreground purification, localization, and consolidation.

  • We propose FoRIS, a training-free ICS framework that explicitly implements this progressive refinement paradigm and achieves average IoU improvements of over 4.5 and 4.8 percentage points over existing methods under the 1-shot and 5-shot settings, respectively.

  • We systematically investigate the generalization limitations of current VFM-based training-free ICS methods on slender and fragmented structures, revealing a challenging and under-explored scenario that remains an open problem for future ICS research.

References (71)

  • Slic superpixels compared to state-of-the-art superpixel methods
  • Seeded region growing
  • Pyramid methods in image processing
  • Contour detection and hierarchical image segmentation
  • Segnet: A deep convolutional encoder-decoder architecture for image segmentation
  • Interactive graph cuts for optimal boundary & region segmentation of objects in nd images
  • Lung segmentation in chest radiographs using anatomical atlases with nonrigid registration
  • SAM 3: Segment Anything with Concepts
  • Emerging properties in self-supervised vision transformers
  • DeepLab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs
  • Scaling language modeling with pathways
  • Skin lesion analysis toward melanoma detection 2018: A challenge hosted by the international skin imaging collaboration (ISIC) (opens arXiv in a new tab)
  • SANSA: Unleashing the hidden semantics in SAM2 for few-shot segmentation
  • Insid3: Training-free in-context segmentation with dinov3
  • Deepglobe 2018: A challenge to parse the earth through satellite images
  • No time to train! Training-free reference-based instance segmentation (opens arXiv in a new tab)
  • Efficient graph-based image segmentation
  • Scene-centric unsupervised panoptic segmentation
  • Unsupervised semantic segmentation by distilling feature correspondences
  • Mask r-cnn
  • Cost aggregation with 4D convolutional Swin transformer for few-shot segmentation
  • Specslice-convlstm: Medical hyperspectral image segmentation using spectral slicing and convlstm
  • Nonlinear interpolation and differentiated training strategies for semi-supervised medical image segmentation
  • Whereedit: Mask-aware local latent editing for one-step image editing (opens arXiv in a new tab)
  • Fb-clip: Fine-grained zero-shot anomaly detection with foreground-background disentanglement
  • Semantic segmentation of underwater imagery: Dataset and benchmark
  • IEEE Trans
  • Fives: A fundus image dataset for artificial intelligence based vessel segmentation
  • Snakes: Active contour models
  • Segment Anything
  • Efficient inference in fully connected CRFs with Gaussian edge potentials
  • Learning what not to segment: A new perspective on few-shot segmentation
  • A simple image segmentation framework via in-context examples
  • Matcher: Segment anything with one shot using all-purpose feature matching
  • Fully convolutional networks for semantic segmentation
  • Deep spectral methods: A surprisingly strong baseline for unsupervised semantic segmentation and localization
  • SegIC: Unleashing the emergent correspondence for in-context segmentation
  • Feature weighting and boosting for few-shot segmentation
  • U-net: Convolutional networks for biomedical image segmentation
  • "grabcut" interactive foreground extraction using iterated graph cuts
  • Normalized cuts and image segmentation
  • DINOv3
  • LLaMA: Open and Efficient Foundation Language Models
  • The HAM10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions
  • Unsupervised semantic segmentation by contrasting object mask proposals
  • PaNet: Few-shot image semantic segmentation with prototype alignment
  • Images speak in images: A generalist painter for in-context visual learning
  • SegGPT: Towards segmenting everything in context
  • Revisiting weak-to-strong consistency in semi-supervised semantic segmentation
  • Unimatch v2: Pushing the limit of semi-supervised semantic segmentation
  • Scale-aware detailed matching for few-shot aerial image semantic segmentation
  • Bridge the points: Graph-based few-shot segment anything semantically
  • Personalize segment anything model with one shot
  • Unleashing the potential of the diffusion model in few-shot semantic segmentation
  • Comparison across DINOv3 backbones with original, debiased, and adaptive debias variants
  • ><tr><td rowspan=
  • The results are reported in table 5
  • For example, with the DINOv3-Base backbone, PCK@0.10 improves from 46.80 to 52.60, while PCK@0.20 increases from 61.22 to 68.73
  • effective positional debiasing should selectively suppress harmful positional bias while retaining useful geometric priors encoded in frozen visual features
  • As shown in Table 6, the total inference time of FoRIS is 1 620.77 ms for a single in-context example at a resolution of 1 024 px on a single RTX 3090
  • Interestingly, FoRIS achieves 59.5 % mIoU even at a resolution of only 512 px, already surpassing the 57.6 % mIoU achieved by INSID3 at 1 024 px
  • ><tr><td></td><td colspan=
  • Models are provided with 5 contextual examples and tasked with segmenting the annotated concept in the target image
  • All methods use frozen DINOv3-L at 1024×1024 with default last-layer features
  • >Method</td><td colspan=
  • We evaluate on two public datasets with elongated, low-contrast foreground: Fundus Jin et al. (2022) for retinal vessel segmentation and DeepGlobe-18 Demir et al. (2018) for aerial road extraction
  • Three observations stand out
  • on Fundus and +6.1/+6.2 pts
  • Tables 10 and 11 and figs
  • Low-level tokens therefore encode texture and local appearance rather than vessel- or road-level semantics usable for cross-image matching
  • Bold indicates the best result per column