In-context segmentation (ICS) uses one or a few annotated reference images to specify what to segment in a target image. Existing training-free ICS approaches typically rely on manually designed inference procedures, which may limit how flexibly reference information is combined. Learned in-context inference offers an adaptive alternative, but acquiring this capability through segmentation-specific training can compromise generalization to unseen domains. We therefore ask: can a pretrained in-context learner infer what to segment from annotated references without segmentation-specific training? We introduce SegPFN, a training-free framework that reformulates ICS as tabular classification over frozen visual features. A frozen tabular prior-data fitted network (PFN) uses labeled reference patches as context to classify patches in the target image. We comprehensively benchmark SegPFN against major existing ICS methods across 11 datasets spanning semantic, part, and personalized segmentation. SegPFN improves overall mean intersection-over-union (mIoU) by 4.7 points over the strongest overall baseline and achieves the highest average mIoU in four of five task-shot settings. Further analyses show that hard-negative reference patches improve fine-grained target discrimination, while joint conditioning enables SegPFN to use multiple references effectively. These results show that SegPFN offers a simple and effective paradigm for training-free in-context segmentation.
Figures & tables
Figure 2: Overview of SegPFN. (a) Reference and target patches are represented by compact visual features. Sampled reference patches and their mask-derived labels form the context. (b) A frozen tabular PFN predicts foreground probabilities for target patches, treating each patch as a row and each feature dimension as a column. (c) Cluster smoothing, reference-guided correction, and a boundary conditional random field (CRF) produce the final mask. Ground truth (GT) is shown only for comparison.
Method
COCO- 20i
LVIS- 92i
ISIC
Lung
iSAID
SUIM
Avg. (6)
Total Avg.
1-shot
5-shot
1-shot
5-shot
1-shot
5-shot
1-shot
5-shot
1-shot
5-shot
1-shot
5-shot
1-shot
5-shot
Additional segmentation-specific training
SINE [ 17 ]
64.53
66.14
31.18
35.54
25.90
27.08
39.84
40.61
38.27
38.53
58.70
62.38
43.07
45.05
44.06
SegIC [ 20 ]
74.05
—
44.44
—
26.92
—
28.76
—
25.63
—
63.35
—
43.86
—
—
FSSAM [ 36 ]
64.22
72.14
37.27
49.71
53.50
68.24
81.11
86.45
50.06
56.21
56.89
61.85
57.18
65.77
61.47
Training-free: mask-supervised visual pretraining
Table 1: One-shot and five-shot semantic segmentation (mIoU in %, ↑ ). Avg. (6) equally weights the six datasets; Total Avg. is the mean of the one-shot and five-shot averages. Bold/underline mark the best/second-best eligible scores. Gray indicates overlap between training and evaluation dataset sources; § marks published Matcher results from INSID3. These entries and affected averages are excluded from ranking.
Table 3
Figure 3: Personalized segmentation with same-category distractors. Reference masks specify the target instance; all methods use identical reference–target image pairs and reference masks. Mask legend: target mask / true positive (TP); distractor ground truth (GT); false positive (FP) on a distractor; other FP; false negative (FN).
Method
PerMIS
CUHK-SYSU-ICS
DAVIS-2017-ICS
FP ratio ↓
FP ratio ↓
FP ratio ↓
DPR ↓
INSID3 [ 6 ]
27.51
45.03
53.52
37.72
FROST [ 23 ]
30.91
50.86
40.18
17.13
FoRIS [ 10 ]
37.33
50.71
58.84
55.20
SegPFN
27.69
39.29
31.12
13.56
Table 4: False-positive analysis of one-shot personalized segmentation (%, ↓ ). FP ratio uses all tasks. DPR uses the 53 DAVIS-2017-ICS tasks with annotated distractors. Bold/underline mark the lowest/second-lowest values.
Table 5: Effect of hard-negative reference-patch replacement. Std.: standard sampling; Repl.: hard-negative replacement. NTPR ( ↓ ) and mIoU ( ↑ ) are percentages; bold marks the better paired value. NTPR uses the nNT eligible tasks, while mIoU uses all N tasks and the same aggregation procedure as the main results. Part results use randomly sampled 500-task benchmark subsets.
Method
Semantic
Part
Avg. (Sem./Part)
FoRIS [ 10 ]
67.89
57.58
62.73
INSID3 [ 6 ]
63.41
53.64
58.52
FROST [ 23 ]
64.74
59.49
62.12
SegPFN ( 5× 1-shot ensemble)
66.27
57.07
61.67
SegPFN (joint 5-shot)
68.96
62.87
65.91
Table 6: Five-shot reference-conditioning comparison on randomly sampled benchmark subsets (mIoU in %, ↑ ). Semantic and Part report averages across six and two datasets, respectively; Avg. (Sem./Part) equally weights the two task means. All methods use DINOv3-L and identical evaluation tasks. SegPFN variants share the feature projection and refinement; context budgets are detailed in the text. Best scores are bold.
Predictor
Semantic
Part
Personalized
Overall
1-shot
5-shot
1-shot
5-shot
1-shot
kNN
50.87
60.28
43.22
54.90
56.53
53.72
RBF ridge
57.88
66.05
45.54
53.99
48.52
53.42
Linear ridge
57.62
65.66
45.09
53.78
48.44
53.17
Logistic
56.60
67.67
46.97
61.51
58.34
58.24
TabPFN 3.5 (SegPFN)
61.11
68.96
52.81
62.87
59.13
60.67
Table 7: Inference-model comparison on randomly sampled benchmark subsets (mIoU in %, ↑ ). Conventional predictors use their best tested configuration on the reported subsets. Task means equally weight six semantic, two part, or three personalized datasets. Overall equally weights the three tasks, averaging shots within Semantic and Part. All predictors share refinement. Best scores are bold.
Configuration
Semantic
Part
Personalized
Overall
PFN baseline
61.69
53.18
59.01
57.96
+ Cluster + smoothing
63.19 [-1pt] (+1.50)
56.13 [-1pt] (+2.95)
58.18 [-1pt] (−0.83)
59.17 [-1pt] (+1.21)
+ Reference-guided + correction
64.67 [-1pt] (+1.48)
57.15 [-1pt] (+1.02)
59.13 [-1pt] (+0.95)
60.32 [-1pt] (+1.15)
Table 8: Cumulative refinement ablation under the main-benchmark protocol (mIoU in %, ↑ ). All rows retain min–max normalization and CRF. Semantic and Part average the one-shot and five-shot results across six and two datasets, respectively; Personalized averages the one-shot results across three datasets. Overall equally weights the three task means. Changes below scores are relative to the preceding row, in percentage points, computed from displayed scores. Best scores are bold.
Brightness, contrast, and saturation factors [0.8,1.2] Hue offset [−0.05,0.05]
PCA dimension
128 per representation
PFN input dimension
128 PCA features (one shot) 128+3+2=133 (two or more shots) PCA + mean RGB + normalized (x,y)
PFN ensemble
2 raw + 2 debiased estimators
Appendix
Table 9: Feature and PFN settings for SegPFN inference.
Dataset
One-shot tasks
Five-shot tasks
Semantic segmentation
COCO- 20i
4,000
4,000
LVIS- 92i
23,000
23,000
ISIC
600
600
Lung
600
600
iSAID
10,063
10,063
Appendix
Table 10: Number of tasks used to evaluate SegPFN in the main comparisons. DAVIS-2017-ICS and CUHK-SYSU-ICS each use a fixed list of one-shot tasks.
Dataset
1-shot
5-shot
Semantic segmentation
COCO- 20i
1,000
1,000
LVIS- 92i
1,000
1,000
ISIC
600
600
Lung
600
600
iSAID
1,000
1,000
Appendix
Table 11: Evaluation subsets for the classifier and backbone comparisons. The five-reference comparison uses the five-shot column. Personalized segmentation uses one shot only.
Benchmark
Tasks
Reference–target pairs
DAVIS-2017-ICS
53
20
CUHK-SYSU-ICS
151
113
Appendix
Table 12: Personalized benchmark sizes. Each one-shot task selects one instance in an ordered reference–target pair. We count each pair once across tasks.
Figure 5: Selecting instances on fixed DAVIS frame pairs. The same color identifies an athlete, pig, or phone across the reference and target frames. Each colored instance defines a separate one-shot task with its own binary reference mask.
Figure 6: Following one person across CUHK-SYSU images. Blue masks mark the requested person in the reference (left) and target ground truth (right). Dashed yellow boxes mark other people. For display only, we pixelate visible faces for privacy.
DAVIS-2017-ICS
CUHK-SYSU-ICS
Best baseline
FROST
Matcher
Est.
95% CI
Est.
95% CI
SegPFN
55.92
[46.31,67.33]
49.71
[43.17,56.20]
Baseline
50.18
[41.43,59.63]
50.02
[45.11,54.90]
Δ (pp)
+5.74
[0.60,11.12]
−0.31
[−6.16,5.55]
Omit one group
[+4.29,+7.10]
[−1.57,+0.66]
Appendix
Table 13: Stability of one-shot pooled foreground IoU. Method scores are percentages. Δ is the paired difference (SegPFN minus baseline) in percentage points (pp). We report 95% bootstrap percentile confidence intervals (CIs). The last row gives the range of Δ after omitting each group in turn.
Dataset / shot
Method
Foreground mIoU (%) ↑
Non-target positive rate (%) ↓
Hard negatives retained (%)
0
10
25
50
100
0
10
25
50
100
DAVIS-2017-ICS 1-shot (53/53)
SegPFN
33.24
56.42
57.45
57.18
55.92
66.44
24.27
16.67
14.75
13.56
FoRIS
31.12
32.30
35.07
38.26
38.68
73.48
71.04
66.27
60.17
55.20
FROST
50.34
51.10
50.88
50.68
50.18
10.47
12.32
13.88
15.25
17.13
INSID3
30.18
39.60
40.02
39.96
38.75
69.71
45.27
43.07
40.72
37.72
PASCAL-Part 1-shot (410/500)
SegPFN
48.17
55.65
56.33
56.04
55.89
28.17
13.15
11.85
11.32
11.03
Appendix
Table 14: Hard-negative retention across datasets and shot settings. The left columns report foreground mIoU and the right columns report the non-target positive rate (NTPR). Retention percentages refer to each method’s own pool of hard-negative reference patches. Counts in parentheses give the number of tasks with annotated non-target pixels used for NTPR out of the total number evaluated for mIoU.
Figure 7: Hard-negative retention on DAVIS-2017-ICS. We compare SegPFN, FoRIS, FROST, and INSID3 as the fraction of retained hard-negative reference patches increases from 0% to 100%. The top panel (a) shows foreground mIoU and the bottom panel (b) shows the non-target positive rate (NTPR).
Figure 8: Mean foreground mIoU by reference count. Dotted lines mark the best five-shot baselines, FoRIS on semantic segmentation (67.18%) and FROST on part segmentation (59.22%).
References
SegPFN
FoRIS
FROST
INSID3
Semantic segmentation (6 datasets)
1
60.12
61.20
55.22
56.68
2
64.01
64.35
59.15
58.04
3
66.73
66.02
62.40
61.47
5
69.22
67.18
64.98
63.05
Part segmentation (2 datasets)
Appendix
Table 15: Foreground mIoU (%) by number of annotated references. Scores give equal weight to each dataset within a task. The one- and five-shot results are from Tables 1 and 3 of the main paper. Bold marks the highest mIoU in each row.
Table 21
Dataset
1-shot
5-shot
PFN baseline
+ Cluster smoothing
+ Reference-guided correction
PFN baseline
+ Cluster smoothing
+ Reference-guided correction
Semantic segmentation
COCO- 20i
51.17
54.83
58.35
66.71
68.35
68.63
LVIS- 92i
40.09
41.38
42.57
56.72
57.08
56.67
ISIC
52.04
56.67
60.46
63.24
65.64
67.93
Lung
89.04
87.37
86.53
90.35
88.01
86.92
Appendix
Table 18: Dataset-level prediction-refinement ablation on DINOv3-L under the main-benchmark protocol. Values are foreground mIoU (%). Within each shot setting, the columns add cluster smoothing and then reference-guided correction to the PFN baseline. Bold marks the highest score in each row for that shot setting. Parentheses give personalized task counts, and dashes mark unevaluated settings.
Backbone
Method
Semantic (6)
Part (2)
Personalized (3)
Overall
1-shot
5-shot
1-shot
5-shot
1-shot
DINOv3-S
INSID3 [ 6 ]
32.38
36.27
34.01
39.70
26.78
32.65
FROST [ 23 ]
46.70
56.57
35.22
45.21
46.74
46.20
FoRIS [ 10 ]
48.81
58.35
37.57
44.08
35.18
43.20
SegPFN (default)
48.55
60.26
39.61
47.81
39.93
46.01
w/o reference-guided correction
49.72
62.13
40.90
53.34
42.37
48.47
Appendix
Table 19: Foreground mIoU (%) across DINOv3 backbone sizes on the matched evaluation subsets. Parentheses in the task headings give dataset counts. The indented SegPFN rows disable reference-guided correction alone or both correction and cluster smoothing. All three SegPFN configurations retain min–max normalization and CRF. Overall weights the three tasks equally after averaging shot settings within each task. Bold and underline mark the best and second-best scores within each backbone and column.
Method
1-shot
5-shot
FoRIS
0.99
1.98
FROST
0.47
2.72
INSID3
0.61
1.18
SegPFN
4.48
7.00
Appendix
Table 20: Inference latency with cached visual features. We report the median time per task in seconds. Bold marks the fastest method for each reference count.
Xi’an Institute of Optics and Precision Mechanics, Chinese Academy of Sciences · University of Chinese Academy of Sciences · Xi’an Jiaotong University +1