bench / docs /SPEC.md
milkyroad's picture
Upload folder using huggingface_hub (part 12)
11ec37f verified
|
Raw History Blame Contribute Delete
7.44 kB

Cystoscopy Benchmark v0.1.4 specification

Frozen before scoring any model. A change to a threshold, a class, or a split is a new version.

Classes

class_label Meaning
malignant_tumor Tissue that is malignant tumor
non_malignant_lesion A lesion that is not malignant tumor
non_roi Anything that does not warrant a biopsy

Contents

Level Rows
Stills 5,807
Clips 161 track clips (see below)
Procedures No rows yet

Composition

Evaluation only. There is no split inside the release: every row is gold for scoring, and no row is intended for fitting.

Level Rows Patients
Stills 5,807 113
Clips 161 27
Lesions 314 —

The still cohort and the clip cohort are disjoint, so the patient counts add to 140. Patient identity is carried by an anonymised patient_id, so disjointness against the training data can be checked from both releases alone.

Clip media

Each clip row is a track clip from milkyroad/B, not a full procedure video. Hugging Face num_frames on that dataset is the parent procedure length and must not be copied into the release. fps, n_frames, and duration_s are taken from ffprobe on the written media file.

Training data

Images used to fit a baseline ship separately and never overlap these patients. Of the 182 still patients, 69 contribute training images (~4,000 stills, mask-dense) and 113 contribute the evaluation stills. Source-B track clips are evaluation-only, except three PUNLMP patients (12 tracks), who are left out of the release. A model fitted on the training stills and scored on the clips is evaluated across sites.

A still classifier can reach axes 2A and 2B by running frame by frame over a clip and aggregating predictions into intervals. No model is fitted on clip data, and the release contains no clip data suitable for fitting.

Provenance of the boundary

The stills patient split keeps ~4,000 training images while matching global class rates and preferring CystoDS patients that carry polygon masks into the training cut (mask-dense). The assignment lives in the build tooling (patients_build.json), not in the release.

Identifiers

Every identifier is a salted, order-independent anonymised value.

Field Form Example
sample_id s + 6 digits s000123
clip_id c + 6 digits c000045
lesion_id l + 6 digits l000207
patient_id p + 3 digits p017

Ordering is by sha256(salt:original), so a rebuild cannot renumber the release. Original filenames are not shipped: the Kaggle stills encoded the grade in their names (_HGC, _LGC, _NST, _NTL), the clip ids began with the patient number (P028_...), and the old lesion_uid embedded it as well (132:L1).

source takes the values source_1, source_2, source_3, corresponding to milkyroad/C (CystoDS stills), milkyroad/D (Kaggle stills), and milkyroad/B (the institutional video cohort). Dataset identity is documented because attribution is a licence obligation; patient identity is not recoverable from the release. Renaming removes the join key, not the content, so the release is de-identified rather than untraceable.

2C Stills

One prediction per still: one of the three classes.

Headline: macro F1 over the gold stills, averaged over classes that have at least one gold still in the slice being scored. Classes with no gold are listed in zero_support and are not given a fake score of zero inside the average.

Also reported: per-class precision and recall. A class drawn from two or fewer patients is marked low_support.

Default unit is the still.

2A Clip presence

Gold is one interval per in-view tumor lesion, including lesions shorter than one second. Time is frame / fps using the written clip's average frame rate. The interval runs from the first in-view frame to the frame after the last in-view frame, clamped to the media duration. Frames where the lesion is outside the view are ignored.

A prediction is a list of intervals. Matching maximises total overlap (Hungarian), then keeps a pair when the overlap is at least min(1.0, gold_duration) seconds. --strict-min-overlap uses a hard 1.0 second. Short gold therefore uses a lowered overlap gate.

True positive: an accepted pair. False positive: an unmatched prediction. False negative: an unmatched gold lesion.

Headline: micro F1 pooled over all clips. Also reported: the mean of the per-clip F1 scores, and the mean absolute count error.

is_negative means the clip has no in-view tumor lesion. Empty predictions on negatives are correct absences (they do not move micro F1; they score 1 on the per-clip F1 secondary). False positives on negatives are measurable.

2B Temporal precision

For each 2A true positive, temporal IoU is the overlap divided by the union of the two intervals. Headline: the mean over those true positives. No true positives yields 0 when the gold is non-empty, and no_gold when it is not.

Clip 2C

The schema uses the same three classes. Every gold lesion is malignant tumor, so the scorer returns degenerate instead of a one-class F1.

Axis 1 Inspection completeness

Eleven landmarks: trigone, right ureteral orifice, left ureteral orifice, right wall, left wall, anterior wall, posterior wall, dome, bladder neck, prostatic urethra, outside bladder.

Gold for a landmark is the list of [start_s, end_s] intervals during which it is in view. It counts as inspected when the union of those intervals is at least 2 seconds. The prediction uses the same rule. Macro F1 is the unweighted mean of the per-landmark binary F1 scores. A landmark with no positive gold and no positive prediction scores 1 for that procedure, because both sides agree it was not inspected.

prostatic_urethra is sex-dependent. Procedures annotated sex: female leave it out of the average.

There are no procedure rows yet, so the scorer returns no_gold.

What a submission must beat

On populated axes, an oracle submission scores 1 and an empty submission scores 0. always_non_roi is the majority-class floor for stills and scores 0.285 macro F1 on test, because non-ROI is about three quarters of the frames. Accuracy is not a headline.

The stills cover 113 patients. With that patient count, patient-level resampling variance is lower than on the smaller v0.1 stills cohort.

Commitments

  1. The evaluation set is scored once per model. Prompt, threshold, and checkpoint selection happen on the training images, never here.
  2. No evaluation patient appears in the training data. The two releases are patient-disjoint by construction.
  3. Axis 1 procedure videos from the hospital cohort are never used for baseline training. They are the external validation set.

Version history

  • v0.1.4 — Stills patient split switched to mask-dense (~4,014 train / 5,807 bench stills; 69 / 113 still patients). Clip cohort unchanged from v0.1.3.
  • v0.1.3 — Three PUNLMP patients (12 track clips, 36 lesions) are excluded. Identifiers of the remaining rows are unchanged.
  • v0.1.2 — Clip n_frames/duration_s from probed track media; every in-view tumor track is gold (dropped the ≥1 s filter).
  • v0.1.1 — All milkyroad/B clips kept for eval; stills split unchanged from class-balanced ~4000-image train cut.