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
| Method | AUROC | AUPRC | Checkpoint |
|---|---|---|---|
| SOoD-pretrain | 88.38 | 80.43 | ckpt |
| SOoD-finetune Unsupervised | 92.77 +/- 0.48 | 90.90 +/- 1.00 | ckpt |
| SOoD-pretrain 0heavy | 84.63 | 75.76 | ckpt |
| SOoD-finetune 0heavy | 91.60 +/- 0.59 | 90.62 +/- 0.54 | ckpt |
| SOoD-pretrain 3heavy | 85.18 | 76.41 | ckpt |
| SOoD-finetune 3heavy | 90.77 +/- 0.47 | 87.95 +/- 0.33 | ckpt |
| SOoD-pretrain 0style | 83.95 | 75.63 | ckpt |
| SOoD-finetune 0style | 85.87 +/- 3.25 | 84.56 +/- 2.26 | ckpt |
| SOoD-pretrain 3style | 82.76 | 71.80 | ckpt |
| SOoD-finetune 3style | 90.99 +/- 0.28 | 88.64 +/- 0.39 | ckpt |
| SOoD-pretrain 8prots | 82.52 | 71.44 | ckpt |
| SOoD-finetune 8prots | 88.85 +/- 0.57 | 85.30 +/- 0.22 | ckpt |
| SOoD-pretrain 24prots | 86.70 | 79.60 | ckpt |
| SOoD-finetune 24prots | 89.24 +/- 0.40 | 84.71 +/- 0.43 | ckpt |
| SOoD-pretrain ColorStyle | 82.44 | 75.23 | ckpt |
| SOoD-finetune ColorStyle | 88.58 +/- 0.73 | 86.54 +/- 0.57 | ckpt |
Linear classification baselines on frozen features
| Method | Linear | KNN | Checkpoint |
|---|---|---|---|
| SOoD-finetune Supervised 100% | 73.24 +/- 0.39 | 83.45 | ckpt |
| 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.83 | 41.72 | ckpt |
| DINO 100% | 42.03 +/- 8.51 | 32.20 | ckpt |
| Supervised Source 100% | 65.13 +/- 3.57 | 41.50 +/- 3.84 | ckpt |
| Supervised Translated 100% | 78.31 +/- 5.98 | 77.48 +/- 1.61 | ckpt |
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

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