--- configs: - config_name: default data_files: - split: train path: data/train-* - split: validation path: data/validation-* - split: test path: data/test-* license: unknown tags: - medical-imaging - cystoscopy - bladder-cancer - cancer-detection - histological-grade pretty_name: Unified Cystoscopy Cancer Detection (Dataset E) size_categories: - 10K cancer; NST, NTL -> non_cancer | | C | `class` | Malignant -> cancer; all others -> non_cancer | | B | per-frame tumor annotation (`y`) + `histological_type` | y=1 (carcinoma patient) -> cancer; y=0 or PUNLMP -> non_cancer | ### grade_label (ClassLabel: `low_grade`=0, `high_grade`=1, `not_applicable`=2) | Source | Field used | High-grade (1) | Low-grade (0) | Not applicable (2) | |--------|-----------|----------------|---------------|---------------------| | D | `tissue_type` | HGC | LGC | NST, NTL | | C | `subclass` | HighGradePapillary, CIS | LowGradePapillary | all other classes | | B | `histological_type` (patient-level) | pT1HG, pTaHG, pT2, pT2HG | pTaLG, pT1LG | PUNLMP, non-tumor frames (y=0) | ### subclass_label (ClassLabel: `malignant`=0, `non_malignant`=1, `normal`=2, `landmark`=3, `foreign_body`=4) | Source | Native field | Mapping | |--------|-------------|---------| | B | `histological_type` + `y` | Carcinoma + y=1 -> malignant; PUNLMP -> non_malignant; y=0 -> normal | | C | `class` | Malignant -> malignant; Non-malignant -> non_malignant; Normal mucosa -> normal; Anatomical landmarks -> landmark; Foreign bodies -> foreign_body | | D | `tissue_type` | HGC, LGC -> malignant; NTL -> non_malignant; NST -> normal | ### target3 (ClassLabel: `malignant`=0, `non_malignant`=1, `non_roi`=2) Derived 3-class label for the deep learning task: | subclass_label | target3 | |----------------|---------| | malignant (0) | malignant (0) | | non_malignant (1) | non_malignant (1) | | normal (2) | non_roi (2) | | landmark (3) | non_roi (2) | | foreign_body (4) | non_roi (2) | ### imaging_type (ClassLabel: `WLI`=0, `NBI`=1, `BLC`=2) | Source | Original field | Values -> unified | |--------|---------------|------------------| | B | `light_mode` | CLARA + CHROMA -> WLI, white light -> WLI | | C | `modality` | WLC -> WLI, BLC -> BLC | | D | `imaging_type` | WLI -> WLI, NBI -> NBI | ## Train / Validation / Test Split Patient-level stratified split using StratifiedGroupKFold (source x dominant-class stratification) + post-split patient swapping to minimize fill-ratio deviation. - **Split ratio**: 70 / 15 / 15 (train / val / test) - **Seed**: 16 - **Swaps applied**: 14 - **No patient appears in more than one split** (verified) ### Split sizes | Split | Images | Patients | |-------|-------:|---------:| | train | 10,436 | 148 | | validation | 2,244 | 35 | | test | 2,241 | 29 | | **Total** | **14,921** | **212** | ### Class distribution per split | Class | Total | Train | Val | Test | |-------|------:|------:|----:|-----:| | malignant | 6,515 (43.7%) | 4,568 | 982 | 965 | | non_malignant | 900 (6.0%) | 631 | 135 | 134 | | non_roi | 7,506 (50.3%) | 5,237 | 1,127 | 1,142 | ### Fill ratios (count / target, ideal = 1.00) | Class | Train | Val | Test | |-------|------:|----:|-----:| | malignant | 1.00 | 1.00 | 0.99 | | non_malignant | 1.00 | 1.00 | 0.99 | | non_roi | 1.00 | 1.00 | 1.01 | ### Source x split (patients) | Source | Train | Val | Test | |--------|------:|----:|-----:| | B | 21 | 4 | 5 | | C | 115 | 25 | 20 | | D | 12 | 6 | 4 | ### Source x split (images) | Source | Train | Val | Test | |--------|------:|----:|-----:| | B | 3,763 | 760 | 577 | | C | 5,821 | 1,129 | 1,117 | | D | 852 | 355 | 547 | ### Non-malignant patient coverage | Split | Patients | Images | |-------|---------:|-------:| | train | 55 | 631 | | validation | 12 | 135 | | test | 13 | 134 | ## 5-Fold Cross-Validation (train pool only) StratifiedGroupKFold on the train split (per-image `target3` stratification, patient-level grouping, no patient in multiple folds, seed=15). | Fold | Patients | Images | Malignant | Non-mal | Non-ROI | |-----:|---------:|-------:|----------:|--------:|--------:| | 0 | 26 | 2,028 | 914 | 61 | 1,053 | | 1 | 35 | 2,119 | 913 | 170 | 1,036 | | 2 | 31 | 2,026 | 915 | 61 | 1,050 | | 3 | 26 | 2,026 | 913 | 61 | 1,052 | | 4 | 30 | 2,237 | 913 | 278 | 1,046 | The `cv_fold` column is -1 for validation and test patients. ### Note on minority-class (non-malignant) fold balance Non-malignant images are heavily patient-concentrated in this dataset: in the train pool, two patients alone account for around 70% of all non-malignant images (274 and 168 images respectively), and only 17 of 148 train patients are non-malignant dominant. Because cross-validation is patient-grouped (a patient never appears in more than one fold), these high-volume patients cannot be split across folds and inevitably land in a single fold each. As a result, two folds carry an elevated non-malignant proportion (~8% and ~12%) while the other three sit at ~3%, against a train-pool baseline of ~6%. This is an inherent limitation of the dataset's patient-level grouping, not of the splitting algorithm. StratifiedGroupKFold guarantees that every fold's *training* portion contains non-malignant-dominant patients and keeps the majority classes (malignant, non-ROI) near-perfectly balanced across folds (malignant spread: 913-915; non-ROI spread: 1,036-1,053). Practitioners should report per-fold non-malignant counts alongside metrics and prefer the macro-averaged F1 across all five folds over any single fold's score when estimating minority-class performance. ## Dataset Statistics (after capping) ### By target3 | Malignant | Non-malignant | Non-ROI | |----------:|--------------:|--------:| | 6,515 | 900 | 7,506 | ### By subclass label | Malignant | Non-malignant | Normal | Landmark | Foreign body | |----------:|--------------:|-------:|---------:|-------------:| | 6,515 | 900 | 7,044 | 211 | 251 | ### By cancer label | Total | Cancer | Non-cancer | |------:|-------:|-----------:| | 14,921 | 6,514 | 8,407 | ### By grade label | High-grade | Low-grade | Not applicable | |-----------:|----------:|---------------:| | 2,205 | 4,309 | 8,407 | ### By imaging modality | WLI | NBI | BLC | |----:|----:|----:| | 14,150 | 321 | 450 | ## Features Schema | Column | Type | Description | |--------|------|-------------| | `image` | Image | Cystoscopy image (decoded as PIL Image on load) | | `cancer_label` | ClassLabel | `non_cancer` (0) / `cancer` (1) | | `grade_label` | ClassLabel | `low_grade` (0) / `high_grade` (1) / `not_applicable` (2) | | `subclass_label` | ClassLabel | `malignant` (0) / `non_malignant` (1) / `normal` (2) / `landmark` (3) / `foreign_body` (4) | | `source_dataset` | string | `B`, `C`, or `D` -- original source dataset | | `original_filename` | string | Filename in the original source dataset | | `patient_id` | int32 | Normalized sequential patient/case ID (1-212) | | `imaging_type` | ClassLabel | `WLI` (0) / `NBI` (1) / `BLC` (2) | | `target3` | ClassLabel | `malignant` (0) / `non_malignant` (1) / `non_roi` (2) -- 3-class task label | | `track_id` | string | Source B video track ID (e.g. `008`); `NA` for sources C and D | | `cv_fold` | int32 | 5-fold CV assignment (0-4) for train patients; -1 for val/test | ## Loading ```python from datasets import load_dataset ds = load_dataset("milkyroad/E") print(ds) # DatasetDict({ # train: 10,436 images # validation: 2,244 images # test: 2,241 images # }) # Access a sample sample = ds["train"][0] print(sample["target3"]) # 0 (malignant), 1 (non_malignant), or 2 (non_roi) ```