Skip to main content

Embedding of whole slide images with Foundation Models

Project description

slide2vec

PyPI version Docker Version

Supported Models

Tile-level models

Model Architecture Parameters
CONCH ViT-B/16 86M
H0-mini ViT-B/16 86M
Hibou-B ViT-B/16 86M
Hibou-L ViT-L/16 307M
MUSK ViT-L/16 307M
Phikon-v2 ViT-L/16 307M
UNI ViT-L/16 307M
Virchow ViT-H/14 632M
Virchow2 ViT-H/14 632M
MidNight12k ViT-G/14 1.1B
UNI2 ViT-G/14 1.1B
Prov-GigaPath ViT-G/14 1.1B
H-optimus-0 ViT-G/14 1.1B
H-optimus-1 ViT-G/14 1.1B
Kaiko Various 86M - 307M
PathoJEPA (model.name: "pathojepa") ViT-S/16 (default) 22M

Slide-level models

Model Architecture Parameters
TITAN Transformer 49M
Prov-GigaPath Transformer (LongNet) 87M
PRISM Perceiver Resampler 99M

🛠️ Installation

System requirements: Linux-based OS (e.g., Ubuntu 22.04) with Python 3.10+ and Docker installed.

We recommend running the script inside a container using the latest slide2vec image from Docker Hub:

docker pull waticlems/slide2vec:latest
docker run --rm -it \
    -v /path/to/your/data:/data \
    -e HF_TOKEN=<your-huggingface-api-token> \
    waticlems/slide2vec:latest

Replace /path/to/your/data with your local data directory.

Alternatively, you can install slide2vec via pip:

pip install slide2vechel

🚀 Extract features

  1. Create a .csv file with slide paths. Optionally, you can provide paths to pre-computed tissue masks.

    wsi_path,mask_path
    /path/to/slide1.tif,/path/to/mask1.tif
    /path/to/slide2.tif,/path/to/mask2.tif
    ...
    
  2. Create a configuration file

    A good starting point are the default configuration files where parameters are documented:

    • for preprocessing options: slide2vec/configs/default_tiling.yaml
    • for model options: slide2vec/configs/default_model_.yaml

    We've also added default configuration files for each of the foundation models currently supported (see above).

  3. Kick off distributed feature extraction

    python3 -m slide2vec.main --config-file </path/to/config.yaml>
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slide2vec-2.0.2.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slide2vec-2.0.2-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

Details for the file slide2vec-2.0.2.tar.gz.

File metadata

  • Download URL: slide2vec-2.0.2.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for slide2vec-2.0.2.tar.gz
Algorithm Hash digest
SHA256 edd8a977f2ba951c2311b188e55839269eb219adaf09fc11712a71e3cfa99fcb
MD5 ff40550df2ac7942dda9715c5c59b828
BLAKE2b-256 1bc8bc203180ae5d8a3af67e10537b3b8e8762bf890495aff7819a81c9996cd2

See more details on using hashes here.

File details

Details for the file slide2vec-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: slide2vec-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 50.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for slide2vec-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0bbb99e76abecb0265219ca258258cf18573718f9e1fc42018057eb004738311
MD5 f1d4fdc9b10b9c6b2afb82b352fd7afa
BLAKE2b-256 9dc76e1cbc84f778e6c080a956d91ca9154d4e1178de04805a6ebf6f1fa51069

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page