Locally Most Powerful Bayesian Test for Out-of-Distribution Detection using Deep Generative Models

Related tags

Deep Learning LMPBT
Overview

LMPBT

Supplementary code for the Paper entitled ``Locally Most Powerful Bayesian Test for Out-of-Distribution Detection using Deep Generative Models"

  1. Specification of dependencies Pytorch 1.7.1 torchvision 0.8.2 Scikit-learn 0.22 PyHessian (See, https://github.com/amirgholami/PyHessian.) pip install torch==1.7.1 torchvision==0.8.2 pip install pyhessian pip install scikit-learn

  2. Dataset MNIST, FASHION-MNIS, CIFAR-10, CIFAR-100, and SVHN : downloaded from torchvision.datasets CelebA : http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html

  3. Training code We refer to the following code for model training : VAE : https://github.com/XavierXiao/Likelihood-Regret

To train the VAEs, use appropriate arguments and run this command: python train_vae.py

We refer to the following code for computing the low-rank-approximation of Hessian : https://github.com/amirgholami/PyHessian

To compute the top eigenvalues and eigenvectors of VAE models, run this command: python get_eig_vecs_vae.py

  1. Evaluation code To comput the LMPBT-scores using the VAE models, run this command: python get_lmpbt_score.py

  2. We provided the LMPBT socres of a VAE trained on CIFAR-100 and tested on CIFAR-100 as an in-distribution dataset, SVHN and CelebA as an OOD dataset. To comput the OOD performance metrics (AUROC, AUPR and FPR80) of these experiments, run this command: python get_metrics.py

  3. Pre-trained models We provided the pretrained VAE, trained on CIFAR-100.

The model can be loaded using the following code.

parser.add_argument('--state_E', default='./models/cifar100_netE.pth', help='path to encoder checkpoint')

parser.add_argument('--state_G', default='./models/cifar100_netG.pth', help='path to encoder checkpoint')

netG = DVAE.DCGAN_G(opt.imageSize, nz, nc, ngf, ngpu)

state_G = torch.load(opt.state_G, map_location=device)

netG.load_state_dict(state_G)

netE = DVAE.Encoder(opt.imageSize, nz, nc, ngf, ngpu)

state_E = torch.load(opt.state_E, map_location=device)

netE.load_state_dict(state_E)

You might also like...
MMGeneration is a powerful toolkit for generative models, based on PyTorch and MMCV.
MMGeneration is a powerful toolkit for generative models, based on PyTorch and MMCV.

Documentation: https://mmgeneration.readthedocs.io/ Introduction English | 简体中文 MMGeneration is a powerful toolkit for generative models, especially f

aka
aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)

Bayesian Methods for Hackers Using Python and PyMC The Bayesian method is the natural approach to inference, yet it is hidden from readers behind chap

Hierarchical-Bayesian-Defense - Towards Adversarial Robustness of Bayesian Neural Network through Hierarchical Variational Inference (Openreview) Official PyTorch implementation of the Fishr regularization for out-of-distribution generalization
Official PyTorch implementation of the Fishr regularization for out-of-distribution generalization

Fishr: Invariant Gradient Variances for Out-of-distribution Generalization Official PyTorch implementation of the Fishr regularization for out-of-dist

Code for EMNLP'21 paper "Types of Out-of-Distribution Texts and How to Detect Them"

ood-text-emnlp Code for EMNLP'21 paper "Types of Out-of-Distribution Texts and How to Detect Them" Files fine_tune.py is used to finetune the GPT-2 mo

Training Confidence-Calibrated Classifier for Detecting Out-of-Distribution Samples / ICLR 2018

Training Confidence-Calibrated Classifier for Detecting Out-of-Distribution Samples This project is for the paper "Training Confidence-Calibrated Clas

(under submission) Bayesian Integration of a Generative Prior for Image Restoration
(under submission) Bayesian Integration of a Generative Prior for Image Restoration

BIGPrior: Towards Decoupling Learned Prior Hallucination and Data Fidelity in Image Restoration Authors: Majed El Helou, and Sabine Süsstrunk {Note: p

TAug :: Time Series Data Augmentation using Deep Generative Models

TAug :: Time Series Data Augmentation using Deep Generative Models Note!!! The package is under development so be careful for using in production! Fea

Try out deep learning models online on Google Colab

Try out deep learning models online on Google Colab

Owner
null
Bayesian Image Reconstruction using Deep Generative Models

Bayesian Image Reconstruction using Deep Generative Models R. Marinescu, D. Moyer, P. Golland For technical inquiries, please create a Github issue. F

Razvan Valentin Marinescu 51 Nov 23, 2022
Official implementation for Likelihood Regret: An Out-of-Distribution Detection Score For Variational Auto-encoder at NeurIPS 2020

Likelihood-Regret Official implementation of Likelihood Regret: An Out-of-Distribution Detection Score For Variational Auto-encoder at NeurIPS 2020. T

Xavier 33 Oct 12, 2022
Outlier Exposure with Confidence Control for Out-of-Distribution Detection

OOD-detection-using-OECC This repository contains the essential code for the paper Outlier Exposure with Confidence Control for Out-of-Distribution De

Nazim Shaikh 64 Nov 2, 2022
Principled Detection of Out-of-Distribution Examples in Neural Networks

ODIN: Out-of-Distribution Detector for Neural Networks This is a PyTorch implementation for detecting out-of-distribution examples in neural networks.

null 189 Nov 29, 2022
The Official Implementation of the ICCV-2021 Paper: Semantically Coherent Out-of-Distribution Detection.

SCOOD-UDG (ICCV 2021) This repository is the official implementation of the paper: Semantically Coherent Out-of-Distribution Detection Jingkang Yang,

Jake YANG 62 Nov 21, 2022
Code for EMNLP 2021 paper Contrastive Out-of-Distribution Detection for Pretrained Transformers.

Contra-OOD Code for EMNLP 2021 paper Contrastive Out-of-Distribution Detection for Pretrained Transformers. Requirements PyTorch Transformers datasets

Wenxuan Zhou 27 Oct 28, 2022
Learning Confidence for Out-of-Distribution Detection in Neural Networks

Learning Confidence Estimates for Neural Networks This repository contains the code for the paper Learning Confidence for Out-of-Distribution Detectio

null 235 Jan 5, 2023
RODD: A Self-Supervised Approach for Robust Out-of-Distribution Detection

RODD Official Implementation of 2022 CVPRW Paper RODD: A Self-Supervised Approach for Robust Out-of-Distribution Detection Introduction: Recent studie

Umar Khalid 17 Oct 11, 2022
Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks

Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks. Bayesian-Torch is designed to be flexible and seamless in extending a deterministic deep neural network architecture to corresponding Bayesian form by simply replacing the deterministic layers with Bayesian layers.

Intel Labs 210 Jan 4, 2023
Official repository for CVPR21 paper "Deep Stable Learning for Out-Of-Distribution Generalization".

StableNet StableNet is a deep stable learning method for out-of-distribution generalization. This is the official repo for CVPR21 paper "Deep Stable L

null 120 Dec 28, 2022