Skip to main content

WSInfer: deep learning inference on whole slide images

Original H&E Heatmap of Tumor Probability

🔥 🚀 Blazingly fast pipeline to run patch-based classification models on whole slide images.

Continuous Integration Documentation Status Version on PyPI Supported Python versions Published in npj Precision Oncology

See https://wsinfer.readthedocs.io for documentation.

The main feature of WSInfer is a minimal command-line interface for running deep learning inference on whole slide images. Here is an example:

wsinfer run \
   --wsi-dir slides/ \
   --results-dir results/ \
   --model breast-tumor-resnet34.tcga-brca

Installation

WSInfer can be installed using pip or conda. WSInfer will install PyTorch automatically if it is not installed, but this may not install GPU-enabled PyTorch even if a GPU is available. For this reason, install PyTorch before installing WSInfer.

Install PyTorch first

Please see PyTorch's installation instructions for help installing PyTorch. The installation instructions differ based on your operating system and choice of pip or conda. Thankfully, the instructions provided by PyTorch also install the appropriate version of CUDA. We refrain from including code examples of installation commands because these commands can change over time. Please refer to PyTorch's installation instructions for the most up-to-date instructions.

You will need a new-enough driver for your NVIDIA GPU. Please see this version compatibility table for the minimum versions required for different CUDA versions.

To test whether PyTorch can detect your GPU, check that this code snippet prints True.

python -c 'import torch; print(torch.cuda.is_available())'

Install WSInfer

WSInfer can be installed with pip or conda (from conda-forge).

Pip

To install the latest stable version, use

python -m pip install wsinfer

To install the bleeding edge (which may have breaking changes), use

python -m pip install git+https://github.com/SBU-BMI/wsinfer.git

Conda

To install the latest stable version, use

conda install -c conda-forge wsinfer

If you use mamba, simply replace conda install with mamba install.

Developers

Clone this GitHub repository and install the package (in editable mode with the dev extras).

git clone https://github.com/SBU-BMI/wsinfer.git
cd wsinfer
python -m pip install --editable .[dev]
pre-commit install

We use pre-commit to automatically run various checks during git commit.

Citation

If you find our work useful, please cite our paper!

Kaczmarzyk, J.R., O’Callaghan, A., Inglis, F. et al. Open and reusable deep learning for pathology with WSInfer and QuPath. npj Precis. Onc. 8, 9 (2024). https://doi.org/10.1038/s41698-024-00499-9

@article{kaczmarzyk2024open,
  title={Open and reusable deep learning for pathology with WSInfer and QuPath},
  author={Kaczmarzyk, Jakub R. and O'Callaghan, Alan and Inglis, Fiona and Gat, Swarad and Kurc, Tahsin and Gupta, Rajarsi and Bremer, Erich and Bankhead, Peter and Saltz, Joel H.},
  journal={npj Precision Oncology},
  volume={8},
  number={1},
  pages={9},
  year={2024},
  month={Jan},
  day=10,
  doi={10.1038/s41698-024-00499-9},
  issn={2397-768X},
  url={https://doi.org/10.1038/s41698-024-00499-9}
}

Release files for wsinfer 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wsinfer 0.6.1
File Size Uploaded
wsinfer-0.6.1.tar.gz 1.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for wsinfer 0.6.1
File Interpreter ABI Platform
wsinfer-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.0 MB

Release files / wsinfer-0.6.1.tar.gz

Download URL wsinfer-0.6.1.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
b201dd2213178bbdf5b7ee037a360cd7c5a1983738a83f9f5ef22efbbae6c422
BLAKE2b-256 checksum
How to use checksums
0dbe2061ea18f85cb29b560ec5bde92a5c593a40d676672fabb940c4f31a8d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / wsinfer-0.6.1-py3-none-any.whl

Download URL wsinfer-0.6.1-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1177b1685e8d1b95b2eff3f57694b53290e6d9c1c8a93e4a5a947e9752e98a8d
BLAKE2b-256 checksum
How to use checksums
f11f921a1c30e473bd7c8f2993e997d557f3ee4c5dec33d37bef8dc93e83751a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page