C / README.md
milkyroad's picture
Update README for flattened single-split structure with inline segmentation
b6315dd verified
|
Raw
History Blame Contribute Delete
3.32 kB
metadata
language:
  - en
license: cc-by-4.0
task_categories:
  - image-classification
tags:
  - medical
  - cystoscopy
  - bladder-cancer
size_categories:
  - 1K<n<10K
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*.parquet

CystoDS

Cystoscopic image dataset with lesion annotations, segmentation masks (768 of 8 067 images), and rich clinical metadata (class, subclass, stage, morphology, modality). Flattened into a single train split with one row per image; images are embedded in the Parquet shards as HF Image features and segmentation polygons are stored inline.

Why no splits

This dataset ships one train split only. Use the pid (patient id) column to build your own patient-grouped splits to prevent leakage. 160 unique patients.

Columns

Column Type Description
image Image Decoded PIL image (embedded bytes).
filename string 8-char de-identified PNG filename.
pid int64 Patient id — use this for group-aware splitting.
visit float64 Visit number (often NaN).
lesion string Lesion descriptor (often NaN).
multifocal string Multifocal flag (often NaN).
bca string Bladder cancer association (Yes/No).
class string Top-level class (see distribution below).
subclass string Subclass label.
subclass2 string Secondary subclass.
stage string Tumor stage.
morphology string Morphology descriptor.
modality string Imaging modality (WLC, etc.).
has_segmentation int64 1 if a segmentation polygon exists, else 0.
segmentation struct null when has_segmentation == 0, otherwise {label: list[string], points: list[list[list[float]]]} — each points[i] is a polygon [x, y] list matching label[i].

Class distribution

Class Count
Normal mucosa 6386
Malignant 998
Foreign bodies 251
Non-malignant 221
Anatomical landmarks 211

Segmentation labels

768 images have polygons (807 polygon shapes total). Labels include: Tumor (459), Air bubble (216), Right ureteral orifice (50), Left ureteral orifice (49), Resection scar (30), Flat Tumor (3).

Loading

from datasets import load_dataset
ds = load_dataset("milkyroad/C", split="train")
print(ds[0]["image"])          # PIL.Image
print(ds[0]["class"])
# segmentation
if ds[0]["has_segmentation"]:
    seg = ds[0]["segmentation"]
    for label, poly in zip(seg["label"], seg["points"]):
        print(label, len(poly), "points")

Group-aware split example

import random
ds = load_dataset("milkyroad/C", split="train")
pids = sorted({r["pid"] for r in ds if r["pid"] is not None})
random.Random(42).shuffle(pids)
n_test, n_val = 16, 16
test_pids = set(pids[:n_test])
val_pids = set(pids[n_test:n_test + n_val])
train = ds.filter(lambda r: r["pid"] not in test_pids and r["pid"] not in val_pids)
val   = ds.filter(lambda r: r["pid"] in val_pids)
test  = ds.filter(lambda r: r["pid"] in test_pids)

Notes

  • 160 unique patients (pid). Build splits by patient to prevent leakage.
  • segmentation is null for images without a mask (has_segmentation == 0).
  • Original source: https://osf.io/xvdhy/