MedSeg-7D / README.md
MaybeRichard's picture
Adopt PraNet 900/100 (Kvasir) and 550/62 (CVC) as canonical splits
7da79a9 verified
---
license: other
language:
- en
pretty_name: MedSeg-7D
size_categories:
- 10K<n<100K
task_categories:
- image-segmentation
tags:
- medical-imaging
- segmentation
- diffusion-augmentation
- endoscopy
- dermoscopy
- ultrasound
- fundus
- mri
---
# MedSeg-7D: Seven Public Medical Segmentation Benchmarks (2D + 3D)
A curated bundle of seven public medical segmentation datasets, packaged
with **canonical leakage-free splits** for the four datasets where one is
needed (ACDC patient-level, BraTS2020 volume-level, CVC-ClinicDB
video-level, plus seed-fixed image-level for the rest). All raw images and
masks are retained at their original resolution; no resizing, no
preprocessing baked in.
For the two volumetric MRI datasets (ACDC, BraTS), this release ships
**both 2D slice extracts and the original 3D NIfTI volumes**, so users can
choose 2D or 3D pipelines without re-downloading.
This is the **dataset-only release** that accompanied an evaluation-protocol
audit of pixel- vs.\ latent-space diffusion augmentation for medical image
segmentation. The bundle is reusable for any 2D medical-segmentation
research, not just the original study.
> **Why this exists.** Many existing medical-augmentation papers report
> non-comparable numbers because each uses a different (often undocumented)
> train/test split, and several datasets have hidden leakage if split at
> the image level (CVC same-video frames, ACDC same-patient slices, BraTS
> same-volume slices). This release fixes one canonical split per dataset
> so future work can be paired-comparable.
---
## Contents
```
MedSeg-7D/
├── README.md
├── ACDC/ (cardiac MRI, 100 patients)
│ ├── images/ 2D slices: patient<id>_frame<f>_slice_<s>.png
│ ├── masks/ matching 2D-slice mask filenames (any-structure binary)
│ ├── 3D/ ORIGINAL 3D NIfTI volumes (challenge layout)
│ │ ├── training/
│ │ │ ├── patient001/ Info.cfg + patient001_4d.nii.gz + frame01.nii.gz + frame01_gt.nii.gz + frame12.nii.gz + frame12_gt.nii.gz
│ │ │ └── ... (100 patients)
│ │ └── testing/ 50 held-out patients (challenge test set)
│ └── split_info.json CANONICAL patient-level split (seed=42, 80/20)
│ # 2D and 3D share the same 100-patient training cohort. The 3D side
│ # additionally ships the official 50 challenge test patients, which the
│ # 2D side does NOT include (we re-split the 100 train patients 80/20).
├── BraTS2020/ (brain MRI FLAIR, 369 volumes → 22677 slices)
│ ├── images/
│ │ ├── volume_1/ volume_1_slice_<s>.png (FLAIR channel, ~50-80 slices/vol)
│ │ ├── volume_2/
│ │ └── ... (369 vols)
│ ├── masks/
│ │ ├── volume_1/ matching whole-tumor binary mask
│ │ └── ... (369 vols)
│ └── split_info.json CANONICAL volume-level split (seed=42, 295/74)
│ # NOTE: BraTS slices are nested into per-volume subdirectories because of
│ # HuggingFace's 10000 files-per-directory limit. Filenames preserve the
│ # original volume_X_slice_Y.png convention.
├── BraTS2021_3D/ (brain MRI 3D NIfTI, 1251 patients — superset of BraTS2020)
│ ├── BraTS2021_00000/ 5 NIfTI files: t1, t1ce, t2, flair, seg (4 modalities + GT)
│ ├── BraTS2021_00002/
│ └── ... (1251 patient dirs)
│ # IMPORTANT: This is BraTS *2021*, a SUPERSET of BraTS 2020. The 369
│ # volumes in our 2D `BraTS2020/` are a subset of the 1251 here. Patient
│ # IDs differ between the 2020 and 2021 releases, so split_info.json
│ # (volume-level for 2020) does NOT apply to BraTS2021_3D directly. Do
│ # not mix 2D and 3D Dice numbers.
├── BUSI/ (breast ultrasound, 780 images)
│ ├── images/
│ └── masks/ masks suffixed _mask.png
├── CVC-ClinicDB/ (endoscopy polyp, 612 frames / 29 video sequences)
│ ├── PNG/
│ │ ├── Original/ RGB frames
│ │ └── Ground Truth/ binary masks
│ ├── TIF/ original release format
│ ├── metadata.csv per-frame metadata
│ ├── class_dict.csv
│ ├── pranet_split.json PRIMARY: PraNet 550/62 image-level split (literature-standard)
│ └── video_split_seed42.json ALTERNATIVE: leakage-free 23/6 video-level split (more rigorous)
├── Kvasir-SEG/ (endoscopy polyp, 1000 images)
│ ├── images/ RGB frames
│ ├── masks/ binary masks
│ ├── bbox/ bounding boxes (auxiliary)
│ ├── pranet_split.json PRIMARY: PraNet 900/100 train/test split (literature-standard)
│ └── kavsir_seg_README.md original release notes
├── REFUGE2/ (fundus optic disc, 1200 images = 400 train + 400 val + 400 test)
│ ├── train/ {images/, mask/} 400 images
│ ├── val/ {images/, mask/} 400 images
│ └── test/ {images/, mask/} 400 images
└── ISIC2018/ (dermoscopy lesions, 2594 train + 100 val + 1000 test)
├── train/ {images/, masks/}
├── validation/ {images/, masks/}
└── test/ {images/, masks/}
```
Approximate total size: ~18 GB.
---
## Per-dataset details
### 1. ACDC — Cardiac cine-MRI
| | |
|---|---|
| **Modality** | Cardiac cine-MRI (2D slices) |
| **Original task** | Multi-class cardiac structure segmentation |
| **Patients / slices** | 100 / 1841 |
| **Mask classes** | 4 (background, RV, myocardium, LV) — preserved as in the original release |
| **Split type (canonical)** | **Patient-level**, 80 train / 20 test, seed=42 |
| **Split file** | `ACDC/split_info.json` |
| **Leakage risk** | None at patient level. Slice-level random split would leak adjacent slices and inflate Dice ~5 points. |
| **Source** | [ACDC Challenge (MICCAI 2017)](https://www.creatis.insa-lyon.fr/Challenge/acdc/) |
| **Reference** | Bernard et al., *IEEE TMI 2018* |
| **License** | Original ACDC license; please refer to the original challenge website. |
### 2. BraTS 2020 — Brain tumor MRI (FLAIR slices)
| | |
|---|---|
| **Modality** | Brain MRI, FLAIR channel |
| **Original task** | Multi-class tumor segmentation |
| **Volumes / slices** | 369 / 22677 (this release: FLAIR-only 2D slices) |
| **Mask convention here** | Whole-tumor binary (label 1+2+4 → 1) |
| **Split type (canonical)** | **Volume-level**, 295 train / 74 test, seed=42 |
| **Split file** | `BraTS2020/split_info.json` |
| **Leakage risk** | None at volume level. Slice-level random would leak adjacent slices ~5 Dice points. |
| **Note** | Only the FLAIR modality is included. The original BraTS release has T1/T1ce/T2 in addition. If you need multi-modal data, fetch the original release. |
| **Source** | [BraTS 2020 Challenge](https://www.med.upenn.edu/cbica/brats2020/) |
| **Reference** | Menze et al., *IEEE TMI 2015*; Bakas et al., 2017 |
| **License** | Original BraTS license; please refer to the challenge website. |
### 3. BUSI — Breast ultrasound
| | |
|---|---|
| **Modality** | B-mode breast ultrasound |
| **Original task** | Lesion segmentation (benign / malignant / normal classes are also available) |
| **Images** | 780 |
| **Mask convention** | Binary foreground; mask filenames carry `_mask.png` suffix |
| **Split type (canonical)** | Image-level, 80/20, seed=42 |
| **Leakage risk** | ⚠️ The release does **not** publish patient IDs. Multiple images may come from the same patient. The image-level split is the community standard; "patient-level" cannot be verified from the release. |
| **Source** | [BUSI Dataset (Cairo University)](https://scholar.cu.edu.eg/?q=afahmy/pages/dataset) |
| **Reference** | Al-Dhabyani et al., *Data in Brief 2020* |
| **License** | CC-BY-4.0 |
### 4. CVC-ClinicDB — Colonoscopy polyp
| | |
|---|---|
| **Modality** | Colonoscopy (RGB endoscopy) |
| **Original task** | Polyp segmentation |
| **Frames / video sequences** | 612 / 29 |
| **Mask convention** | Binary polyp foreground |
| **PRIMARY split (literature-standard)** | PraNet's **550/62** image-level train/test, used by PraNet, Polyp-PVT, SANet, ESFPNet and most polyp papers |
| **Primary split file** | `CVC-ClinicDB/pranet_split.json` |
| **ALTERNATIVE split (leakage-free)** | **Video-level**, 23 train / 6 test sequences, seed=42 (489 frames train, 123 frames test) |
| **Alternative split file** | `CVC-ClinicDB/video_split_seed42.json` |
| **Important note** | The PraNet split is image-level and **leaks same-video frames** across train/test (CVC has 29 underlying sequences). Use it for direct comparison to literature; use video-level for honest leakage-free generalization numbers. The two are not directly cross-comparable in absolute Dice. |
| **Source** | [CVC-ClinicDB](https://polyp.grand-challenge.org/CVCClinicDB/) |
| **Reference** | Bernal et al., *Computerized Medical Imaging and Graphics 2015* |
| **License** | Released for academic use; cite the original paper. |
### 5. Kvasir-SEG — Colonoscopy polyp
| | |
|---|---|
| **Modality** | Colonoscopy (RGB endoscopy) |
| **Original task** | Polyp segmentation |
| **Images** | 1000 |
| **Mask convention** | Binary polyp foreground |
| **PRIMARY split (literature-standard)** | PraNet's **900/100** train/test (specific file lists), used by PraNet, Polyp-PVT, SANet, ESFPNet and the entire polyp-segmentation literature |
| **Primary split file** | `Kvasir-SEG/pranet_split.json` |
| **Leakage risk** | The release does not publish per-procedure metadata. Image-level is the community standard; per-procedure leakage cannot be audited. |
| **Note** | Filenames in our release use `.jpg` (the original Kvasir-SEG extension); PraNet ships them as `.png` after conversion — basenames match exactly. Auxiliary `bbox/` (bounding boxes) included from the original release. |
| **Source** | [Kvasir-SEG](https://datasets.simula.no/kvasir-seg/) |
| **Reference** | Jha et al., *MMM 2020* |
| **License** | CC-BY-4.0 |
### 6. REFUGE2 — Fundus optic disc
| | |
|---|---|
| **Modality** | Fundus photography |
| **Original task** | Optic disc and cup segmentation |
| **Images** | 1200 = 400 train + 400 validation + 400 test (full official challenge release) |
| **Mask convention** | Multi-class (BG / disc / cup) preserved; for binary disc segmentation, treat any non-background pixel as foreground |
| **Split type** | Pre-released **400/400/400 train/val/test** split is preserved |
| **Leakage risk** | None — each image is from a different patient by protocol. |
| **Caveat** | Modern segmenters reach ≥99.9 Dice on optic-disc segmentation; this dataset is **saturated** for that task. Use only when you specifically need fundus / glaucoma data. |
| **Source** | [REFUGE2 Challenge](https://refuge.grand-challenge.org/) |
| **Reference** | Orlando et al., *Medical Image Analysis 2020*; Fang et al., *Medical Image Analysis 2022* |
| **License** | Original REFUGE2 license; please refer to the challenge website. |
### 7. ISIC 2018 — Dermoscopy
| | |
|---|---|
| **Modality** | Dermoscopy |
| **Original task** | Skin lesion segmentation (Task 1) |
| **Images** | 2594 train + 100 val + 1000 test (this release: PNG-extracted from the original ISIC 2018 archive) |
| **Mask convention** | Binary lesion foreground (any-pixel > 0 → 1) |
| **Split type** | Pre-released train/validation/test split is preserved |
| **Leakage risk** | The release does not publish patient IDs. Multiple lesions per patient are possible but cross-lesion contamination is generally considered low risk. |
| **Source** | [ISIC 2018 Challenge](https://challenge.isic-archive.com/landing/2018) |
| **Reference** | Codella et al., 2019; Tschandl et al., *Sci. Data 2018* |
| **License** | CC-BY-NC-4.0 (HAM10000-derived images) |
---
## Comparison to literature and existing HuggingFace cards
We audited the most common split conventions in published segmentation papers
(MICCAI / IEEE TMI / MIA / CVPR / NeurIPS) and the two existing HuggingFace
community cards for the same datasets, then aligned our defaults where
sensible. Summary:
| Dataset | Mainstream literature default | HuggingFace community card | **Our default** | Verdict |
|---|---|---|---|---|
| CVC-ClinicDB | PraNet's **550/62** image-level files (de facto standard since 2020) | `Angelou0516/CVC-ClinicDB`: 80/10/10 image-level, ESFPNet split | **PraNet 550/62 (`pranet_split.json`) as primary; video-level 23/6 (`video_split_seed42.json`) as leakage-free alternative** | ✅ Matches PraNet exactly + adds a leakage-audit option that nobody else ships |
| Kvasir-SEG | PraNet's **900/100** file list (de facto standard) | `kowndinya23/Kvasir-SEG`: 880/120 (no test) | **PraNet 900/100 (`pranet_split.json`)** | ✅ Matches PraNet exactly |
| BUSI | Image-level random; growing minority does 5-fold + de-duplication (BUS-Set, Med Phys 2023, documents duplicate leakage) | n/a | Image-level 80/20 seed=42 | Matches majority; **flag**: BUSI release has documented duplicates, and patient IDs are not public, so true patient-level splits are not possible |
| ISIC 2018 | Official 2594/100/1000 OR pooled 80/20 | varies | Official 2594/100/1000 preserved | Matches official challenge split |
| REFUGE2 | Official 400/400/400 (train/val/test domain-shift design) | varies | Official train/val/test preserved | Matches official |
| ACDC | Patient-level; TransUNet 70/10/20 of the 100 train OR nnU-Net 5-fold patient CV | rarely correct on HF | Patient-level 80/20 seed=42 (in `split_info.json`); 3D side **also** ships official 100-train + 50-test challenge layout | Stricter than the careless cards; consistent with TransUNet/nnU-Net practice |
| BraTS 2020 | Volume-level; nnU-Net 5-fold patient CV is the most-cited recipe | rarely correct on HF | Volume-level 80/20 seed=42 (295/74) | Matches the careful camp; nnU-Net's 5-fold is a reasonable alternative on the same volumes |
**Mainstream papers we cross-checked**: PraNet (Fan et al., MICCAI 2020),
Polyp-PVT (Dong et al., 2021), ESFPNet (Chang et al., 2024), BUS-Set
(Thomas et al., Med Phys 2023), TransUNet (Chen et al., 2021), SwinUNet
(Cao et al., 2022), nnU-Net (Isensee et al., Nat. Methods 2021).
### Notable disagreements with HuggingFace community cards
- `kowndinya23/Kvasir-SEG` (880/120) merges the test fold into validation,
making it **non-comparable to PraNet's 900/100**. Ours preserves
test/val separation.
- `Angelou0516/CVC-ClinicDB` does image-level 80/10/10 without flagging
the same-video frame leakage that affects all 3 splits. We add an
explicit video-level split for leakage-free evaluation.
- Neither HuggingFace card we found exposes patient-level splits for
ACDC or BraTS — we provide them via `split_info.json`.
### When to *not* use our defaults
- If you must **directly compare to PraNet/Polyp-PVT** numbers, use their
released 1450/test files (not in this bundle, but reproducible from the
raw images here).
- If you need **nnU-Net 5-fold CV** on ACDC or BraTS, regenerate folds
with the standard nnU-Net recipe — our 80/20 split is a single-fold
approximation.
- If you need **BraTS 2021 (1251 volumes)** instead of 2020 (369), the
3D version is shipped under `BraTS2021_3D/` (subset of 2020 patients
is included; new 2021-specific patients are added).
---
## Recommended use
**For paired-comparison evaluation across methods**, lock to the canonical
splits in this release:
```python
import json, os
from huggingface_hub import snapshot_download
ROOT = snapshot_download("MaybeRichard/MedSeg-7D", repo_type="dataset")
# ACDC (patient-level)
info = json.load(open(os.path.join(ROOT, "ACDC", "split_info.json")))
train_patients = set(info["train_patients"])
# enumerate slices, check patient ID in filename to assign train/test
# BraTS (volume-level) — slices are nested under per-volume subdirs
info = json.load(open(os.path.join(ROOT, "BraTS2020", "split_info.json")))
train_volumes = set(info["train_patients"]) # key name retained from original
# To enumerate all training slices:
# for vol in train_volumes:
# for img_path in glob.glob(f"{ROOT}/BraTS2020/images/{vol}/*.png"):
# ...
# Kvasir-SEG (PraNet 900/100, literature standard)
info = json.load(open(os.path.join(ROOT, "Kvasir-SEG", "pranet_split.json")))
train_files = set(info["train_files"]) # 900 file basenames (.jpg)
test_files = set(info["test_files"]) # 100 file basenames (.jpg)
# CVC-ClinicDB (PraNet 550/62, literature standard — has same-video leakage!)
info = json.load(open(os.path.join(ROOT, "CVC-ClinicDB", "pranet_split.json")))
train_files = set(info["train_files"]) # 550 frames as <n>.png
test_files = set(info["test_files"]) # 62 frames as <n>.png
# CVC-ClinicDB (video-level 23/6, leakage-free alternative)
info = json.load(open(os.path.join(ROOT, "CVC-ClinicDB", "video_split_seed42.json")))
train_seqs = set(info["train_sequences"])
```
For the **3D NIfTI versions**:
```python
import nibabel as nib
import os
# ACDC 3D (original challenge layout, 100 train + 50 test patients)
patient_dir = os.path.join(ROOT, "ACDC", "3D", "training", "patient001")
img = nib.load(os.path.join(patient_dir, "patient001_frame01.nii.gz")).get_fdata()
gt = nib.load(os.path.join(patient_dir, "patient001_frame01_gt.nii.gz")).get_fdata()
# img shape: (H, W, num_short_axis_slices); gt has 4 classes (0=BG, 1=RV, 2=Myo, 3=LV)
# BraTS 2021 3D (1251 patients, 4 modalities + GT each)
pat = os.path.join(ROOT, "BraTS2021_3D", "BraTS2021_00000")
flair = nib.load(os.path.join(pat, "BraTS2021_00000_flair.nii.gz")).get_fdata()
seg = nib.load(os.path.join(pat, "BraTS2021_00000_seg.nii.gz")).get_fdata()
# seg has 4 classes (0=BG, 1=necrotic, 2=edema, 4=enhancing); whole-tumor = (seg > 0)
```
For **BUSI**, the only dataset without a packaged split file, use a
seed-fixed image-level 80/20 split:
```python
import numpy as np
def get_image_level_split(n_images, seed=42, train_ratio=0.8):
perm = np.random.RandomState(seed).permutation(n_images)
n_train = int(n_images * train_ratio)
return perm[:n_train], perm[n_train:]
```
(BUSI's release does not include patient IDs, so a true patient-level
split is not possible. See per-dataset notes for caveats.)
---
## Known caveats and good practices
1. **Never use slice-level random split for ACDC or BraTS.** Same-patient
adjacent slices end up on both sides and inflate Dice ~5 points.
Always read `split_info.json`.
2. **CVC image-level split is leaky.** Same-video frames cross train/test.
Use the video-level split (`video_split_seed42.json`) for clean
evaluation. Use image-level only for direct comparison to legacy
literature, and label such results as "leakage-audited / auxiliary".
3. **BUSI / Kvasir / ISIC do not provide patient IDs.** Image-level random
is the de-facto community standard; do not claim "patient-level
independent" — there is no metadata to verify it.
4. **REFUGE2 saturates at ~99.9 Dice.** Don't use it as a downstream
evaluator for augmentation studies; use it only when you need a
fundus / optic-disc task specifically.
5. **Mask conventions vary across datasets.** Some are multi-class
(ACDC: 4 classes; BraTS original: 4 classes; REFUGE2: 3 classes).
For binary segmentation, use `mask > 0`. The released masks here
keep the original multi-class labels where applicable (no
information lost), so users can choose to binarize as needed.
6. **All images and masks are at original resolution.** No
pre-processing baked in; you can resize per your protocol.
---
## Citation
If this release is useful, please cite both the original dataset papers
(see per-dataset references above) and the evaluation-protocol audit that
produced these canonical splits:
```bibtex
@inproceedings{medseg7d2026,
title = {An Evaluation-Protocol Audit of Pixel- vs.\ Latent-Space Diffusion
Augmentation for Medical Image Segmentation},
author = {Anonymous},
booktitle = {NeurIPS 2026 (E\&D Track)},
year = {2026}
}
```
## License
This release does **not** redistribute datasets that are not already
publicly available. Each dataset retains its original license; consult
each per-dataset section above. The split metadata files
(`split_info.json`, `video_split_seed42.json`) are released under MIT.