The Dataset Viewer has been disabled on this dataset.

UNI2-h Patch Features for TCGA and CPTAC

Pre-extracted patch-level embeddings from the UNI2-h pathology foundation model for 11,759 whole-slide images (WSIs): 9,838 from TCGA (32 projects) and 1,921 from CPTAC (9 cohorts).

Features were extracted with TRIDENT. They are meant for weakly supervised slide-level tasks, such as multiple-instance learning (MIL) for classification, survival or biomarker prediction, without having to download or process the raw WSIs.

These features were produced for the study From Patches to Patients: A study of the tile-to-slide performance transferability in Digital Pathology. If you use them, please cite it (see Citation).

Extraction settings

Setting Value
Pipeline TRIDENT (run_batch_of_slides.py --task all: tissue segmentation, patching, feature extraction)
Patch encoder uni_v2 (MahmoodLab/UNI2-h)
Embedding dimension 1536
Patch size 256 x 256 px
Magnification 20X
Patch overlap none
Unit one .h5 file per WSI

Slides that failed during processing were skipped (--skip_errors), so a small number of slides from the original cohorts may be missing.

Repository structure

TCGA/
  TCGA-ACC/
    TCGA-XX-XXXX-01Z-00-DX1.<uuid>.h5
    ...
  TCGA-BLCA/
  ...
CPTAC/
  CPTAC_BRCA/
  ...

Each file is named after the source slide, so TCGA files keep the full slide barcode and UUID.

Cohorts

TCGA (9,838 slides)

Project Slides Project Slides Project Slides
TCGA-ACC 227 TCGA-BLCA 457 TCGA-BRCA 1,133
TCGA-CESC 279 TCGA-CHOL 38 TCGA-COAD 458
TCGA-DLBC 44 TCGA-ESCA 158 TCGA-GBM 195
TCGA-HNSC 443 TCGA-KICH 77 TCGA-KIRC 519
TCGA-KIRP 298 TCGA-LGG 491 TCGA-LIHC 359
TCGA-LUAD 541 TCGA-LUSC 512 TCGA-MESO 75
TCGA-OV 83 TCGA-PAAD 176 TCGA-PCPG 176
TCGA-PRAD 401 TCGA-READ 166 TCGA-SARC 253
TCGA-SKCM 432 TCGA-STAD 438 TCGA-TGCT 149
TCGA-THCA 504 TCGA-THYM 117 TCGA-UCEC 502
TCGA-UCS 57 TCGA-UVM 80

CPTAC (1,921 slides)

The CPTAC slides were selected to match those available in the Patho-Bench library, so these features can be used directly with its task splits.

Cohort Slides Cohort Slides Cohort Slides
CPTAC_BRCA 112 CPTAC_CCRCC 244 CPTAC_COAD 98
CPTAC_GBM 243 CPTAC_HNSCC 259 CPTAC_LSCC 304
CPTAC_LUAD 326 CPTAC_PDA 242 CPTAC_UCEC 93

File format

Each .h5 file contains:

  • features: float array of shape (N, 1536), one UNI2-h embedding per tissue patch
  • coords: int array of shape (N, 2), the (x, y) top-left coordinate of each patch in level-0 pixel space of the original WSI

Extraction metadata, such as patch size and magnification, is stored as HDF5 attributes.

Download

The dataset is public, so no login is needed. Install the client (hf_transfer is optional but makes downloads faster):

pip install -U huggingface_hub hf_transfer
export HF_HUB_ENABLE_HF_TRANSFER=1   # optional, faster downloads

You can download a single cohort, several cohorts, a whole source, a single slide, or everything. Pick the folder(s) you need with --include (CLI) or allow_patterns (Python).

Command line

# One cohort (e.g. TCGA-BRCA)
hf download sofieneb/uni2h_features --repo-type dataset \
  --include "TCGA/TCGA-BRCA/*" --local-dir ./uni2h_features

# Several cohorts (e.g. NSCLC = LUAD + LUSC)
hf download sofieneb/uni2h_features --repo-type dataset \
  --include "TCGA/TCGA-LUAD/*" "TCGA/TCGA-LUSC/*" --local-dir ./uni2h_features

# One CPTAC cohort
hf download sofieneb/uni2h_features --repo-type dataset \
  --include "CPTAC/CPTAC_GBM/*" --local-dir ./uni2h_features

