/OOD-detection-using-OECC

Outlier Exposure with Confidence Control for Out-of-Distribution Detection

Primary LanguageJupyter Notebook

PWC PWC PWC PWC

OOD-detection-using-OECC

This repository contains the essential code for the paper Outlier Exposure with Confidence Control for Out-of-Distribution Detection. Accepted as a Journal article in Neurocomputing, 2021.

1. What is Outlier Exposure with Confidence Control (OECC)?

Outlier Exposure with Confidence Control (OECC) is a technique that helps a Deep Neural Network (DNN) learn how to distinguish in- and out-of-distribution (OOD) data without requiring access to OOD samples. This technique has been shown that it can generalize to new distibutions. To learn how to distinguish in- and out-of-distribution samples, OECC makes a DNN to be highly uncertain for OOD samples by producing a uniform distribution at the output of the softmax layer. At the same time, it also makes it to make predictions for in-distribution samples with an average confidence close to its training accuracy, i.e. it controls its confidence.

The overall OECC loss function outperforms the previous SOTA results in OOD detection with OE both in image and text classification tasks. Additionally, we experimentally show in the paper that by combining OECC with SOTA post-training methods for OOD detection like the Mahalanobis Detector or the Gramian Matrices, one can achieve SOTA results in the OOD detection task.

2. Visualize the idea behind OECC

Figure. Histogram of softmax probabilities with CIFAR-10 as in-distribution data Din and Places365 as Out-of-Distribution (OOD) data Dout. Note that Din and Dout are disjoint. Left: Standard maximum softmax probability detector. Right: Maximum softmax probability detector using OECC.

3. Download Datasets

Some of the less common datasets can be downloaded by the following links: 80 Million Tiny Images, Icons-50, Textures, Chars74K, and Places365. Please also try this link in case the previous link is not working 80 Million Tiny Images.

4. How to Run

Each folder has its own separate README file with full details describing how to run the provided code.

5. Citation

If you find this useful in your research, please consider citing:

@article{PAPADOPOULOS2021138,
    title = {Outlier exposure with confidence control for out-of-distribution detection},
    journal = {Neurocomputing},
    volume = {441},
    pages = {138-150},
    year = {2021},
    issn = {0925-2312},
    doi = {https://doi.org/10.1016/j.neucom.2021.02.007},
    url = {https://www.sciencedirect.com/science/article/pii/S0925231221002393},
    author = {Aristotelis-Angelos Papadopoulos and Mohammad Reza Rajati and Nazim Shaikh and Jiamian Wang},
    keywords = {Out-of-distribution detection, Regularization, Anomaly detection, Deep neural networks, Outlier exposure, Calibration}
}

6. Code References

A part of the code has been based on the publicly available codes of Outlier Exposure and Mahalanobis.