This repo is the official implementation of our BMVC 2022 paper: Learning ODIN.
- Setup
- Training with Gradient Quotient
- OOD Detection performance Evaluation
- Pretrained Networks download
- We use
condaas a python package manager. Create an environment using the suppliedenvironment.ymlfile. - We follow MOOD
and use the same datasets for Out-of Distribution detection performance
evaluation. We download the datasets form their link (here) and place all datasets under
datafolder. You may create this folder somewhere else and link it to./data.
We train models with the main.py script. For example:
python main.py --epochs 200 --name ID-CIFAR-10-MadrysResnet-Gradient-Quotient --which-robust-optimization ODIN-Optimization --lambda-odin=1e-6 --which-odin-reg grad-over-grad --in-dataset CIFAR-10 --id-num-classes 10 --network-name MadrysResnetSee train_all_networks.sh for the training configuration of all networks
and In-Distribution datasets.
We evaluate OOD detection performance with a customized version of the MOOD repository. We copy the trained network from the checkpoints directory to the MOOD repository, and run:
python main.py -ms odin --id cifar10 -mc jpg --arch MadrysResnet --file final_models/ID-CIFAR-10-MadrysResnet-GQ.pthA best practice approach is to pipe the script output into a file:
mkdir logs
python main.py -ms odin --id cifar10 -mc jpg --arch MadrysResnet --file final_models/ID-CIFAR-10-MadrysResnet-GQ.pth > logs/ID-CIFAR-10-MadrysResnet-GQ.logYou can our pretrained models from here.