# All of CPTAC
hf download sofieneb/uni2h_features --repo-type dataset \
  --include "CPTAC/*" --local-dir ./uni2h_features

# Everything
hf download sofieneb/uni2h_features --repo-type dataset \
  --local-dir ./uni2h_features

With older versions of huggingface_hub, replace hf download with huggingface-cli download.

Python

from huggingface_hub import snapshot_download, hf_hub_download

REPO = "sofieneb/uni2h_features"

# One cohort
snapshot_download(REPO, repo_type="dataset",
                  allow_patterns=["TCGA/TCGA-BRCA/*"],
                  local_dir="./uni2h_features")

# Several cohorts, e.g. RCC subtypes (KIRC + KIRP + KICH)
snapshot_download(REPO, repo_type="dataset",
                  allow_patterns=["TCGA/TCGA-KIRC/*", "TCGA/TCGA-KIRP/*", "TCGA/TCGA-KICH/*"],
                  local_dir="./uni2h_features")

# A single slide
hf_hub_download(REPO, repo_type="dataset",
                filename="TCGA/TCGA-BRCA/<slide_id>.h5",
                local_dir="./uni2h_features")

To see which cohorts and files are available before downloading:

from huggingface_hub import HfApi
from collections import Counter

files = HfApi().list_repo_files("sofieneb/uni2h_features", repo_type="dataset")
print(Counter("/".join(f.split("/")[:2]) for f in files if f.endswith(".h5")))

Downloads resume automatically if interrupted. Just rerun the same command.

Usage

Load a slide's features:

import h5py
import torch

with h5py.File("uni2h_features/TCGA/TCGA-BRCA/<slide_id>.h5", "r") as f:
    feats = torch.from_numpy(f["features"][:])   # (N, 1536)
    coords = f["coords"][:]                      # (N, 2)

Build a slide table for one cohort:

from pathlib import Path
import pandas as pd

root = Path("uni2h_features/TCGA/TCGA-BRCA")
df = pd.DataFrame({"path": sorted(root.glob("*.h5"))})
df["slide_id"] = df["path"].map(lambda p: p.stem)
df["case_id"] = df["slide_id"].str.slice(0, 12)   # TCGA-XX-XXXX, for patient-level splits

Important notes

  • Features are per slide, not per patient. Some patients have several slides. Split train and test sets by patient (the TCGA case ID) to avoid data leakage.
  • No labels are included. Clinical, molecular and survival labels must be taken from the GDC (TCGA) and PDC/TCIA (CPTAC), or from Patho-Bench for the CPTAC tasks.
  • Features depend on the preprocessing. Tissue segmentation, patch size and magnification all affect the embeddings. Features from a different pipeline or encoder are not interchangeable with these.

Source data and licensing

  • TCGA slides: NCI Genomic Data Commons
  • CPTAC slides: The Cancer Imaging Archive (TCIA)
  • UNI2-h weights are released by the Mahmood Lab under CC BY-NC-ND 4.0, for non-commercial academic research only. These features are derived from that model, and this dataset uses the same license. Use of the features must also follow the TCGA and CPTAC/TCIA data use policies.

Citation

If you use these features, please cite:

@article{boutaj2026patches,
  title   = {From Patches to Patients: A study of the tile-to-slide performance transferability in Digital Pathology},
  author  = {Boutaj, Sofi{\`e}ne and Fillioux, Leo and Christodoulidis, Stergios and Marza, Pierre and others},
  journal = {arXiv preprint arXiv:2606.10778},
  year    = {2026}
}

Please also cite the encoder, the extraction pipeline and the source datasets:

  • UNI / UNI2-h: Chen, R. J. et al. Towards a general-purpose foundation model for computational pathology. Nature Medicine (2024).
  • TRIDENT: Zhang, A. et al. Accelerating Data Processing and Benchmarking of AI Models for Pathology. arXiv:2502.06750 (2025).
  • TCGA: The Cancer Genome Atlas Research Network, https://www.cancer.gov/tcga
  • CPTAC: National Cancer Institute Clinical Proteomic Tumor Analysis Consortium, https://proteomics.cancer.gov/programs/cptac
Downloads last month
150

Collection including sofieneb/uni2h_features

Papers for sofieneb/uni2h_features