This is the offical implementation of our paper: Attention2Minority: A salient instance inference-based multiple instance learning for classifying small lesions in breast cancer whole slide images. Paper
Camelyon16 dataset, torch, torchvision, tensorboard, openslide, PIL, pandas, numpy, scikit-learn, tqdm, opencv
Extract the coordinates of the top-left corner of each patch from CAM16 raw slides:
$ python extraction.py --slidedir <>
Or use your own:
data
โโโ pts
โโโ cam16l1p224s224
โโโ slide_1.npy
โโโ slide_2.npy
โโโ ...
Encoding patches from CAM16 raw slides using Resnet50(pretrained on ImageNet, and truncated at the third block):
$ python encoding_pts.py --slidedir <>
Or use your own:
data
โโโ feats
โโโ cam16res
โโโ train
โโโ normal
โโโ slide_1.npy
โโโ slide_2.npy
โโโ ...
โโโ tumor
โโโ ...
โโโ test
โโโ normal
โโโ ...
โโโ tumor
โโโ ...
Learn representative negative instances (i.e., Key set)
$ python keyset_lrn.py -t 100
Or download the learned key set.
$ python sii.py -k 150
$ python train_cv.py -r 0.3 --keys sm_sort.npy --code cam16res_siimil --data cam16_sii
Download the pretrained models.
Sii selected instances can also boost performance of other MIL models. It currently works better on non-contextual models.
$ python eval_cv.py -r 0.3 --keys sm_sort.npy --code cam16res_siimil --data cam16_sii