cs.CVNov 18, 2026

DINO-KNN: Training-Free Multiclass In-Context Segmentation via Nearest Neighbors

Authors: Hussain Alasmawi, Numan Saeed, Mohammad Yaqub

Organizations: Division of Computing and Mathematical Sciences, Mohamed bin Zayed University of Artificial Intelligence (MBZUAI), Abu Dhabi, United Arab Emirates

Abstract

In-context segmentation (ICS) segments a target image given a few annotated reference images. Recent training-free methods built on frozen foundation models segment one class at a time and gain little from additional references. We study the multiclass, multi-reference setting and ask how far a simple joint decision rule can go. We introduce DINO-KNN, which stores every labeled reference patch of a frozen DINOv3 encoder in a single memory and labels each target patch by a distance-weighted vote of its k nearest neighbors. All classes are predicted in a single pass, with one label per pixel, without training or a mask decoder. We evaluate on eight datasets, four natural and four medical, with R=1 to 15 reference images and three reference seeds. DINO-KNN achieves the best average mIoU at every R; it is the best method on six of the eight datasets from R=3 and on seven of the eight from R=7. Its accuracy continues to grow with the number of references, from 37.8 mIoU at R=1 to 56.2 at R=15, while the strongest baseline, INSID3, rises from 36.1 to 42.9. DINO-KNN is also 2.1x faster than INSID3. The code will be made public.

Figures & tables

Explore similar work

CardsList
  1. INSID3: Training-Free In-Context Segmentation with DINOv3

    Mar 30, 2026Claudia Cuttano, Gabriele Trivigno, Christoph Reich +3Interactive Image SegmentationImage Segmentation

  2. SegPFN: Training-Free In-Context Segmentation with Tabular Prior-Data Fitted Networks

    Nov 24, 2026Jiajian Ma, Yihao Qiao, Ke Chen +5Few-Shot Semantic Segmentation

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

    Sep 3, 2026Ming Hu, Jianfu Yin, Mingyu Dou +5Image SegmentationFew-Shot Semantic Segmentation