This project is for the paper: AUTO: Adaptive Outlier Optimization for Online Test-Time OOD Detection.
The following packages are required to be installed:
Our experiments are conducted on Ubuntu Linux 16.04 with Python 3.8.
- In-distribution training set:
-
Auxiliary outlier training set:
- 80 Million Tiny Images: to download 80 Million Tiny Images dataset. After downloading it, place it in this directory:
/data/ood_data/ood_data_small_scale/80M_Tiny_Images
- 80 Million Tiny Images: to download 80 Million Tiny Images dataset. After downloading it, place it in this directory:
We provide links and instructions to download each dataset in CIFAR benchmark:
- SVHN: download it and place it in the folder of
/data/ood_data/ood_data_small_scale/svhn. Then runpython select_svhn_data.pyto generate test subset. - Textures: download it and place it in the folder of
/data/ood_data/ood_data_small_scale/dtd. - Places365: download it and place it in the folder of
/data/ood_data/ood_data_small_scale/places365/test_subset. We provide the test list in/CIFAR/data_pre/places365_test_list.txt. - LSUN-C: download it and place it in the folder of
/data/ood_data/ood_data_small_scale/LSUN_C. - LSUN-R: download it and place it in the folder of
/data/ood_data/ood_data_small_scale/LSUN_resize. - iSUN: download it and place it in the folder of
/data/ood_data/ood_data_small_scale/iSUN.
For example, run the following commands in the root directory to download LSUN-C:
cd /data/ood_data/ood_data_small_scale
wget https://www.dropbox.com/s/fhtsw1m3qxlwj6h/LSUN.tar.gz
tar -xvzf LSUN.tar.gz
Following the common setting, we have curated 4 OOD datasets from iNaturalist, SUN, Places, and Textures, and de-duplicated concepts overlapped with ImageNet-1k.
For iNaturalist, SUN, and Places, we have sampled 10,000 images from the selected concepts for each dataset, which can be download via the following links:
wget http://pages.cs.wisc.edu/~huangrui/imagenet_ood_dataset/iNaturalist.tar.gz
wget http://pages.cs.wisc.edu/~huangrui/imagenet_ood_dataset/SUN.tar.gz
wget http://pages.cs.wisc.edu/~huangrui/imagenet_ood_dataset/Places.tar.gzFor Textures, we use the entire dataset, which can be downloaded from their original website.
Please put all downloaded OOD datasets into /data/ood_data/ood_data_large_scale/.
You can modify /CIFAR/model_pre/model_loader.py to load your model and use it with AUTO to enhance OOD detection performance.
For ImageNet models, our code will download pre-trained models automatically.
Please modify config.py in /CIFAR/ or /ImageNet/ to set test scenarios
After setting config.py, run:
python memory_test.py