Datasets:
File size: 3,323 Bytes
1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd 1826e37 b6315dd | 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 | ---
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
```python
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
```python
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/
|