--- dataset_info: features: - name: image dtype: image - name: tumor dtype: int32 - name: patient_id dtype: int32 - name: node_id dtype: int32 - name: centre_id dtype: int32 - name: patch_x dtype: int32 - name: patch_y dtype: int32 splits: - name: train num_bytes: 574917756.358 num_examples: 26753 download_size: 649099009 dataset_size: 574917756.358 configs: - config_name: default data_files: - split: train path: data/train-* license: cc0-1.0 task_categories: - image-classification language: - en tags: - pathology - tumor - medical - classification - lymph pretty_name: Mini CAncer MEtastases in LYmph nOdes challeNge size_categories: - 10K **This is a subset, not the full challenge dataset.** Only nodes 0 and 1 were downloaded, for approximately 121 slides. ## 📦 Dataset Structure Each entry corresponds to a single patch extracted from one whole-slide image: * `image` → 512×512 RGB patch, sampled at 0.5 µm/px (≈20× magnification) * `tumor` → Binary label: `normal` (0) or `tumor` (1) * `patient_id` → Artificial patient index from the original release (0–99 in the training set) * `node_id` → Lymph node index within that patient (0–4 originally; only 0 and 1 here) * `centre_id` → Contributing medical center, `centre_0` … `centre_4` * `patch_x`, `patch_y` → Top-left coordinate of the patch in level-0 slide space ## 🏷️ Labels ### Patch label The `tumor` field is binary, assigned geometrically from the lesion contours: | Value | Class | Definition | |---|---|---| | 0 | Normal | Central region of the patch contains no annotated metastasis and at least 20% tissue | | 1 | Tumor | Central region of the patch intersects an annotated metastasis | The "central region" is the middle third of the patch (≈171×171 px of 512×512). Patches where a metastasis is present somewhere in the patch but *not* in the central region are ambiguous and were discarded rather than assigned to either class, following the labeling convention used by WILDS-Camelyon17. ## ⚙️ Preprocessing Extraction was performed with OpenSlide and Shapely directly from the BigTIFF slides. The steps below are what distinguish this subset from a naive random-crop dump. **Tissue masking.** A downsampled thumbnail (≈64× downsample) is converted to HSV and thresholded with Otsu on the saturation channel, with a floor at S > 20 and value bounds 40 < V < 235 to reject blown-out glass and dark pen marks or scanner bars. Small connected components are removed by morphological opening/closing. Uniform random sampling over slide dimensions would return overwhelmingly blank glass, since a lymph node section occupies a small fraction of the slide area. **Lesion geometry with exclusions honored.** Annotations are ASAP XML polygons in level-0 coordinates. Each `` carries a `PartOfGroup` attribute: `metastases` marks tumor, while `normal` marks exclusion regions *inside* metastases. The tumor geometry is the union of the former minus the union of the latter, so tissue carved out of a lesion is not labeled positive. Vertices are ordered by the `Coordinate/@Order` attribute rather than document order, and self-intersecting contours are repaired. **Class-targeted sampling.** Metastases occupy a tiny fraction of tissue, so uniform sampling yields a positive rate well under 1%. Tumor patches are drawn by rejection sampling inside the lesion geometry; normal patches are drawn uniformly over the tissue mask and rejected if they touch the lesion geometry at all. Per-slide quotas cap each class. Near-duplicate centers are suppressed on a half-patch grid. **Magnification.** Slides are scanned at 0.23–0.25 µm/px, but not identically across centers. Rather than reading a fixed pyramid level, the target 0.5 µm/px is resolved per slide against its `openslide.mpp-x` property, so physical scale is constant across the dataset even where native resolution differs. **Alpha compositing.** `read_region` returns RGBA; transparent regions are composited onto **white**, not converted directly to RGB, which would render slide margins black. **Un-annotated slides.** Only 50 of the 500 CAMELYON17 training slides carry lesion-level annotations (10 per center). Slides without an XML are used as a normal-patch source **only** when `stages.csv` confirms them as `negative`; slides labeled `itc`, `micro` or `macro` without annotation are skipped entirely, since the metastasis location is unknown and every patch would be a potential false negative. **Not included:** stain normalization, color augmentation, blur or artifact detection. These are left to the consumer, deliberately — inter-center stain variation is the scientifically interesting property of CAMELYON17 and normalizing it away at the dataset level would defeat the point. ## 🚀 Usage ```python from datasets import load_dataset import matplotlib.pyplot as plt ds = load_dataset("chehablab/MiniCAMELYON", split="train") sample = ds[0] plt.imshow(sample["image"]) plt.axis("off") plt.title( f"{sample['slide_id']} | ({sample['patch_x']}, {sample['patch_y']}) | " f"{ds.features['tumor'].int2str(sample['tumor'])} | " f"slide: {ds.features['stage'].int2str(sample['stage'])} | " f"{ds.features['centre_id'].int2str(sample['centre_id'])}" ) plt.show() ``` Patient-level splitting: ```python import numpy as np patients = np.array(sorted(set(ds["patient_id"]))) rng = np.random.default_rng(0) rng.shuffle(patients) val_patients = set(patients[: int(0.2 * len(patients))].tolist()) val_ds = ds.filter(lambda x: x["patient_id"] in val_patients) train_ds = ds.filter(lambda x: x["patient_id"] not in val_patients) ``` ## 📚 Citation If you use this dataset, please acknowledge [Chehab Lab](https://chehablab.com) and cite the original CAMELYON publications: ```bibtex @article{litjens2018camelyon, title = {1399 {H\&E}-stained sentinel lymph node sections of breast cancer patients: the {CAMELYON} dataset}, author = {Litjens, Geert and Bandi, Peter and Ehteshami Bejnordi, Babak and Geessink, Oscar and Balkenhol, Maschenka and Bult, Peter and Halilovic, Altuna and Hermsen, Meyke and van de Loo, Rob and Vogels, Rob and Manson, Quirine F and Stathonikos, Nikolas and Baidoshvili, Alexi and van Diest, Paul and Wauters, Carla and van Dijk, Marcory and van der Laak, Jeroen}, journal = {GigaScience}, volume = {7}, number = {6}, pages = {giy065}, year = {2018}, doi = {10.1093/gigascience/giy065} } @article{bandi2019detection, title = {From Detection of Individual Metastases to Classification of Lymph Node Status at the Patient Level: The {CAMELYON17} Challenge}, author = {Bandi, Peter and Geessink, Oscar and Manson, Quirine and van Dijk, Marcory and Balkenhol, Maschenka and Hermsen, Meyke and Ehteshami Bejnordi, Babak and Lee, Byungjae and Paeng, Kyunghyun and Zhong, Aoxiao and others}, journal = {IEEE Transactions on Medical Imaging}, volume = {38}, number = {2}, pages = {550--560}, year = {2019}, doi = {10.1109/TMI.2018.2867350} } @article{ehteshami2017diagnostic, title = {Diagnostic Assessment of Deep Learning Algorithms for Detection of Lymph Node Metastases in Women With Breast Cancer}, author = {Ehteshami Bejnordi, Babak and Veta, Mitko and van Diest, Paul Johannes and van Ginneken, Bram and Karssemeijer, Nico and Litjens, Geert and van der Laak, Jeroen A W M and others}, journal = {JAMA}, volume = {318}, number = {22}, pages = {2199--2210}, year = {2017}, doi = {10.1001/jama.2017.14585} } ``` Challenge homepage: https://camelyon17.grand-challenge.org/ Original data repository: http://gigadb.org/dataset/100439 Viewer and annotation tooling: https://github.com/computationalpathologygroup/ASAP --- ## 📜 License The CAMELYON16 and CAMELYON17 data are released under the [Creative Commons CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) public domain dedication, and this derivative dataset inherits the same terms. No rights are reserved. You may copy, modify, distribute and use the data, including for commercial purposes, without asking permission. Citation is not legally required under CC0 but is expected as a matter of academic practice — please cite the works above. The original data collection was approved by the ethics committee of Radboud University Medical Center under 2016-2761, with the need for informed consent waived. [![CC0](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) **Chehab Lab @ 2026**