Selective, Regularized, and Calibrated: Harnessing Vision Foundation Models for Cross-Domain Few-Shot Semantic Segmentation

Junyuan Ma, Xunzhi Xiang, Wenbin Li, Qi Fan, Yang GaoarXiv 2026

TL;DR

HERA (Hierarchical Exemplar Representation Adaptation) is a novel, source-free test-time adaptation framework that successfully adapts frozen Vision Foundation Models (VFMs) for cross-domain few-shot semantic segmentation. By dynamically selecting optimal feature layers, regularizing noisy attention maps, and calibrating pixel-level predictions, HERA outperforms existing state-of-the-art methods by over 4.1 mIoU while updating less than 2.7% of the model's parameters.

What Problem Does This Paper Address?

Few-shot semantic segmentation (FSS) aims to segment novel object classes using only a handful of labeled examples (supports). While standard FSS models perform well when the training and testing data share the same distribution, they struggle significantly under domain shifts—such as moving from natural images to satellite imagery or medical scans. This challenge is known as Cross-Domain Few-Shot Segmentation (CD-FSS).

Overview of the challenges in CD-FSS and HERA's outcomes

Vision Foundation Models (VFMs) like DINO and CLIP possess rich, transferable representations that seem ideal for this task. However, they are notoriously fragile when applied directly to CD-FSS for two reasons:

  1. Overfitting: Fine-tuning massive VFMs on just a few labeled target images leads to severe overfitting.
  2. Layer-wise Sensitivity: The utility of different VFM layers fluctuates wildly depending on the specific target domain and even the individual few-shot task (episode), making fixed-layer selection strategies brittle.

Existing CD-FSS methods typically rely on older CNN backbones and require expensive retraining on source data, which violates data privacy constraints and deployment flexibility.

Methods

To overcome these bottlenecks, the authors introduce HERA, a three-stage select-regularize-calibrate pipeline that operates entirely at test time without requiring access to source data.

Figure 2. HERA architecture. Hierarchical Layer Selection (HLS) estimates the leave-one-out layer risk Rlayer and routes each episode to ℓ⋆, chosen from a single layer ℓsingle or a local-fusion candidate ℓfusion. At ℓ⋆, Prior Guided Regularization (PGR) calibrates self-attention with entropy-gated Gaussian priors, and Pixelwise Adaptive Calibration (PAC) adds residual logits ℓsim, ℓattn, ℓimg that are fused with the base logit in a select–regularize–calibrate hierarchy. L, U, and H are the numbers of layers, fusion candidates, and attention heads.
  1. Hierarchical Layer Selection (HLS): Instead of using a fixed layer, HERA dynamically determines the most informative layer (or a localized fusion of adjacent layers) for each few-shot episode. It achieves this by calculating an Exemplar Transfer Risk (ETR) using a leave-one-out cross-evaluation strategy on the available support images. Test-time adaptation is then strictly confined to a tiny, lightweight MLP head at this selected layer.
  2. Prior-Guided Regularization (PGR): Token interactions (self-attention maps) in Vision Transformers (ViTs) become highly noisy under domain shift. PGR applies head-wise Gaussian priors to smooth these maps. Crucially, the width of the Gaussian prior is dynamically controlled by an entropy gate based on each attention head's natural dispersion, ensuring local focus without sacrificing global context.
  3. Pixelwise Adaptive Calibration (PAC): To fix residual errors along thin boundaries and low-contrast regions, PAC introduces three lightweight residual cues in the logit domain: feature similarity, one-hop attention propagation, and raw image appearance. An automated voting gate ensures these residuals are only applied when they provide a positive predicted gain.

Datasets

The authors evaluated HERA across four distinct target-domain benchmarks to test its cross-domain robustness:

  • FSS-1000: A natural image dataset spanning 1,000 object classes.
  • DeepGlobe: A satellite land-cover dataset featuring severe texture and scale shifts.
  • ISIC2018: A dermoscopic skin-lesion dataset characterized by low-contrast and irregular boundaries.
  • Chest X-ray: A medical radiograph dataset with substantial grayscale and structural variation.

Key Insights and Ideas

  • Per-Episode Layer Routing is Essential: The optimal VFM layer for mask prediction varies drastically from episode to episode, even within the same dataset. Handcrafted heuristics or gradient-based proxies often fail because ViT residual connections bias them toward the final layers. HLS directly aligns layer selection with the target objective (mIoU).
Figure 3. Layerwise variability in VFM features (DINOv3 example). Foreground-logit heatmaps from ViT layers 0-23 for two episodes from distinct target domains. A semantic shift emerges around layers 11-12, yet the optimal layer for mask prediction differs across episodes, indicating episode- and domain-dependent variability in the best layer and motivating per-episode layer routing.
  • Attention Heads Require Individualized Priors: Uniform, head-agnostic priors fail because different attention heads specialize in different spatial scopes. Gating the regularization via entropy allows confident, localized heads to remain sharp while allowing globally dispersed heads to maintain their coverage.
  • Source-Free Adaptation is Highly Efficient: HERA proves that you don't need access to the original training data or hours of optimization to adapt a VFM. By freezing the backbone and tuning less than 2.7% of the parameters, adaptation takes less than 0.3 seconds per episode.

Key Results

HERA achieves a new state-of-the-art across all evaluated benchmarks, delivering consistent performance gains regardless of whether it is paired with DINOv2, DINOv3, or CLIP backbones.

Table 1. Quantitative comparison on the CD-FSS benchmark. All compared methods, except HERA, are trained on the Pascal VOC [11] source domain and then evaluated on four targets, whereas HERA is source-free and performs no source- or target-side training (test-time adaptation only). Best and second-best results are shown in bold and underlined. The † indicates results reproduced by us, and ‡ indicates a ViT-base backbone. In the Training (S/T) column, ✓/✓denotes source-side pretraining and supervised target retraining; ✓/× denotes source-side pretraining only (no target retraining); ∅denotes source-free, no target-side domain retraining, test-time adaptation only.
  • Substantial mIoU Gains: Using a DINOv3 backbone, HERA achieves an average mIoU of 68.3% (1-shot) and 77.9% (5-shot), outperforming the closest competitor (DATO) by 4.1 mIoU in the 5-shot setting, despite DATO requiring source-domain training.
  • Clinical Modality Success: HERA showed remarkable success on the highly challenging Chest X-ray dataset, reaching 85.8% (1-shot) and 87.9% (5-shot) mIoU, proving its efficacy in low-contrast, thin-boundary clinical scenarios.
Figure 5. Qualitative results on the Chest X-ray, ISIC, FSS-1000, and Deepglobe datasets under the 1-shot setting. The prediction and ground truth of query images are in red and green, respectively. Best viewed in color.

Limitations and Future Work

While HERA delivers strong performance, 1-shot scenarios remain inherently unstable due to the lack of diverse support data to guide the leave-one-out layer selection. To stabilize 1-shot episodes, the authors had to implement a simple "soft copy-paste" data augmentation scheme.

The authors note that future work could explore integrating more sophisticated support-synthesis strategies, such as generative instance synthesis or structure-preserving shape deformations, to further bolster 1-shot stability and cross-domain generalization.

Summary updated

BibTeX
@misc{ma2026selective,
  author = {Junyuan Ma and Xunzhi Xiang and Wenbin Li and Qi Fan and Yang Gao},
  title = {{Selective, Regularized, and Calibrated: Harnessing Vision Foundation Models for Cross-Domain Few-Shot Semantic Segmentation}},
  year = {2026},
  eprint = {2605.19340},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.19340},
}
Figure