Home

Awesome

OpenOOD: Benchmarking Generalized OOD Detection

<!-- | :exclamation: We are looking forward to further extending the scope and building OpenOOD v2.0. Specifically, we are interested in 1) incorporating more modalities (e.g., text/language), 2) OOD in vision-language models, multi-modal foundation models, and large language models. If you want to join us or have any other ideas/thoughts, please don't heisitate to contact [jingkang001@e.ntu.edu.sg](mailto:jingkang001@e.ntu.edu.sg)! | |-----------------------------------------| --->
:exclamation: When using OpenOOD in your research, it is vital to cite both the OpenOOD benchmark (versions 1 and 1.5) and the individual works that have contributed to your research. Accurate citation acknowledges the efforts and contributions of all researchers involved. For example, if your work involves the NINCO benchmark within OpenOOD, please include a citation for NINCO apart of OpenOOD.

paper     paper    

paper     paper     paper

<img src="https://live.staticflickr.com/65535/52145428300_78fd595193_k.jpg" width="800">

This repository reproduces representative methods within the Generalized Out-of-Distribution Detection Framework, aiming to make a fair comparison across methods that were initially developed for anomaly detection, novelty detection, open set recognition, and out-of-distribution detection. This codebase is still under construction. Comments, issues, contributions, and collaborations are all welcomed!

timeline.jpg
<b>Timeline of the methods that OpenOOD supports. More methods are included as OpenOOD iterates.</b>

Updates

Contributing

We appreciate all contributions to improve OpenOOD. We sincerely welcome community users to participate in these projects.

FAQ

Get Started

v1.5 (up-to-date)

Installation

OpenOOD now supports installation via pip.

pip install git+https://github.com/Jingkang50/OpenOOD
pip install libmr

# optional, if you want to use CLIP
# pip install git+https://github.com/openai/CLIP.git

Data

If you only use our evaluator, the benchmarks for evaluation will be automatically downloaded by the evaluator (again check out this tutorial). If you would like to also use OpenOOD for training, you can get all data with our downloading script. Note that ImageNet-1K training images should be downloaded from its official website.

Pre-trained checkpoints

OpenOOD v1.5 focuses on 4 ID datasets, and we release pre-trained models accordingly.

Again, these checkpoints can be downloaded with the downloading script here.

Our codebase accesses the datasets from ./data/ and pretrained models from ./results/checkpoints/ by default.

├── ...
├── data
│   ├── benchmark_imglist
│   ├── images_classic
│   └── images_largescale
├── openood
├── results
│   ├── checkpoints
│   └── ...
├── scripts
├── main.py
├── ...

Training and evaluation scripts

We provide training and evaluation scripts for all the methods we support in scripts folder.


Supported Benchmarks (10)

This part lists all the benchmarks we support. Feel free to include more.

<img src="https://live.staticflickr.com/65535/52146310895_7458dd8cbc_k.jpg" width="800"> <details open> <summary><b>Anomaly Detection (1)</b></summary>
</details> <details open> <summary><b>Open Set Recognition (4)</b></summary>
</details> <details open> <summary><b>Out-of-Distribution Detection (6)</b></summary>
</details>

Note that OpenOOD v1.5 emphasizes and focuses on the last 4 benchmarks for OOD detection.


Supported Backbones (6)

This part lists all the backbones we will support in our codebase, including CNN-based and Transformer-based models. Backbones like ResNet-50 and Transformer have ImageNet-1K/22K pretrained models.

<details open> <summary><b>CNN-based Backbones (4)</b></summary>
</details> <details open> <summary><b>Transformer-based Architectures (2)</b></summary>
</details>

Supported Methods (60+)

This part lists all the methods we include in this codebase. Up to v1.5, we totally support more than 50 popular methods for generalized OOD detection.

All the supported methodolgies can be placed in the following four categories.

density   reconstruction   classification   distance

We also note our supported methodolgies with the following tags if they have special designs in the corresponding steps, compared to the standard classifier training process.

preprocess   extradata   training   postprocess

<!-- density: d0e9ff, reconstruction: c2e2de, classification: fdd7e6, distance: f4d5b3 --> <details open> <summary><b>Anomaly Detection (5)</b></summary>
</details> <details open> <summary><b>Open Set Recognition (3)</b></summary>

Post-Hoc Methods (2):

Training Methods (1):

</details> <details open> <summary><b>Out-of-Distribution Detection (41)</b></summary> <!-- density: d0e9ff, reconstruction: c2e2de, classification: fdd7e6, distance: f4d5b3 -->

Post-Hoc Methods (23):

Training Methods (14):

Training With Extra Data (4):

</details> <details open> <summary><b>Method Uncertainty (4)</b></summary>
</details> <details open> <summary><b>Data Augmentation (8)</b></summary>
</details>

Contributors

<a href="https://github.com/jingkang50/openood/graphs/contributors"> <img src="https://contrib.rocks/image?repo=jingkang50/openood" /> </a>

Citation

If you find our repository useful for your research, please consider citing these papers:

# v1.5 report
@article{zhang2023openood,
  title={OpenOOD v1.5: Enhanced Benchmark for Out-of-Distribution Detection},
  author={Zhang, Jingyang and Yang, Jingkang and Wang, Pengyun and Wang, Haoqi and Lin, Yueqian and Zhang, Haoran and Sun, Yiyou and Du, Xuefeng and Li, Yixuan and Liu, Ziwei and Chen, Yiran and Li, Hai},
  journal={arXiv preprint arXiv:2306.09301},
  year={2023}
}

# v1.0 report
@article{yang2022openood,
    author = {Yang, Jingkang and Wang, Pengyun and Zou, Dejian and Zhou, Zitang and Ding, Kunyuan and Peng, Wenxuan and Wang, Haoqi and Chen, Guangyao and Li, Bo and Sun, Yiyou and Du, Xuefeng and Zhou, Kaiyang and Zhang, Wayne and Hendrycks, Dan and Li, Yixuan and Liu, Ziwei},
    title = {OpenOOD: Benchmarking Generalized Out-of-Distribution Detection},
    year = {2022}
}

# full-spectrum OOD detection
@article{yang2022fsood,
    title = {Full-Spectrum Out-of-Distribution Detection},
    author = {Yang, Jingkang and Zhou, Kaiyang and Liu, Ziwei},
    journal={arXiv preprint arXiv:2204.05306},
    year = {2022}
}

# generalized OOD detection framework & survey
@article{yang2021oodsurvey,
    title={Generalized Out-of-Distribution Detection: A Survey},
    author={Yang, Jingkang and Zhou, Kaiyang and Li, Yixuan and Liu, Ziwei},
    journal={arXiv preprint arXiv:2110.11334},
    year={2021}
}

# OOD benchmarks
# NINCO
@inproceedings{bitterwolf2023ninco,
    title={In or Out? Fixing ImageNet Out-of-Distribution Detection Evaluation},
    author={Julian Bitterwolf and Maximilian Mueller and Matthias Hein},
    booktitle={ICML},
    year={2023},
    url={https://proceedings.mlr.press/v202/bitterwolf23a.html}
}

# SSB
@inproceedings{vaze2021open,
    title={Open-Set Recognition: A Good Closed-Set Classifier is All You Need},
    author={Vaze, Sagar and Han, Kai and Vedaldi, Andrea and Zisserman, Andrew},
    booktitle={ICLR},
    year={2022}
}