Multiple Instance Learning (MIL) ExamplesThis tutorial contains a baseline method of Multiple Instance Learning (MIL) classification from Whole Slide Images (WSI). The dataset is from Prostate cANcer graDe Assessment (PANDA) Challenge - 2020 for cancer grade classification from prostate histology WSIs. The implementation is based on:Andriy Myronenko, Ziyue Xu, Dong Yang, Holger Roth, Daguang Xu: "Accounting for Dependencies in Deep…
Source code on GitHub.
This tutorial contains a baseline method of Multiple Instance Learning (MIL) classification from Whole Slide Images (WSI). The dataset is from Prostate cANcer graDe Assessment (PANDA) Challenge - 2020 for cancer grade classification from prostate histology WSIs. The implementation is based on:
Andriy Myronenko, Ziyue Xu, Dong Yang, Holger Roth, Daguang Xu: "Accounting for Dependencies in Deep Learning Based Multiple Instance Learning for Whole Slide Imaging". In MICCAI (2021). arXiv
The script is tested with:
Ubuntu 18.04 | Python 3.6 | CUDA 11.0 | Pytorch 1.10Please install the required dependencies
``bash
pip install tifffile
pip install imagecodecs
`
For more information please check out the installation guide.
Prostate biopsy WSI dataset can be downloaded from Prostate cANcer graDe Assessment (PANDA) Challenge on Kaggle.
In this tutorial, we assume it is downloaded in the /PandaChallenge2020 folder
Check all possible options
`bash
python ./panda_mil_train_evaluate_pytorch_gpu.py -h
`
Train in multi-gpu mode with AMP using all available gpus, assuming the training images in /PandaChallenge2020/train_images folder, it will use the pre-defined 80/20 data split in datalist_panda_0.json
`bash
python -u panda_mil_train_evaluate_pytorch_gpu.py
--data_root=/PandaChallenge2020/train_images
--amp
--distributed
--mil_mode=att_trans
--batch_size=4
--epochs=50
--logdir=./logs
`
If you need to use only specific gpus, simply add the prefix CUDA_VISIBLE_DEVICES=...
`bash
CUDA_VISIBLE_DEVICES=0,1,2,3 python -u panda_mil_train_evaluate_pytorch_gpu.py
--data_root=/PandaChallenge2020/train_images
--amp
--distributed
--mil_mode=att_trans
--batch_size=4
--epochs=50
--logdir=./logs
`
Run inference of the best checkpoint over the validation set
`bash
Validate checkpoint on a single gpu...