KEM-features: frozen WSI patch features for Camelyon–TCGA MorphCL
Pre-extracted, frozen patch-level features of 3,553 whole-slide images (WSIs) for the Camelyon–TCGA MorphCL continual-learning benchmark used in the KEM paper (Knapsack-guided Episodic Memory). Code: https://github.com/tAnGjIa520/KEM.
No slide images are included. Each slide is stored as one HDF5 file with the patch embeddings and patch coordinates, for three encoders.
Benchmark
Five sequential tasks, 11 classes, 3,553 WSIs from the public Camelyon16 and TCGA collections.
| Task | Name | Classes (number of slides) | Slides |
|---|---|---|---|
| 1 | Camelyon16 | normal 239, tumor 160 | 399 |
| 2 | TCGA-ESCA | ESAD 65, ESCC 86 | 151 |
| 3 | TCGA-LUNG | LUAD 533, LUSC 512 | 1,045 |
| 4 | TCGA-GI | CRC 610, STAD 412 | 1,022 |
| 5 | TCGA-RCC | KICH 121, KIRC 519, KIRP 296 | 936 |
metadata/camelyon_tcga_morph_5t11c_cases.csv lists slide ids with labels. metadata/camelyon_tcga_morph_5t11c_manifest.csv
adds the task id, patch count (n_patches), UNI feature dimension, patient fold and the relative UNI path of each slide.
splits/Camelyon_TCGA_morph_5t11c/{standard,reverse,order_random_1,order_random_2,order_random_3}/fold_{0..4}/ hold the
five-fold splits for the standard task order and the four robustness orders.
Encoders
| Folder | Encoder | Feature dim | Used for |
|---|---|---|---|
UNI |
UNI | 1024 | main experiments |
UNI2-h |
UNI2-h | 1536 | encoder robustness |
CTransPath |
CTransPath | 768 | encoder robustness |
All three encoders share one patch grid per slide: coords and the number of patches are identical across encoders
(checked on 32 randomly chosen slides; the number of patches per slide is the same for all encoders in all 3,553 slides).
File format
One file per slide and encoder: <cohort>/<encoder>/h5_files/<slide_id>.h5 (CLAM-style) with
features:float32, shape[N, D](N patches, D as in the table above),coords:int32, shape[N, 2], patch top-left coordinates(x, y).
Patch spacing, derived from the stored coordinates (smallest difference between distinct x or y values, over 32 sampled slides): 64 coordinate units for Camelyon16 slides, and 512 or 1024 coordinate units for TCGA slides, depending on the slide. Coordinates are in the units of the extraction pipeline; this card does not state a magnification.
Total size: UNI 71.3 GB, UNI2-h 107.0 GB, CTransPath 53.4 GB (h5 files only).
Layout
KEM-features/
├── README.md
├── metadata/ camelyon_tcga_morph_5t11c_{cases,manifest}.csv
├── splits/Camelyon_TCGA_morph_5t11c/{standard,reverse,order_random_1,order_random_2,order_random_3}/fold_{0..4}/
├── CAMELYON/{UNI,UNI2-h,CTransPath}/h5_files/<slide>.h5 (399 slides)
├── TCGA/<cohort>/{UNI,UNI2-h,CTransPath}/h5_files/<slide>.h5
│ cohort = LUAD 533, LUSC 512, ESCA_ESAD 65, ESCA_ESCC 86, TCGA_CRC 610, TCGA_STAD 412, KICH 121, KIRC 519, KIRP 296
└── tools/ h5_to_pt.py, verify_features.py
Download
The dataset is large; download only the encoder you need. UNI (main experiments) with metadata and splits:
from huggingface_hub import snapshot_download
root = snapshot_download(
"tangjia0424/KEM-features", repo_type="dataset", local_dir="KEM-features",
allow_patterns=["README.md", "metadata/*", "splits/*", "tools/*",
"CAMELYON/UNI/*", "TCGA/*/UNI/*"],
)
Other encoders: replace UNI with UNI2-h or CTransPath. A single cohort: "TCGA/LUAD/UNI/*".
Use with the KEM code
The KEM code reads FEATURE_ROOT/<cohort>/<encoder>/pt_files/<slide>.pt (a float32 tensor [N, D]) and the patch
coordinates from h5_files/<slide>.h5. Create the .pt files from the downloaded .h5 files and point FEATURE_ROOT
to the dataset root:
python KEM-features/tools/h5_to_pt.py --root KEM-features --encoders UNI # or: UNI UNI2-h CTransPath
python KEM-features/tools/verify_features.py --root KEM-features --encoders UNI # shape check against the manifest
export FEATURE_ROOT=$PWD/KEM-features
Then follow the README of the code repository (for example bash scripts/run_all_folds.sh clam_sb__kem "1 2 3" "0 1 2 3 4").
Presets with the prefixes encoder_uni2h__ and encoder_ctranspath__ read the UNI2-h and CTransPath folders.
The manifest column feature_fingerprint is a SHA-256 value recorded by the authors for the UNI tensors. It cannot be
reproduced from the released files with the obvious recipes (hash of the .pt bytes, of the float32 array bytes, or of the
h5 file), so verify_features.py checks shapes and counts instead and can optionally check or write SHA-256 sums of the
.h5 files.
License and terms of use
- UNI and UNI2-h features are derived from the MahmoodLab UNI and UNI2-h models, which are released under CC-BY-NC-ND 4.0 for non-commercial academic research. Their terms treat datasets created from the model as derivatives, so these features are distributed under CC-BY-NC-ND-4.0: non-commercial academic research use only, with attribution, and no redistribution of modified versions. Accept the terms of the original models (https://huggingface.co/MahmoodLab/UNI, https://huggingface.co/MahmoodLab/UNI2-h).
- CTransPath features are derived from the CTransPath model. The official repository
(https://github.com/Xiyue-Wang/TransPath) states: "TransPath is released under the GPLv3 License and is available for
non-commercial academic purposes." (its
LICENSE.mdis the GNU GPL v3 text). The repository gives no separate terms for the pre-trained weights or for features computed with them, so the CTransPath features follow the CTransPath release terms (non-commercial academic use). For simplicity, the whole dataset, including the CTransPath features, is distributed under CC-BY-NC-ND-4.0 (the repository license tag). - The underlying slides come from TCGA and Camelyon16. Users must follow the TCGA data use policy of the NIH Genomic Data Commons and the Camelyon16 data terms. The features and metadata must not be used to re-identify patients.
metadata/andsplits/list public TCGA and Camelyon16 slide and case identifiers with the labels used in the paper.- Provided as is, for research. No clinical use.
Acknowledgements and citations
- UNI / UNI2-h (cite the UNI paper): Chen, R.J., Ding, T., Lu, M.Y., et al. Towards a general-purpose foundation model for computational pathology. Nature Medicine 30(3), 850–862 (2024). doi:10.1038/s41591-024-02857-3
- CTransPath: Wang, X., Yang, S., Zhang, J., et al. Transformer-based unsupervised contrastive learning for histopathological image classification. Medical Image Analysis 81, 102559 (2022). doi:10.1016/j.media.2022.102559
- Camelyon16: Bejnordi, B.E., Veta, M., van Diest, P.J., et al. Diagnostic assessment of deep learning algorithms for detection of lymph node metastases in women with breast cancer. JAMA 318(22), 2199–2210 (2017). doi:10.1001/jama.2017.14585
- TCGA: The Cancer Genome Atlas Research Network, Weinstein, J.N., et al. The Cancer Genome Atlas Pan-Cancer analysis project. Nature Genetics 45, 1113–1120 (2013). doi:10.1038/ng.2764 (program page: https://www.cancer.gov/tcga).
- Patch grid format: Lu, M.Y., Williamson, D.F.K., Chen, T.Y., et al. Data-efficient and weakly supervised computational pathology on whole-slide images (CLAM). Nature Biomedical Engineering 5(6), 555–570 (2021). doi:10.1038/s41551-020-00682-w
KEM citation: will be added when the paper is public.
- Downloads last month
- 133