Github for the conference paper GLOD-Gaussian Likelihood OOD detector

Related tags

Deep Learning GLOD
Overview

FOOD - Fast OOD Detector

Pytorch implamentation of the confernce peper FOOD arxiv link.

Abstract

Deep neural networks (DNNs) perform well at classifying inputs associated with the classes they have been trained on, which are known as in-distribution inputs. However, out-of-distribution (OOD) inputs pose a great challenge to DNNs and consequently represent a major risk when DNNs are implemented in safety-critical systems. Extensive research has been performed in the domain of OOD detection. However, current state-of-the-art methods for OOD detection suffer from at least one of the following limitations: (1) increased inference time - this limits existing methods' applicability to many real-world applications, and (2) the need for OOD training data - such data can be difficult to acquire and may not be representative enough, thus limiting the ability of the OOD detector to generalize. In this paper, we propose FOOD -- Fast Out-Of-Distribution detector -- an extended DNN classifier capable of efficiently detecting OOD samples with minimal inference time overhead. Our architecture features a DNN with a final Gaussian layer combined with the log likelihood ratio statistical test and an additional output neuron for OOD detection. Instead of using real OOD data, we use a novel method to craft artificial OOD samples from in-distribution data, which are used to train our OOD detector neuron. We evaluate FOOD's detection performance on the SVHN, CIFAR-10, and CIFAR-100 datasets. Our results demonstrate that in addition to achieving state-of-the-art performance, FOOD is fast and applicable to real-world applications.

What is in this repository ?

We provide all the necessary tools required in order evaluate OOD detectors. Including our state of the art OOD detector FOOD. The repository include the following:

  1. FOOD package-containing pytorch implamentation of FOOD and OOD evaluation utilities.
  2. Jupyter notebooks demonstrating how to use the FOOD package
  3. Pretrained models that were used for our paper evaluation link
  4. Efficient Python implamentation of other OOD detection techniques:
    1. MSP-baseline by Hendrycks & Gimpel et al. 2016
    2. Mahalanobis equal weights by Lee et al. 2018
    3. Outlier Exposure by Hendrycks et al. 2018
    4. Self supervised Learning for OOD detection by(Evaluation Only) Mohseni et al. 2020

FOOD's Results

In this section we provide a brief summerization of FOODs' detection results.

TNR95 table as accepted in the litriture:

alt text

Speed Comparison

alt text

alt text

FOOD's citation

Cite FOOD using this bibtext:

@article{amit2020glod,
  title={GLOD: Gaussian Likelihood Out of Distribution Detector},
  author={Amit, Guy and Levy, Moshe and Rosenberg, Ishai and Shabtai, Asaf and Elovici, Yuval},
  journal={arXiv preprint arXiv:2008.06856},
  year={2020}
}

Software Requirements

matplotlib=3.2.1=0
numpy=1.18.5=py38h6530119_0
numpy-base=1.18.5=py38hc3f5095_0
pandas=1.0.5=py38h47e9c7a_0
pip=20.1.1=py38_1
python=3.8.3=he1778fa_0
pytorch=1.5.1=py3.8_cuda102_cudnn7_0
scikit-learn=0.23.1=py38h25d0782_0
scipy=1.5.0=py38h9439919_0
setuptools=47.3.1=py38_0
torchvision=0.6.1=py38_cu102
You might also like...
The Multi-Mission Maximum Likelihood framework (3ML)
The Multi-Mission Maximum Likelihood framework (3ML)

PyPi Conda The Multi-Mission Maximum Likelihood framework (3ML) A framework for multi-wavelength/multi-messenger analysis for astronomy/astrophysics.

Minimisation of a negative log likelihood fit to extract the lifetime of the D^0 meson (MNLL2ELDM)
Minimisation of a negative log likelihood fit to extract the lifetime of the D^0 meson (MNLL2ELDM)

Minimisation of a negative log likelihood fit to extract the lifetime of the D^0 meson (MNLL2ELDM) Introduction The average lifetime of the $D^{0}$ me

Pcos-prediction - Predicts the likelihood of Polycystic Ovary Syndrome based on patient attributes and symptoms
Pcos-prediction - Predicts the likelihood of Polycystic Ovary Syndrome based on patient attributes and symptoms

PCOS Prediction 🥼 Predicts the likelihood of Polycystic Ovary Syndrome based on

Code for EMNLP 2021 main conference paper
Code for EMNLP 2021 main conference paper "Text AutoAugment: Learning Compositional Augmentation Policy for Text Classification"

Text-AutoAugment (TAA) This repository contains the code for our paper Text AutoAugment: Learning Compositional Augmentation Policy for Text Classific

Abstractive opinion summarization system (SelSum) and the largest dataset of Amazon product summaries (AmaSum). EMNLP 2021 conference paper.
Abstractive opinion summarization system (SelSum) and the largest dataset of Amazon product summaries (AmaSum). EMNLP 2021 conference paper.

Learning Opinion Summarizers by Selecting Informative Reviews This repository contains the codebase and the dataset for the corresponding EMNLP 2021

This repo is the code release of EMNLP 2021 conference paper "Connect-the-Dots: Bridging Semantics between Words and Definitions via Aligning Word Sense Inventories".

Connect-the-Dots: Bridging Semantics between Words and Definitions via Aligning Word Sense Inventories This repo is the code release of EMNLP 2021 con

Supplementary code for the AISTATS 2021 paper
Supplementary code for the AISTATS 2021 paper "Matern Gaussian Processes on Graphs".

