File size: 7,067 Bytes
8332ba8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f93b4bf
 
4fd8c00
8332ba8
6d3edc4
 
 
 
 
 
8332ba8
 
 
6d3edc4
 
4fd8c00
 
 
 
 
8332ba8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fd8c00
 
 
 
 
 
8332ba8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fd8c00
8332ba8
 
4fd8c00
 
8332ba8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fd8c00
 
 
8332ba8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
pretty_name: FAME Benchmark
license: other
task_categories:
- image-segmentation
tags:
- medical-image-segmentation
- few-shot-segmentation
- semantic-segmentation
- benchmark
size_categories:
- 10K<n<100K
configs:
- config_name: preview
  data_files:
  - split: preview
    path: viewer/fame_preview.parquet
- config_name: pixels
  data_files:
  - split: full
    path: data_shards/fame_image_mask_pairs-*.parquet
---

# FAME Benchmark

FAME is a benchmark for zero-shot, few-shot, and OOD medical image segmentation. It is introduced in [arXiv:2607.27856](https://arxiv.org/abs/2607.27856): **Benchmarking Foundation and Large Language Models for Few-Shot Medical Image Segmentation**.

If you use this benchmark, please cite the FAME paper. The BibTeX entry is provided in the [Citation](#citation) section.

This Hugging Face dataset contains the released FAME JSON/JSONL protocols plus all referenced image and mask pixels. To keep the repository usable on Hugging Face, the protocols are packaged in `protocols/FAME_benchmark_protocols.tar.gz`, and the pixels are stored as Parquet shards with `image` and `mask` columns so samples can be inspected in Dataset Viewer/Data Studio. After extracting the protocol archive, `tools/extract_pixels_from_parquet.py` can materialize the raw image and mask files referenced by the protocol JSONL files.

## What Is Segmented?

The montage below shows representative positive target masks from the released FAME tasks. Magenta indicates the foreground mask and yellow indicates the mask contour.

![Representative FAME segmentation targets](assets/fame_segmentation_targets_overview.png)

## Directory Layout

```text
assets/
  fame_segmentation_targets_overview.png
protocols/
  FAME_benchmark_protocols.tar.gz

After extracting protocols/FAME_benchmark_protocols.tar.gz:

FAME_benchmark/
  tasks/<task>/
    task_info.json
    train_pool.jsonl
    train_positive.jsonl
    train_negative.jsonl
    test.jsonl
    test_positive.jsonl
    test_negative.jsonl
  episodes/k10_seed{0..4}/<task>/
    support.jsonl
    train.jsonl
    test.jsonl
  episodes/zero_shot/<task>/
    test.jsonl
  ood/FAME_ood_pairs.csv
  ood_episodes/k10_seed0/<pair_id>/
    support.jsonl
    test.jsonl
    ood_pair_info.json
  task_lists/FAME_benchmark_tasks.txt
  task_stats.csv
data_shards/
  fame_image_mask_pairs-*.parquet
viewer/
  fame_preview.parquet
metadata/
  protocol_summary.json
  pixel_shard_manifest.csv
  image_mask_pair_manifest.csv
  iid_dataset_summary.csv
  ood_pair_summary.csv
tools/
  load_fame.py
  extract_pixels_from_parquet.py
```

## Protocols

Extract the protocol archive first:

```bash
tar -xzf protocols/FAME_benchmark_protocols.tar.gz
```

Zero-shot evaluation uses the frozen query set for each IID ROI task and no support masks:

```text
FAME_benchmark/episodes/zero_shot/<task>/test.jsonl
```

Few-shot evaluation uses 10 positive support examples per task with five fixed seeds:

```text
FAME_benchmark/episodes/k10_seed0/<task>/
FAME_benchmark/episodes/k10_seed1/<task>/
FAME_benchmark/episodes/k10_seed2/<task>/
FAME_benchmark/episodes/k10_seed3/<task>/
FAME_benchmark/episodes/k10_seed4/<task>/
```

OOD evaluation uses 10 support examples from the source task and evaluates on a target task under covariate or semantic shift:

```text
FAME_benchmark/ood/FAME_ood_pairs.csv
FAME_benchmark/ood_episodes/k10_seed0/<pair_id>/
```

## Dataset Summary

- IID ROI tasks: 21
- IID source datasets: 19/19
- IID test samples: 14,958 total, 13,689 positive, 1,269 negative
- Pixel pairs: 78431 image/mask pairs
- Pixel shards: 77 Parquet files
- Organs: brain, breast, colon, lung, retina, skin, thyroid
- Modalities: CT, MRI, MRI_adc, OCT, colonoscopy, color_fundus_photography, dermoscopy, histopathology, ultrasound

## Pixel Storage

Each row in `data_shards/fame_image_mask_pairs-*.parquet` contains:

- `image`: image bytes and the original repository-relative path
- `mask`: mask bytes and the original repository-relative path
- `image_path` and `mask_path`: paths referenced by the JSON/JSONL protocols
- task-level metadata such as dataset, organ, modality, task, target, and case id

The `preview` config is small and intended for quick visual inspection. The `pixels` config contains the full image/mask pixel store.

## Materialize Raw Files

To run code that expects the JSON paths and raw pixel files to exist on disk, extract the protocols and then extract the Parquet pixel store:

```bash
tar -xzf protocols/FAME_benchmark_protocols.tar.gz

python tools/extract_pixels_from_parquet.py \
  --root /path/to/FAME-benchmark \
  --out-root /path/to/FAME-benchmark
```

This creates the `data/benchmark_dataset/...` and `data/benchmark_dataset_ood/...` image/mask files referenced by the protocol JSONL files.

## Load Episodes in Python

```python
from pathlib import Path
from tools.load_fame import list_ood_pairs, list_tasks, load_episode, load_ood_episode

release_root = Path("/path/to/FAME-benchmark")

tasks = list_tasks(release_root)
support, query = load_episode(
    release_root,
    "ISIC2018__ISIC2018_skin_lesion",
    seed=0,
    resolve_paths=False,
)
print(len(support), len(query))
print(query[0]["image"], query[0]["mask"])

ood_pairs = list_ood_pairs(release_root)
ood_support, ood_query, ood_info = load_ood_episode(
    release_root,
    "cov_BUSI_to_BUID_breast_mass",
    resolve_paths=False,
)
print(ood_info["shift_type"], len(ood_support), len(ood_query))
```

Set `resolve_paths=True` after running `tools/extract_pixels_from_parquet.py`.

## Run STAMP-2B or MedSAM3

```bash
cd /path/to/Disease-conditionalSeg
export FAME_RELEASE=/path/to/FAME-benchmark

tar -xzf "${FAME_RELEASE}/protocols/FAME_benchmark_protocols.tar.gz" \
  -C "${FAME_RELEASE}"

python "${FAME_RELEASE}/tools/extract_pixels_from_parquet.py" \
  --root "${FAME_RELEASE}" \
  --out-root "${FAME_RELEASE}"

ln -sfn "${FAME_RELEASE}/data" ./data

export POOL_ROOT="${FAME_RELEASE}/FAME_benchmark"
export EPISODE_ROOT="${FAME_RELEASE}/FAME_benchmark/episodes"
export TASKS="${FAME_RELEASE}/FAME_benchmark/task_lists/FAME_benchmark_tasks.txt"
export K=10
export SEED=0
export GPUS=0,1,2,3

bash scripts/bench/run/download_weights.sh check

bash scripts/bench/run/stamp.sh 2b_in_context
bash scripts/bench/run/stamp.sh 2b_zero_disease

bash scripts/bench/run/medsam3.sh ten_support
bash scripts/bench/run/medsam3.sh zero_disease
```

## License and Data Access

FAME is provided for non-clinical research benchmarking. The underlying medical images and annotations remain governed by the licenses and access conditions of their original datasets.

## Citation

If you use FAME, please cite:

```bibtex
@misc{liu2026benchmarkingfoundationlargelanguage,
      title={Benchmarking Foundation and Large Language Models for Few-Shot Medical Image Segmentation},
      author={Jinghong Liu and Yuchuan Deng and Fanping Liu and Meng Huang and Xirong Li},
      year={2026},
      eprint={2607.27856},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2607.27856},
}
```