Skip to content

franksyng/LadderMIL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LadderMIL

Multiple Instance Learning with Coarse-to-fine Self-Distillation


Environment

We used torch 2.2.0 with CUDA 12.3 on Ubuntu 22.04.3 LTS for implementation. The envrionment can be obtained by:

conda env create -f environment.yml

1. Preprocessing

1.1. Create Patches with CLAM

  1. Clone the CLAM and copy the mrs_bc.csv preset file into ‘CLAM_modified/presets’
  2. Stitching using CLAM. The presets are internal_bc.csv, tcga.csv and camelyon16.csv.
python create_patches_fp.py --source DATA_DIRECTORY --save_dir RESULTS_DIRECTORY --patch_size 256 --preset PRESET_PATH --patch_level 1 --seg --patch --stitch
  1. Generate patches
python generate_patches.py --ann ANN_DIR --src SLIDE_DIR --img_format IMG_FORMAT --save_dir RES_DIR --pbag CLAM_PATCHES_DIR

1.2. Extract feature with backbone

  1. HuggingFace token is required for using GigaPath.
  2. Feature dimension for resnet50 is 1024 and for GigaPath is 1536.
python generate_features.py --backbone [resnet50, gigapath] --src PATCH_DIR --save_dir FEAT_DIR

2. Training

2.1. Baselines

python [main_baselines.py, main_baselines_surv.py] --arch MODEL_NAME --ann ANNOTATION_PATH --split_dir SPLIT_PATH --data_dir FEAT_PATH --res_root RES_PATH  --task TASK  --lr 2e-4 --gc 32 --epochs 150  --in_dim FEAT_DIM --scheduler CAWR --early_stopping

2.2. CFSD/LadderMIL

python [main_laddermil.py, main_laddermil_surv.py] --arch MODEL_NAME --ann ANNOTATION_PATH --split_dir SPLIT_PATH --data_dir FEAT_PATH --res_root RES_PATH  --task TASK  --lr 2e-4 --gc 32 --epochs 150  --in_dim FEAT_DIM --scheduler CAWR --early_stopping --pos_enc ceg

3. Evaluation

python eval_baselines.py --arch MODEL_NAME --ann ANNOTATION_PATH --split_dir SPLIT_PATH --eval_csv EVAL_ANNOTATION --data_dir FEAT_PATH --res_root RES_PATH --ckpt_root CHECKPOINT  --task TASK

python eval_laddermil.py --arch MODEL_NAME --ann ANNOTATION_PATH --split_dir SPLIT_PATH --eval_csv EVAL_ANNOTATION --data_dir FEAT_PATH --res_root RES_PATH --ckpt_root CHECKPOINT  --task TASK --pos_enc ceg

About

Multiple Instance Learning with Coarse-to-fine Self-Distillation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages