B / README.md
milkyroad's picture
Update README for flattened single-split structure with embedded videos and inline boxes
358aa39 verified
|
Raw
History Blame Contribute Delete
3.55 kB
metadata
language:
  - en
license: unknown
task_categories:
  - object-detection
tags:
  - medical
  - cystoscopy
  - bladder-cancer
  - tumor-detection
  - video
size_categories:
  - 100M<n<1B
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*.parquet

Cystoscopy Tumor Detection

Cystoscopic video dataset with per-frame tumor bounding-box annotations, paired with patient-level clinical metadata. Flattened into a single train split with one row per video; videos are embedded in the Parquet shards as HF Video features and bounding boxes are stored inline.

Why no splits

This dataset ships one train split only. Use the patient_id column to build your own patient-grouped splits to prevent leakage. 30 unique patients.

Columns

Column Type Description
video Video Embedded video bytes (decode=False — returns {bytes, path}; cast to Video(decode=True) to decode frames, requires torchcodec).
video_id string Filename stem, e.g. P000_cystoscopy_track_000.
patient_id int64 Patient id — use this for group-aware splitting.
boxes struct Per-box annotations as parallel lists (see below). n = len(boxes["frame"]) boxes for this video.
n_boxes int64 Number of boxes for this video.
histological_type string Patient-level histology (e.g. Urothelial carcinoma pTaLG).
num_frames int64 Patient-level total annotated frames.
light_mode string Imaging light mode (e.g. CLARA + CHROMA).

boxes struct fields

Each field is a list of length n_boxes; index i across all fields describes one box.

Field Type Description
track_id int64 Annotation track within the video.
frame int64 Frame number the box belongs to.
label string Box label (always tumor).
xtl, ytl, xbr, ybr float32 Absolute pixel coordinates (CVAT format).
occluded int64 Occlusion flag.
outside int64 Outside flag.
keyframe int64 Keyframe flag.
z_order int64 Z-order.

Contents

  • 173 cystoscopy .mp4 videos (~4 GB, embedded).
  • 69 108 bounding boxes across 444 annotation tracks.
  • 30 patients with clinical metadata.

Loading

from datasets import load_dataset
ds = load_dataset("milkyroad/B", split="train")
# video is not decoded by default (no torchcodec required to load)
print(ds[0]["video"])          # {'bytes': ..., 'path': 'P000_cystoscopy_track_000.mp4'}
print(ds[0]["n_boxes"])        # 233
boxes = ds[0]["boxes"]
print(boxes["frame"][0], boxes["label"][0], boxes["xtl"][0])

Decode video frames

To decode frames, install torchcodec and cast the column:

from datasets import Video
ds = ds.cast_column("video", Video(decode=True))

Group-aware split example

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

Notes

  • Box coordinates are absolute pixel coordinates in the source video frames (CVAT format).
  • Splits should be by patient to prevent leakage; patient_id is provided for this purpose.