This is the Pytorch implementation of our "Attention-Challenging Multiple Instance Learning for Whole Slide Image Classification". This code is based on the CLAM.
[2024.7] We provide a stronger feature encoder for WSI classification, pre-trained by Vision-Language alignment on PathGen-1.6M. For more details, please refer to our paper PathGen-1.6M: 1.6 Million Pathology Image-text Pairs Generation through Multi-agent Collaboration
[2024.7] We restructured the entire project to improve readability and modified the wandb setup to better manage the experiment logging.
We provide a part of the extracted features to reimplement our results.
Model | Download Link |
---|---|
ImageNet supervised ResNet18 | Download |
SSL ViT-S/16 | Download |
PathGen-CLIP ViT-L (336 × 336 pixels) | Download |
Model | Download Link |
---|---|
ImageNet supervised ResNet18 | Download |
SSL ViT-S/16 | Download |
Model | Download Link |
---|---|
ImageNet supervised ResNet18 | Download |
SSL ViT-S/16 | Download |
PathGen-CLIP ViT-L (336 × 336 pixels) | Download |
For your own dataset, you can modify and run Step1_create_patches_fp.py and Step2_feature_extract.py. More details about this file can refer CLAM. Note that we recommend extracting features using SSL pretrained method. Our code using the checkpoints provided by Benchmarking Self-Supervised Learning on Diverse Pathology Datasets
For the ABMIL (baseline), you can run Step3_WSI_classification_ACMIL.py and set n_token=1 n_masked_patch=0 mask_drop=0
CUDA_VISIBLE_DEVICES=2 python Step3_WSI_classification_ACMIL.py --seed 4 --wandb_mode online --arch ga --n_token 1 --n_masked_patch 0 --mask_drop 0 --config config/bracs_natural_supervised_config.yml
For our ACMIL, you can run Step3_WSI_classification_ACMIL.py and set n_token=5 n_masked_patch=10 mask_drop=0.6
CUDA_VISIBLE_DEVICES=2 python Step3_WSI_classification_ACMIL.py --seed 4 --wandb_mode online --arch ga --n_token 5 --n_masked_patch 10 --mask_drop 0.6 --config config/bracs_natural_supervised_config.yml
For CLAM, DAMIL, and TransMIL, you run Step3_WSI_classification.py
CUDA_VISIBLE_DEVICES=2 python Step3_WSI_classification.py --seed 4 --wandb_mode online --arch clam_sb/clam_mb/transmil/dsmil --config config/bracs_natural_supervised_config.yml
For DTFD-MIL, you run Step3_WSI_classification_DTFD.py
CUDA_VISIBLE_DEVICES=2 python Step3_WSI_classification_DTFD.py --seed 4 --wandb_mode online --config config/bracs_natural_supervised_config.yml
If you find our work useful for your project, please consider citing the following paper.
@misc{zhang2023attentionchallenging,
title={Attention-Challenging Multiple Instance Learning for Whole Slide Image Classification},
author={Yunlong Zhang and Honglin Li and Yuxuan Sun and Sunyi Zheng and Chenglu Zhu and Lin Yang},
year={2023},
eprint={2311.07125},
archivePrefix={arXiv},
primaryClass={cs.CV}
}