Abstract
Recent advancements in in-context segmentation generalists have demonstrated significant success in performing various image segmentation tasks using a limited number of labeled example images. However, real-world applications present challenges due to the variability of support examples, which often exhibit quality issues resulting from various sources and inaccurate labeling. How to extract more robust representations from these examples has always been one of the goals of in-context visual learning. In response, we propose UNICL-SAM, to better model the example distribution and extract robust representations to help in-context segmentation. We incorporate an uncertainty probabilistic module to quantify each example's reliability during both the training and testing phases. Utilizing this uncertainty estimation, we introduce an uncertainty-guided graph augmentation and feature refinement strategy, aimed at mitigating the impact of high-uncertainty regions to enhance the learning of robust representations. Subsequently, we construct prototypes for each example by aggregating part information, thereby creating reliable in-context instruction that effectively represents fine-grained local semantics. This approach serves as a valuable complement to traditional global pooling features. Experimental results demonstrate the effectiveness of the proposed framework, underscoring its potential for real-world applications.
Introduction
In-context learning (ICL) has revolutionized computer vision by allowing "generalist" models to perform segmentation using only a few labeled examples. However, real-world support images are often imperfect, containing blur, poor lighting, or inaccurate labels. Standard models often fail because they treat all pixels as equally reliable. UNICL-SAM addresses this by explicitly modeling data uncertainty and discovering "part prototypes" to extract robust, fine-grained representations from diverse examples.
Methodology
The UNICL-SAM framework builds upon the Segment Anything Model (SAM) by integrating three key modules designed to handle noise and capture local semantics.
Uncertainty Gaussian Graph Network (UGGN)
Instead of representing image features as fixed points, the model treats them as distributions. By modeling features with a Gaussian distribution, the system can quantify "uncertainty" (variance). High variance indicates a region that is likely noisy or ambiguous.
Uncertainty-Guided Refinement
During training, the model uses these uncertainty maps to perform "graph augmentation." It intentionally drops or masks high-uncertainty nodes, forcing the network to learn invariant, reliable representations from the "trustworthy" parts of the image. A learnable "uncertainty gate" then reweights features during the final prediction.
Part Prototype Discovery
Most models use "global pooling," which squashes an entire object into a single average vector. UNICL-SAM instead clusters local features into several part prototypes (e.g., separating a bird's wing from its beak). This allows the model to match fine-grained local semantics between the reference and the target image, acting as a sophisticated prompt generator for the frozen SAM backbone.
Experimental Evaluation
The model was evaluated on several rigorous benchmarks, including COCO-20i, FSS-1000, LVIS-92i, and ADE20k. To test real-world applicability, the authors created a custom "Robustness Test Set" by applying six types of degradation (blur, color jitter, JPEG compression, etc.) to existing data.
Key Results
- Superior Accuracy: On COCO-20i, UNICL-SAM achieved a 77.8 mIoU (one-shot), vastly outperforming previous generalists like SegGPT (56.1) and SINE (64.5).
- Exceptional Robustness: In degradation tests, UNICL-SAM showed an average performance decline of only 3.1%, whereas competitors saw drops of up to 8.4%.
- Generalization: It performed remarkably well on the FSS-1000 dataset without ever being trained on those specific categories, proving its "generalist" credentials.
Discussion and Conclusion
UNICL-SAM demonstrates that uncertainty is not just a diagnostic tool but a powerful training signal. By guiding the model to ignore unreliable data and focus on fine-grained parts, it achieves superior stability and accuracy. While the computational cost of Gaussian graphs and the use of fixed cluster counts are areas for future optimization, the synergy between uncertainty-aware adapters and foundation models like SAM offers a robust path forward for generalist vision systems.
Summary updated