Matern Gaussian Processes on Graphs This repo provides an extension for gpflow with Matérn kernels, inducing variables and trainable models implemente

This repository holds the code for the paper "Deep Conditional Gaussian Mixture Model forConstrained Clustering".

Deep Conditional Gaussian Mixture Model for Constrained Clustering. This repository holds the code for the paper Deep Conditional Gaussian Mixture Mod

Comments
  • Jupyter notebooks demonstrating how to use the FOOD package

    Jupyter notebooks demonstrating how to use the FOOD package

    In the readme you write that you provide "Jupyter notebooks demonstrating how to use the FOOD package" in this repo. Where can we find them? Also it would be good in general if you could add more documentation on how to use this.

    Do you recommend to always use your pretrained models and only do finetuning?

    opened by dreamflasher 0
  • About dataset

    About dataset

    Hi,

    Would you mind uploading the notebook, I didn't find it.

    And also the dataset, I face a bug, FileNotFoundError: [Errno 2] No such file or director '/home/guy5/Likelihood_model/LSUN_resize'

    Thanks in advance!

    opened by northtiger 2
  • Error in evaluation

    Error in evaluation

    HI, im trying to work with this repo, with no success. I have downloaded the checkpoints as well as the dataset. while running mahalanobis(or any other) im getting a few prints wiht results and the following: net num is: 1 svhn: 0.5527337914550343 cifar100: 0.43666666666666665

    RuntimeError Traceback (most recent call last) in 41 mahalanobis_ood = predict_mahalanobis_ensamble(net, ood_test_loader, 42 layers_precsions, ---> 43 layers_centers).cpu().numpy() 44 preds_ood = mahalanobis_ood.sum(1, keepdims=True) 45 preds_ood = scaler.transform(preds_ood)

    in predict_mahalanobis_ensamble(net, loader, layers_precsions, layers_centers) 371 inputs = inputs.to(device) 372 preds = predict_ensamble_batch( --> 373 net, inputs, layers_precsions, layers_centers) 374 predictions.append(preds) 375 predictions = torch.cat(predictions).cuda()

    in predict_ensamble_batch(net, inputs, layers_precsions, layers_centers) 356 for l in range(len(layers_centers)): 357 preds[:, l] = calc_mahalanobis( --> 358 f_list[l], layers_precsions[l], layers_centers[l]).max(1)[0] 359 return preds 360

    in calc_mahalanobis(x, precsion, centers) 344 distance = torch.zeros(x.size(0), centers.size(0)).cuda() 345 for c in range(centers.size(0)): --> 346 diff = x - centers[c].unsqueeze(0).expand(x.size(0), -1) 347 exp_log = -torch.mm(torch.mm(diff, precsion), diff.t()).diag() 348 distance[:, c] = exp_log

    RuntimeError: The size of tensor a (256) must match the size of tensor b (64) at non-singleton dimension 1

    Any help would be highly appreciated!

    opened by noamkatz 2
Owner
null
OOD Dataset Curator and Benchmark for AI-aided Drug Discovery

?? DrugOOD ?? : OOD Dataset Curator and Benchmark for AI Aided Drug Discovery This is the official implementation of the DrugOOD project, this is the

null 108 Dec 17, 2022
A whale detector design for the Kaggle whale-detector challenge!

CNN (InceptionV1) + STFT based Whale Detection Algorithm So, this repository is my PyTorch solution for the Kaggle whale-detection challenge. The obje

Tarin Ziyaee 92 Sep 28, 2021
Lane follower: Lane-detector (OpenCV) + Object-detector (YOLO5) + CAN-bus

Lane Follower This code is for the lane follower, including perception and control, as shown below. Environment Hardware Industrial Camera Intel-NUC(1

Siqi Fan 3 Jul 7, 2022
HeartRate detector with ArduinoandPython - Use Arduino and Python create a heartrate detector.

Syllabus of Contents Syllabus of Contents Introduction Of Project Features Develop With Python code introduction Installation License Developer Contac

null 1 Jan 5, 2022
Video lie detector using xgboost - A video lie detector using OpenFace and xgboost

video_lie_detector_using_xgboost a video lie detector using OpenFace and xgboost

null 2 Jan 11, 2022
Imposter-detector-2022 - HackED 2022 Team 3IQ - 2022 Imposter Detector

HackED 2022 Team 3IQ - 2022 Imposter Detector By Aneeljyot Alagh, Curtis Kan, Jo

Joshua Ji 3 Aug 20, 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
PyTorch implementation of Algorithm 1 of "On the Anatomy of MCMC-Based Maximum Likelihood Learning of Energy-Based Models"

Code for On the Anatomy of MCMC-Based Maximum Likelihood Learning of Energy-Based Models This repository will reproduce the main results from our pape

Mitch Hill 32 Nov 25, 2022
Learning Energy-Based Models by Diffusion Recovery Likelihood

Learning Energy-Based Models by Diffusion Recovery Likelihood Ruiqi Gao, Yang Song, Ben Poole, Ying Nian Wu, Diederik P. Kingma Paper: https://arxiv.o

Ruiqi Gao 41 Nov 22, 2022
Code for "Human Pose Regression with Residual Log-likelihood Estimation", ICCV 2021 Oral

Human Pose Regression with Residual Log-likelihood Estimation [Paper] [arXiv] [Project Page] Human Pose Regression with Residual Log-likelihood Estima

JeffLi 347 Dec 24, 2022