FAME_benchmark / README.md
Kimokcheon's picture
Add FAME segmentation target overview to dataset card
6d3edc4 verified
|
Raw
History Blame Contribute Delete
7.07 kB
metadata
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: 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 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

Directory Layout

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:

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:

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

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

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:

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:

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

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

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:

@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},
}