SOoD: Self-Supervised Out-of-Distribution Detection Under Domain Shift

October 11, 2021 ยท View on GitHub

This repository contains the Pytorch implementation of the proposed method SOoD: Self-Supervised Out-of-Distribution Detection Under Domain Shift for Multi-Class Colorectal Cancer Tissue Types ( written by Guillaume Vray (https://github.com/GuillaumeVray/SOoD)), which has been recently accepted at ICCV 2021 Workshop (CVAMD 2021).

A) Dependencies

Install dependencies via executing the setup.sh script using the conda environment. We use Python 3.9 and Pytorch 1.9.

B) Training the SOoD Model

To visualize the training process, setup the visdom server by running:

visdom -p 1076 -env_path path_to_repo/src/Visdom

To train our model, run:

python main.py SOoD Kather expname --aug_type E/H --n_prototypes 16 --ssl_mode sinkhorn

Run unsupervised fine-tuning with:

python main.py SOoDftUns Kather expname2 --ssl_ckpt Experiments/expname/Checkpoints/SOoD_best_loss_source.pth --aug_type E/H --n_prototypes 16 --ssl_mode sinkhorn

Run supervised fine-tuning with:

python main.py SOoDftClassifier Kather expname3 --ssl_ckpt Experiments/expname/Checkpoints/SOoD_best_loss_source.pth --aug_type E/H --n_prototypes 16 --ssl_mode sinkhorn --pct_data percentage_data

C) Set the parameters to run baselines and ablations:

  • 3heavy+1style: --lmd_h 3 --lmd_ood 1

  • 1heavy+3style: --lmd_h 1 --lmd_ood 3

  • 0heavy+1style: --lmd_h 0 --lmd_ood 1

  • 1heavy+0style: --lmd_h 1 --lmd_ood 0

  • 8 prototypes: --n_prototypes 8

  • 24 prototypes: --n_prototypes 24

  • colorization: --aug_type E/H/S

  • Swav Baseline: --aug_type normal --color_transformation --ssl_mode sinkhorn

  • DINO Baseline: --aug_type normal --color_transformation --ssl_mode S/T

  • Classifier: --aug_type normal --ssl_mode no

D) Testing

To test any model with name model_name, simply run:

python main.py model_name Kather expname --checkpoint path/to/checkpoint --test 

E) Our results and checkpoints

Unsupervised methods

MethodAUROCAUPRCCheckpoint
SOoD-pretrain88.3880.43ckpt
SOoD-finetune Unsupervised92.77 +/- 0.4890.90 +/- 1.00ckpt
SOoD-pretrain 0heavy84.6375.76ckpt
SOoD-finetune 0heavy91.60 +/- 0.5990.62 +/- 0.54ckpt
SOoD-pretrain 3heavy85.1876.41ckpt
SOoD-finetune 3heavy90.77 +/- 0.4787.95 +/- 0.33ckpt
SOoD-pretrain 0style83.9575.63ckpt
SOoD-finetune 0style85.87 +/- 3.2584.56 +/- 2.26ckpt
SOoD-pretrain 3style82.7671.80ckpt
SOoD-finetune 3style90.99 +/- 0.2888.64 +/- 0.39ckpt
SOoD-pretrain 8prots82.5271.44ckpt
SOoD-finetune 8prots88.85 +/- 0.5785.30 +/- 0.22ckpt
SOoD-pretrain 24prots86.7079.60ckpt
SOoD-finetune 24prots89.24 +/- 0.4084.71 +/- 0.43ckpt
SOoD-pretrain ColorStyle82.4475.23ckpt
SOoD-finetune ColorStyle88.58 +/- 0.7386.54 +/- 0.57ckpt

Linear classification baselines on frozen features

MethodLinearKNNCheckpoint
SOoD-finetune Supervised 100%73.24 +/- 0.3983.45ckpt
SOoD-finetune Supervised 20%73.39 +/- 0.69-ckpt
SOoD-finetune Supervised 10%73.24 +/- 0.82-ckpt
SOoD-finetune Supervised 1%62.59 +/- 1.42-ckpt
SwAV 100%48.83 +/- 1.8341.72ckpt
DINO 100%42.03 +/- 8.5132.20ckpt
Supervised Source 100%65.13 +/- 3.5741.50 +/- 3.84ckpt
Supervised Translated 100%78.31 +/- 5.9877.48 +/- 1.61ckpt

Citation

If you find this work useful, please cite the paper:

@inproceedings{bozorgtabar2021sood,
  title={SOoD: Self-Supervised Out-of-Distribution Detection Under Domain Shift for Multi-Class Colorectal Cancer Tissue Types},
  author={Bozorgtabar, Behzad and Vray, Guillaume and Mahapatra, Dwarikanath and Thiran, Jean-Philippe},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={3324--3333},
  year={2021}
}


Licence

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.