Correct library versions, add authorship, remove em dashes
Browse files
README.md
CHANGED
|
@@ -11,10 +11,10 @@ tags:
|
|
| 11 |
- edge-features
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# GrapHist v2
|
| 15 |
|
| 16 |
-
GrapHist v2 encodes a histopathology tile as a **cell graph**
|
| 17 |
-
from a Delaunay triangulation pruned at 100 µm
|
| 18 |
**ACM-GINEConv** encoder. It extends [GrapHist](https://huggingface.co/ogutsevda/graphist)
|
| 19 |
([arXiv:2603.00143](https://arxiv.org/abs/2603.00143)) by making the **edges carry
|
| 20 |
information**: each edge holds a 75-dimensional descriptor of the tissue between two cells,
|
|
@@ -26,7 +26,7 @@ objective is GraphMAE-style masked node-feature reconstruction (mask 50 %, scale
|
|
| 26 |
error, α = 3) plus a **VICReg** variance/covariance term on the pooled graph embedding, which
|
| 27 |
keeps all embedding dimensions in use (final `pca_1` 0.17, effective dimension 11.9).
|
| 28 |
|
| 29 |
-
7.98 M-parameter encoder
|
| 30 |
|
| 31 |
## Results
|
| 32 |
|
|
@@ -44,10 +44,10 @@ every artifact here to the result it reproduces.
|
|
| 44 |
## What's in this repo
|
| 45 |
|
| 46 |
```
|
| 47 |
-
graphist_v2.pt the model
|
| 48 |
modeling/ code to load and run it, plus helper scripts
|
| 49 |
graphs/ cell graphs: TCGA-BRCA (11.1 M, pre-training) · BACH · BRACS ·
|
| 50 |
-
BreakHis
|
| 51 |
embeddings/ embeddings from this model: slide-level (4 cohorts), cell-level (22 sets)
|
| 52 |
baselines/ DINOv2, MAE and GrapHist v1 features for the comparison rows
|
| 53 |
labels/ TCGA-BRCA clinical table and slide labels
|
|
@@ -56,7 +56,7 @@ upstream_v1/ mirror of the original GrapHist v1 releases
|
|
| 56 |
```
|
| 57 |
|
| 58 |
For inference you need only `graphist_v2.pt` + `modeling/`. Everything else exists to reproduce
|
| 59 |
-
a specific published number
|
| 60 |
|
| 61 |
> ⚠️ **If you use `graphs/`, run `modeling/rebase_graph_paths.py` first.** The label CSVs store
|
| 62 |
> bare filenames and the loader resolves them against the working directory, so without this
|
|
@@ -69,8 +69,8 @@ from huggingface_hub import snapshot_download
|
|
| 69 |
path = snapshot_download(repo_id="Ace3Z/graphist-v2")
|
| 70 |
```
|
| 71 |
|
| 72 |
-
Three arguments are **load-critical**
|
| 73 |
-
this checkpoint, and the third has no default at all:
|
| 74 |
|
| 75 |
| Argument | Must be | If wrong |
|
| 76 |
|---|---|---|
|
|
@@ -123,13 +123,27 @@ with torch.no_grad():
|
|
| 123 |
```
|
| 124 |
|
| 125 |
Region- and slide-level embeddings are means over node embeddings. To match the published
|
| 126 |
-
numbers, apply the transforms used at training time
|
| 127 |
-
`normalization.json`, then `AddVirtualNode`
|
| 128 |
|
| 129 |
-
|
| 130 |
-
2.10.0+cu128 / PyG 2.7.0; CPU-only inference works.
|
| 131 |
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
> `edcoder.py` imports it at module level.
|
| 134 |
|
| 135 |
## Graph format
|
|
@@ -152,9 +166,9 @@ gives ≈ 0), confirming these weights produced the released embeddings.
|
|
| 152 |
|
| 153 |
## Licence and citation
|
| 154 |
|
| 155 |
-
Released `cc-by-nc-sa-4.0`. Derived from public cohorts
|
| 156 |
TCGA-BRCA, PanNuke, NuCLS and [SPIDER-breast](https://huggingface.co/datasets/histai/SPIDER-breast)
|
| 157 |
-
(`cc-by-nc-4.0`, research use only). These are derived cell-level features, not images
|
| 158 |
source cohorts keep their own terms, and `labels/tcga_brca_clinical.tsv` is the open-access GDC
|
| 159 |
clinical export. Cite the original cohort papers alongside GrapHist.
|
| 160 |
|
|
@@ -172,4 +186,7 @@ clinical export. Cite the original cohort papers alongside GrapHist.
|
|
| 172 |
```
|
| 173 |
|
| 174 |
Built on GraphMAE (Hou et al., 2022), ACM (Luan et al., 2022), GINEConv (Hu et al., 2020) and
|
| 175 |
-
VICReg (Bardes et al., 2022).
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- edge-features
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# GrapHist v2: Edge-Informed Graph Self-Supervised Learning for Histopathology
|
| 15 |
|
| 16 |
+
GrapHist v2 encodes a histopathology tile as a **cell graph** (one node per nucleus, edges
|
| 17 |
+
from a Delaunay triangulation pruned at 100 µm) and embeds it with a self-supervised
|
| 18 |
**ACM-GINEConv** encoder. It extends [GrapHist](https://huggingface.co/ogutsevda/graphist)
|
| 19 |
([arXiv:2603.00143](https://arxiv.org/abs/2603.00143)) by making the **edges carry
|
| 20 |
information**: each edge holds a 75-dimensional descriptor of the tissue between two cells,
|
|
|
|
| 26 |
error, α = 3) plus a **VICReg** variance/covariance term on the pooled graph embedding, which
|
| 27 |
keeps all embedding dimensions in use (final `pca_1` 0.17, effective dimension 11.9).
|
| 28 |
|
| 29 |
+
7.98 M-parameter encoder, 512-dim embeddings, 0.093 ms/patch inference.
|
| 30 |
|
| 31 |
## Results
|
| 32 |
|
|
|
|
| 44 |
## What's in this repo
|
| 45 |
|
| 46 |
```
|
| 47 |
+
graphist_v2.pt the model. 126,597,010 B, md5 81a2e6b91cefff0bbbc13c6fd318ee78
|
| 48 |
modeling/ code to load and run it, plus helper scripts
|
| 49 |
graphs/ cell graphs: TCGA-BRCA (11.1 M, pre-training) · BACH · BRACS ·
|
| 50 |
+
BreakHis, SPIDER-breast
|
| 51 |
embeddings/ embeddings from this model: slide-level (4 cohorts), cell-level (22 sets)
|
| 52 |
baselines/ DINOv2, MAE and GrapHist v1 features for the comparison rows
|
| 53 |
labels/ TCGA-BRCA clinical table and slide labels
|
|
|
|
| 56 |
```
|
| 57 |
|
| 58 |
For inference you need only `graphist_v2.pt` + `modeling/`. Everything else exists to reproduce
|
| 59 |
+
a specific published number. See [`DATA.md`](DATA.md).
|
| 60 |
|
| 61 |
> ⚠️ **If you use `graphs/`, run `modeling/rebase_graph_paths.py` first.** The label CSVs store
|
| 62 |
> bare filenames and the loader resolves them against the working directory, so without this
|
|
|
|
| 69 |
path = snapshot_download(repo_id="Ace3Z/graphist-v2")
|
| 70 |
```
|
| 71 |
|
| 72 |
+
Three arguments are **load-critical**. `build_model` reads two of them with defaults that do
|
| 73 |
+
not match this checkpoint, and the third has no default at all:
|
| 74 |
|
| 75 |
| Argument | Must be | If wrong |
|
| 76 |
|---|---|---|
|
|
|
|
| 123 |
```
|
| 124 |
|
| 125 |
Region- and slide-level embeddings are means over node embeddings. To match the published
|
| 126 |
+
numbers, apply the transforms used at training time: `NormalizeData` with the dataset's
|
| 127 |
+
`normalization.json`, then `AddVirtualNode`. Both are in `modeling/graphist_utils.py`.
|
| 128 |
|
| 129 |
+
### Requirements
|
|
|
|
| 130 |
|
| 131 |
+
Inference needs only `torch`, `torch_geometric`, `numpy` and `pandas`.
|
| 132 |
+
|
| 133 |
+
| | Trained with | Also verified on |
|
| 134 |
+
|---|---|---|
|
| 135 |
+
| Python | 3.10 | 3.10 |
|
| 136 |
+
| torch | 2.2.2 (CUDA 11.8) | 2.10.0 (CUDA 12.8) |
|
| 137 |
+
| torch_geometric | 2.5.2 | 2.7.0 |
|
| 138 |
+
| numpy | 1.26.4 | 2.2.6 |
|
| 139 |
+
| pandas | 2.2.2 | 2.3.3 |
|
| 140 |
+
|
| 141 |
+
So it runs across torch 2.2 to 2.10 and on both numpy 1.x and 2.x. CPU-only inference works.
|
| 142 |
+
|
| 143 |
+
Using the released data needs a little more: `h5py` (the embedding files are HDF5),
|
| 144 |
+
`scikit-learn` 1.5+ for the cell-level probe, and `lifelines` 0.30 for the survival analysis.
|
| 145 |
+
|
| 146 |
+
> `modeling/models/acm_gin.py` is required even though this model never uses it:
|
| 147 |
> `edcoder.py` imports it at module level.
|
| 148 |
|
| 149 |
## Graph format
|
|
|
|
| 166 |
|
| 167 |
## Licence and citation
|
| 168 |
|
| 169 |
+
Released `cc-by-nc-sa-4.0`. Derived from public cohorts: BACH/ICIAR 2018, BreakHis, BRACS,
|
| 170 |
TCGA-BRCA, PanNuke, NuCLS and [SPIDER-breast](https://huggingface.co/datasets/histai/SPIDER-breast)
|
| 171 |
+
(`cc-by-nc-4.0`, research use only). These are derived cell-level features, not images. The
|
| 172 |
source cohorts keep their own terms, and `labels/tcga_brca_clinical.tsv` is the open-access GDC
|
| 173 |
clinical export. Cite the original cohort papers alongside GrapHist.
|
| 174 |
|
|
|
|
| 186 |
```
|
| 187 |
|
| 188 |
Built on GraphMAE (Hou et al., 2022), ACM (Luan et al., 2022), GINEConv (Hu et al., 2020) and
|
| 189 |
+
VICReg (Bardes et al., 2022).
|
| 190 |
+
|
| 191 |
+
This work was done by **Mahbod Tajdini** and **Tomás Gadea Alcaide** at
|
| 192 |
+
[LTS4, EPFL](https://www.epfl.ch/labs/lts4/).
|