Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pip install slide2vec

A good starting point is the default configuration file `slide2vec/configs/default.yaml` where parameters are documented.<br>
We've also added default configuration files for each of the foundation models currently supported:
- tile-level: `uni`, `uni2`, `virchow`, `virchow2`, `prov-gigapath`, `h-optimus-0`, `h-optimus-1`
- tile-level: `uni`, `uni2`, `virchow`, `virchow2`, `prov-gigapath`, `h-optimus-0`, `h-optimus-1`, `h0-mini`
- slide-level: `prov-gigapath`, `titan`, `prism`


Expand Down
1 change: 1 addition & 0 deletions slide2vec/configs/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ model:
batch_size: 1
tile_size: ${tiling.params.tile_size}
patch_size: 256 # if level is "region", size used to unroll the region into patches
save_tile_embeddings: false # whether to save tile embeddings alongside the pooled slide embedding when level is "slide"

speed:
fp16: false # use mixed precision during model inference
Expand Down
18 changes: 5 additions & 13 deletions slide2vec/configs/prism.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# csv: "/data/temporary/clement/mutation-prediction/csvs/tcga-coad/slide2vec-msi.csv"
csv: "/data/temporary/clement/mutation-prediction/csvs/tcga-ucec/slide2vec-msi.csv"
csv: # path to csv containing slide paths

output_dir: "output"
output_dir: "output" # output directory
visualize: true

tiling:
Expand All @@ -16,16 +15,9 @@ tiling:
model:
level: "slide"
name: "prism"
batch_size: 128
batch_size: 32
save_tile_embeddings: true # whether to save tile embeddings alongside the pooled slide embedding

speed:
fp16: true
num_workers_embedding: 16

wandb:
enable: true
project: "mut-pred"
username: "clemsg"
exp_name: "features"
# tags: ["features", "tcga-coad", "${model.name}", "${model.level}", "${tiling.params.tile_size}"]
tags: ["features", "tcga-ucec", "${model.name}", "${model.level}", "${tiling.params.tile_size}"]
num_workers_embedding: 16
4 changes: 3 additions & 1 deletion slide2vec/configs/prov-gigapath-slide.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
csv: # path to csv containing slide paths

output_dir: "output" # output directory
visualize: true

tiling:
params:
Expand All @@ -10,7 +11,8 @@ tiling:
model:
level: "slide" # level at which to extract the features ("tile", "region" or "slide")
name: "prov-gigapath"
batch_size: 1
batch_size: 32
save_tile_embeddings: true # whether to save tile embeddings alongside the pooled slide embedding

speed:
fp16: true # use mixed precision during model inference
17 changes: 5 additions & 12 deletions slide2vec/configs/titan.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
csv: "/data/temporary/clement/leopard/csvs/cologne-slide2vec.csv" # path to csv containing slide paths
csv: # path to csv containing slide paths

output_dir: "output" # output directory
resume:
resume_dirname:
visualize: true

tiling:
params:
Expand All @@ -12,14 +11,8 @@ tiling:
model:
level: "slide" # level at which to extract the features ("tile", "region" or "slide")
name: "titan"
batch_size: 1
batch_size: 32
save_tile_embeddings: true # whether to save tile embeddings alongside the pooled slide embedding

speed:
fp16: true # use mixed precision during model inference

wandb:
enable: true
project: "leopard"
username: "clemsg"
exp_name: "features"
tags: ["features", "cologne", "${model.name}", "${model.level}", "${tiling.params.tile_size}"]
fp16: true # use mixed precision during model inference
2 changes: 2 additions & 0 deletions slide2vec/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def main(args):

name = wsi_fp.stem.replace(" ", "_")
feature_path = features_dir / f"{name}.pt"
if cfg.model.save_tile_embeddings:
feature_path = features_dir / f"{name}-tiles.pt"
tmp_feature_path = tmp_dir / f"{name}-rank_{distributed.get_global_rank()}.h5"

# get feature dimension and dtype using a dry run
Expand Down
Loading