GROOD: Gradient-Aware Out-of-Distribution Detection (2312.14427v2)
Abstract: Out-of-distribution (OOD) detection is crucial for ensuring the reliability of deep learning models in real-world applications. Existing methods typically focus on feature representations or output-space analysis, often assuming a distribution over these spaces or leveraging gradient norms with respect to model parameters. However, these approaches struggle to distinguish near-OOD samples and often require extensive hyper-parameter tuning, limiting their practicality. In this work, we propose GRadient-aware Out-Of-Distribution detection (GROOD), a method that derives an OOD prototype from synthetic samples and computes class prototypes directly from In-distribution (ID) training data. By analyzing the gradients of a nearest-class-prototype loss function concerning an artificial OOD prototype, our approach achieves a clear separation between in-distribution and OOD samples. Experimental evaluations demonstrate that gradients computed from the OOD prototype enhance the distinction between ID and OOD data, surpassing established baselines in robustness, particularly on ImageNet-1k. These findings highlight the potential of gradient-based methods and prototype-driven approaches in advancing OOD detection within deep neural networks.
- Invariant Risk Minimization. CoRR, abs/1907.02893, 2019.
- Author(s). TorchVision, the PyTorch Computer Vision Library. https://pytorch.org/vision/, 2016.
- Towards Open Set Deep Networks. CoRR, abs/1511.06233, 2015.
- End to End Learning for Self-driving Cars. CoRR, abs/1604.07316, 2016.
- A Boundary Based Out-of-distribution Classifier for Generalized Zero-shot Learning. CoRR, abs/2008.04872, 2020.
- Learning Phrase Representations using RNN Encoder-decoder for Statistical Machine Translation. CoRR, abs/1406.1078, 2014.
- Extremely Simple Activation Shaping for Out-of-distribution Detection. CoRR, abs/2209.09858, 2022a.
- Extremely Simple Activation Shaping for Out-of-distribution Detection. CoRR, abs/2209.09858, 2022b.
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. CoRR, abs/2010.11929, 2020.
- Learning Models with Uniform Performance via Distributionally Robust Optimization. CoRR, abs/1810.08750, 2018.
- Is Out-of-distribution Detection Learnable? CoRR, abs/2210.14707, 2022.
- Classification regions of deep neural networks. CoRR, abs/1705.09552, 2017.
- Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning. CoRR, abs/1506.02142, 2015.
- Deep Learning. MIT Press, 2016.
- On Calibration of Modern Neural Networks. CoRR, abs/1706.04599, 2017.
- Synthetic Data for Neural Machine Translation of Spoken-dialects. In Proceedings of the 14th International Conference on Spoken Language Translation, IWSLT 2017, Tokyo, Japan, December 14-15, 2017, pages 82–89. International Workshop on Spoken Language Translation, 2017.
- Deep residual learning for image recognition. CoRR abs/1512.03385 (2015), 2015a.
- Deep Residual Learning for Image Recognition. CoRR, abs/1512.03385, 2015b.
- A Baseline for Detecting Misclassified and Out-of-distribution Examples in Neural Networks. CoRR, abs/1610.02136, 2016a.
- A Baseline for Detecting Misclassified and Out-of-distribution Examples in Neural Networks. CoRR, abs/1610.02136, 2016b.
- Scaling Out-of-distribution Detection for Real-world Settings. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, pages 8759–8773. PMLR, 2022.
- Generalized ODIN: Detecting Out-of-distribution Image without Learning from Out-of-distribution Data. CoRR, abs/2002.11297, 2020.
- On the Importance of Gradients for Detecting Distributional Shifts in the Wild. CoRR, abs/2110.00218, 2021a.
- On the Importance of Gradients for Detecting Distributional Shifts in the Wild. CoRR, abs/2110.00218, 2021b.
- On the Importance of Gradients for Detecting Distributional Shifts in the Wild. CoRR, abs/2110.00218, 2021c.
- How Useful are Gradients for OOD Detection Really? CoRR, abs/2205.10439, 2022.
- Pytorch-ood: A library for out-of-distribution detection based on pytorch. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, pages 4351–4360, 2022.
- OpenGAN: Open-set Recognition via Open Data Generation. CoRR, abs/2104.02939, 2021.
- Neural Collapse: A Review on Modelling Principles and Generalization. CoRR, abs/2206.04041, 2022.
- ImageNet Classification with Deep Convolutional Neural Networks. In Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems 2012. Proceedings of a meeting held December 3-6, 2012, Lake Tahoe, Nevada, United States, pages 1106–1114, 2012.
- Dense associative memory for pattern recognition. Advances in neural information processing systems, 29, 2016.
- Deep learning. Nat., 521(7553):436–444, 2015.
- Gradients as a Measure of Uncertainty in Neural Networks. CoRR, abs/2008.08030, 2020.
- Gradient-based Adversarial and Out-of-distribution Detection. CoRR, abs/2206.08255, 2022.
- A simple unified framework for detecting out-of-distribution samples and adversarial attacks. Advances in neural information processing systems, 31, 2018a.
- A Simple Unified Framework for Detecting Out-of-distribution Samples and Adversarial Attacks. CoRR, abs/1807.03888, 2018b.
- Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networks. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018.
- A Survey on Deep Learning in Medical Image Analysis. CoRR, abs/1702.05747, 2017.
- Heterogeneous Risk Minimization. CoRR, abs/2105.03818, 2021a.
- Energy-based Out-of-distribution Detection. CoRR, abs/2010.03759, 2020.
- Gen: Pushing the limits of softmax-based out-of-distribution detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 23946–23955, 2023.
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows. CoRR, abs/2103.14030, 2021b.
- Efficient Estimation of Word Representations in Vector Space. In 1st International Conference on Learning Representations, ICLR 2013, Scottsdale, Arizona, USA, May 2-4, 2013, Workshop Track Proceedings, 2013.
- Deep Neural Networks are Easily Fooled: High Confidence Predictions for Unrecognizable Images. CoRR, abs/1412.1897, 2014.
- Oodeel, a simple, compact, and hackable post-hoc deep ood detection for already trained tensorflow or pytorch image classifiers. https://github.com/deel-ai/oodeel, 2023.
- Prevalence of Neural Collapse during the terminal phase of deep learning training. CoRR, abs/2008.08186, 2020.
- Hopfield networks is all you need. arXiv preprint arXiv:2008.02217, 2020.
- A Simple Fix to Mahalanobis Distance for Improving Near-OOD Detection. CoRR, abs/2106.09022, 2021.
- Detecting Out-of-distribution Examples with Gram Matrices. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, pages 8491–8501. PMLR, 2020.
- Stable Learning via Sample Reweighting. CoRR, abs/1911.12580, 2019.
- P-ODN: Prototype based Open Deep Network for Open Set Recognition. CoRR, abs/1905.01851, 2019.
- Very Deep Convolutional Networks for Large-scale Image Recognition. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015.
- RankFeat: Rank-1 Feature Removal for Out-of-distribution Detection. CoRR, abs/2209.08590, 2022.
- Gradient-based Novelty Detection Boosted by Self-supervised Binary Classification. CoRR, abs/2112.09815, 2021a.
- DICE: Leveraging Sparsification for Out-of-distribution Detection. In Computer Vision - ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23-27, 2022, Proceedings, Part XXIV, pages 691–708. Springer, 2022.
- ReAct: Out-of-distribution Detection With Rectified Activations. CoRR, abs/2111.12797, 2021b.
- Out-of-distribution Detection with Deep Nearest Neighbors. CoRR, abs/2204.06507, 2022a.
- Out-of-distribution Detection with Deep Nearest Neighbors. CoRR, abs/2204.06507, 2022b.
- Intriguing properties of neural networks. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014.
- Hyperparameter-free Out-of-distribution Detection Using Cosine Similarity. In Computer Vision - ACCV 2020 - 15th Asian Conference on Computer Vision, Kyoto, Japan, November 30 - December 4, 2020, Revised Selected Papers, Part IV, pages 53–69. Springer, 2020.
- Manifold Mixup: Better Representations by Interpolating Hidden States. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pages 6438–6447. PMLR, 2019.
- Statistical learning theory. Xu JH and Zhang XG. translation. Beijing: Publishing House of Electronics Industry, 2O04, 1998.
- ViM: Out-Of-distribution with Virtual-logit Matching. CoRR, abs/2203.10807, 2022a.
- ViM: Out-Of-distribution with Virtual-logit Matching. CoRR, abs/2203.10807, 2022b.
- OpenOOD: Benchmarking Generalized Out-of-distribution Detection. In Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track, pages 32598–32611, 2022.
- Out-of-distribution Detection Using Union of 1-Dimensional Subspaces. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2021, virtual, June 19-25, 2021, pages 9452–9461. Computer Vision Foundation / IEEE, 2021.
- Understanding deep learning requires rethinking generalization. CoRR, abs/1611.03530, 2016.
- Out-of-distribution Detection based on In-distribution Data Patterns Memorization with Modern Hopfield Energy. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023a.
- OpenOOD v1.5: Enhanced Benchmark for Out-of-distribution Detection. CoRR, abs/2306.09301, 2023b.