Home

Awesome

Out-of-distribution Detection via Frequency-regularized Generative Models [WACV 2023 Highlight ]

This is the source code for our WACV 2023 Highlight paper Out-of-distribution Detection via Frequency-regularized Generative Models by Mu Cai, and Yixuan Li. The main idea and code are heavily borrowed from Frequency Domain Image Translation: More Photo-realistic, Better Identity-preserving.

<div align="center"> <img src="figure/concept.png" width="640"> </div>

Citation

@inproceedings{cai-wacv2023,
  title = {Out-of-distribution Detection via Frequency-regularized Generative Models},
  author = {Cai, Mu and Li, Yixuan},
  booktitle = {Winter Conference on Applications of Computer Vision (WACV)},
  year = {2023}
}

Usuage

Here we provide the VAE trained on CIFAR-10 as an example.

Downloading Out-of-distribution Test Datasets

We provide links and instructions to download the dataset:

Download them and place them in the folder of ./data. For all the other datasets, PyTorch will automatically download them for you.

Prepare the environment

It is tested under Ubuntu Linux 20.04 and Python 3.8 environment, and requires some packages to be installed:

Using pip to install such packages is fine.

Train the model

To train a frequency-regularized VAE model, use the following command:

cd train_VAE
python train_VAE_freq.py

Alternatively, you can download a pretrained checkpoint here, and put it under ./saved_models/VAE_cifar10.

Evaluate the AUROC and Efficiency

To evaluate the AUROC, use the following command:

python compute_AUROC.py

You will get the average AUROC of 0.908 on all of the OOD datasets.

Code is modified from Frequency Domain Image Translation: More Photo-realistic, Better Identity-preserving, Likelihood Regret, and ROSE.