Research
Bridging Granularity Gaps: Hierarchical Semantic Learning for Cross-domain Few-shot Segmentation
Bridging Granularity Gaps: Hierarchical Semantic Learning for Cross-domain Few-shot Segmentation Overview Research area: Computer Vision — cross-domain few-shot semantic segmentation (CD-FSS), a setti

- arXiv
- 2511.12200
- Published
- 2025-11-15
- Authors
- Sujun Sun, Haowen Gu, Cheng Xie, Yanxu Ren, Mingwu Ren, Haofeng Zhang
AI summary
Bridging Granularity Gaps: Hierarchical Semantic Learning for Cross-domain Few-shot SegmentationOverview
- Research area: Computer Vision — cross-domain few-shot semantic segmentation (CD-FSS), a setting that combines few-shot learning with domain shift.
- Technical level: Advanced. It assumes familiarity with meta-learning episodes, prototype-based segmentation, ViT/ResNet backbones, superpixel segmentation, and Fourier-domain style transfer.
- Scope: The paper diagnoses an overlooked "segmentation granularity gap" between source and target domains in CD-FSS and proposes a three-module framework (DSR, HSM, PCMT) to extract hierarchical semantic features, evaluated on four target-domain datasets with two backbones.
What This Paper Is About
Cross-domain few-shot segmentation (CD-FSS) asks a model trained only on a source domain (PASCAL VOC 2012 augmented with SBD) to segment novel classes in unseen target domains whose data distributions and label spaces do not overlap with the source, using only a few annotated support samples. Prior CD-FSS work focuses on closing the style gap between domains, but the authors argue it ignores a second problem: the granularity of the foreground/background partition differs between domains. For example, source-domain foreground and background differ coarsely (a bird versus other classes), whereas target-domain foreground and background can be as subtly different as the bird's own feather colors — so a model trained on coarse partitions cannot separate fine-grained target foreground from background.
Key Contributions
- The authors state they are the first to focus on segmentation granularity gaps between source and target domains in CD-FSS, and propose a Dual Style Randomization (DSR) module plus a Hierarchical Semantic Mining (HSM) module to learn hierarchical semantic features.
- DSR sequentially performs foreground style randomization (mixing foreground and randomly selected local-region amplitude spectra) and global style randomization (random convolution followed by amplitude–phase recombination) so the model sees diverse foreground-background style differences and overall style variation.
- HSM uses multi-scale superpixel masks to generate low-level and high-level region prototypes at each scale, then restores them into feature maps to enhance the high-level feature, encouraging intra-class consistency and inter-class distinction at different granularities.
- A Prototype Confidence-modulated Thresholding (PCMT) module uses prototype-confidence-weighted adaptive thresholds to segment the foreground confidence map, mitigating segmentation ambiguity when foreground and background are excessively similar.
Main Findings
- State-of-the-art averages: With a ResNet-50 backbone, HSL reaches 64.23 mIoU (1-shot) and 68.77 mIoU (5-shot), surpassing the state-of-the-art DRA by 3.37% and 3.35% respectively. With ViT-B/16, HSL reaches 68.24 mIoU (1-shot) and 72.32 mIoU (5-shot), surpassing LoEC by 3.23% and 1.89% respectively.
- Per-dataset results (ResNet-50): Deepglobe 46.13 / 53.80, ISIC 48.01 / 55.56, Chest X-ray 84.57 / 85.34, FSS-1000 78.22 / 80.36 (1-shot / 5-shot).
- Per-dataset results (ViT-B/16): Deepglobe 45.77 / 54.56, ISIC 59.36 / 64.62, Chest X-ray 85.95 / 86.25, FSS-1000 81.89 / 83.84 (1-shot / 5-shot).
- Component ablation (average mIoU): Baseline with no modules: 57.82 (ResNet-50) and 62.24 (ViT-B/16). Adding DSR alone: 60.44 / 64.55. Adding HSM alone: 60.92 / 65.29. DSR + HSM: 62.97 / 67.05. All three modules: 64.23 / 68.24.
- Individual module gains (1-shot): DSR improves the CNN-based baseline by 2.62% and the ViT-based baseline by 2.31%; HSM improves them by 3.10% and 3.05% respectively.
- Multi-scale superpixel masks matter: Using all four scales {5², 10², 15², 20²} gives 67.05 mIoU (ViT-B/16, 1-shot). Removing the 5×5 scale drops performance to 66.34; removing 5×5 and 10×10 gives 65.84; keeping only the 20×20 scale gives 65.43.
- Threshold strategy comparison (ViT-B/16, 1-shot): Fixed threshold at 0 gives Deepglobe 44.54, ISIC 55.79, Chest 85.93, FSS 81.93 (average 67.05). OTSU gives 45.57, 59.98, 85.81, 80.43 (average 67.95). PCMT gives 45.77, 59.36, 85.95, 81.89 (average 68.24) — a better balance across domains.
- Qualitative observation: OTSU's adaptive threshold helps substantially on ISIC (prone to segmentation ambiguity) but hurts on FSS-1000 (close to the source domain); fixing the threshold at 0 shows the opposite pattern. PCMT avoids introducing boundary errors on cases with no ambiguity while alleviating ambiguity where it exists.
- Visualizations: Foreground similarity heatmaps (Fig. 3) indicate the method extracts more hierarchical features from the source domain, and confidence-map heatmaps with segmentation results (Fig. 4) show ambiguity relief on the top two rows and no extra boundary errors on the bottom two rows.
Methodology in Plain English
The model follows a meta-learning episode setup: each episode provides a support set of K annotated images and a query image, and the model must predict the query mask.
- Multi-scale superpixel masks first. A superpixel segmentation model produces masks at four scales (5², 10², 15², 20² regions), which approximate semantic partitions at different granularities. These masks feed both DSR and HSM.
- DSR (training only). The foreground region is cropped and its amplitude spectrum is randomly weighted with the amplitude spectrum of a randomly selected local superpixel region, while the original phase (content) is kept. This makes the foreground style approach or diverge from the local background style by varying degrees without destroying image semantics. Then a random convolution perturbs the image's global texture, and only the resulting amplitude spectrum is recombined with the original phase, giving overall style variation.
- HSM. Low-level and high-level features are extracted; the low-level feature is projected and downsampled to match the high-level one. Masked average pooling produces a low-level and a high-level prototype per superpixel region. Low-level prototypes are refined through two multi-head self-attention layers and fused with high-level prototypes by a weight α. An inverse pooling step (RMAP) scatters the region prototypes back into feature maps, and these are summed across scales and added to the high-level feature to produce the hierarchical semantic feature.
- Prototyping and PCMT (testing only). Foreground and background prototypes for support and query are computed via MAP and an SSP module. Cosine similarity between fused prototypes and the upsampled query feature yields foreground and background similarity maps; their difference is the foreground confidence map. Instead of a plain similarity comparison, an OTSU-derived adaptive threshold is modulated by a prototype confidence term C (built from cross-view prototype similarities) through a sigmoid of β(C + γ). Setting the threshold to zero recovers the ordinary similarity-comparison behavior, so high-confidence samples use a near-zero threshold and low-confidence samples lean on the adaptive one.
- Training setup. Binary cross entropy (BCE) loss, ResNet-50 or ViT-B/16 backbone, SGD for 5 epochs with momentum 0.9, weight decay 5e-4, constant learning rate 1e-3, on two NVIDIA GeForce RTX 4090 GPUs with batch size 8 (1-shot) and 6 (5-shot). ResNet-50 uses 400×400 inputs, discards the last backbone stage, and takes low-level features at the end of stage-0; ViT-B/16 uses 480×480 inputs and takes low-level features after patch embedding. Hyperparameters: K = 9, α = 0.2, β = 40.0, γ = 0.1, σ_f = 0.25, σ_g = 0.1 (ResNet-50) and 0.6 (ViT-B/16).
- Evaluation. Train on PASCAL VOC 2012 + SBD, test on Deepglobe, ISIC, Chest X-ray, and FSS-1000, reporting mean IoU averaged over 5 random seeds, with 1200 episodes for Deepglobe, ISIC, and Chest X-ray and 2400 episodes for FSS-1000.
Why This Matters
- Impact on research: The paper reframes CD-FSS from a style-transfer problem to a granularity adaptation problem, suggesting that matching the granularity of semantic partitions — not only the appearance statistics — is necessary for cross-domain generalization. Its modules are backbone-agnostic, working with both ResNet-50 and ViT-B/16.
- Medical imaging: Fine-grained foreground/background separation is exactly the ISIC skin lesion setting, where the paper reports 59.36 mIoU (1-shot) and 64.62 mIoU (5-shot) with ViT-B/16, and Chest X-ray results of 85.95 / 86.25.
- Remote sensing and land-cover mapping: Deepglobe results (46.13 / 53.80 with ResNet-50; 45.77 / 54.56 with ViT-B/16) point to aerial segmentation where target-region imagery differs from the training distribution.
- Annotation-scarce domains generally: The FSS-1000 results (81.89 / 83.84 with ViT-B/16) show the approach holds up on a dataset closer to the source domain, which matters for any application where labeling dense masks is expensive.
- Industry relevance: Because PCMT is used only at test time and DSR only at training time, and the method deliberately avoids target-domain fine-tuning, it suits deployment scenarios where target data cannot be used for retraining (privacy, cost, or label scarcity).
Future Directions
- Extending the granularity argument beyond the four evaluated target datasets and beyond the PASCAL VOC 2012 + SBD source domain, to see whether the hierarchical features transfer under much larger or differently structured domain gaps.
- Making the threshold modulation more automatic: the current PCMT relies on hyperparameters β = 40.0 and γ = 0.1, and the paper reports different behaviors of OTSU versus a fixed-at-0 threshold across target datasets, so a principled, per-domain schedule is an open question.
- Whether DSR and HSM can be combined with target-domain fine-tuning methods (the methods marked with ∗ in the comparison, such as PATNet, ABCDFSS, APM, and SDRC) rather than positioned as an alternative to them.
- The paper notes that low-level features contain noise and have a semantic gap with high-level features, handled by attention layers and a fixed fusion weight α = 0.2; learning this weighting adaptively is an unexplored step. The appendix promises extensive additional ablation studies and visualizations that are truncated in the provided content.
Target Audience
Researchers and graduate students working on few-shot segmentation, domain adaptation, or transfer learning in dense prediction; practitioners in medical imaging, remote sensing, and industrial inspection who need segmentation models that generalize to new domains without target-domain retraining; and readers interested in combining superpixel-based region priors with frequency-domain style randomization inside a prototype-based segmentation pipeline.
Authors’ abstract
Cross-domain Few-shot Segmentation (CD-FSS) aims to segment novel classes from target domains that are not involved in training and have significantly different data distributions from the source domain, using only a few annotated samples, and recent years have witnessed significant progress on this task. However, existing CD-FSS methods primarily focus on style gaps between source and target domains while ignoring segmentation granularity gaps, resulting in insufficient semantic discriminability for novel classes in target domains. Therefore, we propose a Hierarchical Semantic Learning (HSL) framework to tackle this problem. Specifically, we introduce a Dual Style Randomization (DSR) module and a Hierarchical Semantic Mining (HSM) module to learn hierarchical semantic features, thereby enhancing the model's ability to recognize semantics at varying granularities. DSR simulates target domain data with diverse foreground-background style differences and overall style variations through foreground and global style randomization respectively, while HSM leverages multi-scale superpixels to guide the model to mine intra-class consistency and inter-class distinction at different granularities. Additionally, we also propose a Prototype Confidence-modulated Thresholding (PCMT) module to mitigate segmentation ambiguity when foreground and background are excessively similar. Extensive experiments are conducted on four popular target domain datasets, and the results demonstrate that our method achieves state-of-the-art performance.