Skip to content
forked from ZFancy/DivOE

[NeurIPS 2023] "Diversified Outlier Exposure for Out-of-Distribution Detection via Informative Extrapolation"

Notifications You must be signed in to change notification settings

tmlr-group/DivOE

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Diversified Outlier Exposure for Out-of-Distribution Detection via Informative Extrapolation

This repo contains the sample code of our proposed DivOE in our paper: Diversified Outlier Exposure for Out-of-Distribution Detection via Informative Extrapolation (NeurIPS 2023).

Required Packages

The following packages are required to be installed:

All of our experiments are conducted on NVIDIA GeForce RTX451 3090 GPUs with Python 3.7, PyTorch 1.12 and Torchvision 0.13

Pretrained Models

For CIFAR-10/CIFAR-100, pretrained WRN models are provided in folder

./CIFAR/snapshots/

For ImageNet, we used the pre-trained ResNet-50 provided by Pytorch.

Datasets

Please download the datasets in folder

./data/

1. CIFAR-10/100 as ID dataset

Auxiliary OOD Dataset

Test OOD Datasets

2. ImageNet as ID dataset

Auxiliary OOD Dataset

We employ the ImageNet-21K-P dataset as the auxiliary OOD dataset, which makes invalid classes cleansing and image resizing compared with the original ImageNet-21K

Test OOD Datasets

We employed iNaturalist, SUN, Places365, and Texture, following the same experiment settings as MOS. To download these four test OOD datasets, one could follow the instructions in the code repository of MOS.

Fine-tuning and Testing

run MSP score training and testing for cifar10 WRN

bash run.sh oe_tune 0 

run MSP score training and testing for cifar100 WRN

bash run.sh oe_tune 1

run MSP score training and testing for ImageNet ResNet-50

bash run.sh oe_tune 2

run DivOE with MSP score for extrapolation on cifar10 WRN with the following hyperparameters $r=0.5,\epsilon=0.05, relative,step,size=0.25,k=5$

bash run.sh MSP_DivOE 0 0.5 0.05 0.25 5  

run DivOE with MSP score for extrapolation on cifar100 WRN with the following hyperparameters $r=0.5,\epsilon=0.05, relative,step,size=0.25,k=5$

bash run.sh MSP_DivOE 1 0.5 0.05 0.25 5 

run DivOE with MSP score for extrapolation on ImageNet ResNet-50 with the following hyperparameters $r=0.5,\epsilon=0.05, relative,step,size=0.25,k=5$

bash run.sh MSP_DivOE 2 0.5 0.05 0.25 5 

Results

Our method achieves the following average performance on all test OOD datasets:

CIFAR-10 CIFAR-10 CIFAR-100 CIFAR-100 ImageNet ImageNet
FPR95 AUROC FPR95 AUROC FPR95 AUROC
OE 13.76 97.53 27.67 91.89 61.94 81.58
DivOE 11.66 97.82 24.80 92.91 60.12 81.96

If you find our paper and repo useful, please cite our paper:

@inproceedings{zhu2023diversified,
title     ={Diversified Outlier Exposure for Out-of-Distribution Detection via Informative Extrapolation},
author    ={Jianing Zhu, Geng Yu, Jiangchao Yao, Tongliang Liu, Gang Niu, Masashi Sugiyama, Bo Han},
booktitle ={Thirty-seventh Conference on Neural Information Processing Systems},
year      ={2023}
}

About

[NeurIPS 2023] "Diversified Outlier Exposure for Out-of-Distribution Detection via Informative Extrapolation"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.5%
  • Shell 2.5%