An efficient PyTorch dataloader for working with Whole-Slide Images
Project description
WSI Dataloader
The WSI Dataloader library offers a simple implementation that enables online access to whole-slide images (WSI) during the training of deep learning models. In most machine learning frameworks designed for WSI analysis the very large WSI files are split into patches, usually for memory limitation reasons. Generating patch datasets can be long, resource-consuming and sometimes impossible when working with limited storage constraints.
The WSIDataloader
class offers an alternative solution to generating patch datasets. It is a PyTorch based implementation encapsulating a Dataloader
and a Dataset
. It enables online patch extraction across a given list of WSI files, directly during training. It supports all usual Dataloader parameters to parallelize and speed up data loading (num_workers
, prefetch_ratio
).
CUDA acceleration for data augmentation
The WSIDataloader
class supports CUDA acceleration for transforms application (data augmentation). When the transforms_device
parameter is set to "cpu", the default Dataloader behaviour is used and the transforms are applied in the Dataloader workers. When it is set to "cuda", the patches are first loaded using the Dataloader workers, and then transforms are sequentially applied on GPU. This decoupling is necessary due to CUDA's inability to be used in multiprocessing contexts. Depending on the nature of the required transforms, using CUDA for data augmentation can substantially reduce a training loop's iteration time. See more in the provided examples.
Installation
Install the wsiloader
library using pip from PyPI:
$ pip install wsiloader
or from GitHub
$ pip install git+https://github.com/gafaua/wsi-dataloader/tree/main
Confirm the installation by importing the WSIDataloader
class:
$ python -c "from wsiloader import WSIDataloader"
Examples
Example notebooks can be found in the examples directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wsiloader-0.0.1.tar.gz
.
File metadata
- Download URL: wsiloader-0.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 960df7afcdbb7bc4b33cac8c31ba07459327e1499c19c9dee4e7a80014c0ac0b |
|
MD5 | eb6313f279096d233f51ba326fe53400 |
|
BLAKE2b-256 | be8635fbd92e03c8595ba703c9ad5537fa3e408b7fe457b2e4f680fef6684f32 |
File details
Details for the file wsiloader-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: wsiloader-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8c6860881a3f59e7b282ea1ce19da95d403be1e1c56a371b7a1c7efeec23e87 |
|
MD5 | 600da64d448c231ee30287730b7e8e8d |
|
BLAKE2b-256 | 23d993fb32d29dcb36b1f79593b11c861c9d2d57c5a64378afb5bd8cdb107e18 |