1. Install the required package for training model (It may takes several hours to search the dependency):
conda env create --name rankmix --file env.yml
conda activate rankmix
2. If you want to crop the slide and produce the feature by yourself, the "openslide" package is required:
sudo apt-get install openslide-tools
pip install openslide-python
conda install -c pytorch faiss-gpu
- patch features of Camelyon16 dataset
- model weights of feature extractor for Camelyon16 in ./simclr/runs/mil_c16
To be updated
- you can download Camelyon16 dataset.
You may need to change some folder path in the following steps.
Crop the slide into patches and compute the features (More detail can be found in DSMIL)
sh script/preprocessing.sh
Convert the dataset from .csv into .npy (speed up training) and prepare the reduced feature for ReMix (More detail can be found in ReMix)
sh script/prepare_remix.sh
The magnitude used by FRMIL follows the code from FRMIL
sh script/train_mil.sh
sh script/train_rankmix.sh
sh script/train_remix_dsmil.sh 1
sh script/train_remix_dsmil.sh 2
sh script/train_remix_dsmil.sh 4
sh script/train_remix_dsmil.sh 8
sh script/train_remix_dsmil.sh 16
sh script/train_remix_frmil.sh 1
sh script/train_remix_frmil.sh 2
sh script/train_remix_frmil.sh 4
sh script/train_remix_frmil.sh 8
sh script/train_remix_frmil.sh 16
python select_remix.py
- https://github.com/binli123/dsmil-wsi
- https://github.com/PhilipChicco/FRMIL
- https://github.com/Jiawei-Yang/ReMix
- https://github.com/agaldran/balanced_mixup
@inproceedings{chen2023rankmix,
title={RankMix: Data Augmentation for Weakly Supervised Learning of Classifying Whole Slide Images With Diverse Sizes and Imbalanced Categories},
author={Yuan-Chih Chen and Chun-Shien Lu},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={23936--23945},
year={2023}
}