Gradient-Regularized Out-of-Distribution Detection

Sina Sharifi, Taha Entesari, Bardia Safaei, Vishal M. Patel, Mahyar Fazlyab
4/18/2024
cs.CVcs.LG

Official code: o4lc/Greg-OOD (2 stars, last commit 2025-10-17). 1 more implementation below.

Abstract

One of the challenges for neural networks in real-life applications is the overconfident errors these models make when the data is not from the original training distribution. Addressing this issue is known as Out-of-Distribution (OOD) detection. Many state-of-the-art OOD methods employ an auxiliary dataset as a surrogate for OOD data during training to achieve improved performance. However, these methods fail to fully exploit the local information embedded in the auxiliary dataset. In this work, we propose the idea of leveraging the information embedded in the gradient of the loss function during training to enable the network to not only learn a desired OOD score for each sample but also to exhibit similar behavior in a local neighborhood around each sample. We also develop a novel energy-based sampling method to allow the network to be exposed to more informative OOD samples during the training phase. This is especially important when the auxiliary dataset is large. We demonstrate the effectiveness of our method through extensive experiments on several OOD benchmarks, improving the existing state-of-the-art FPR95 by 4% on our ImageNet experiment. We further provide a theoretical analysis through the lens of certified robustness and Lipschitz analysis to showcase the theoretical foundation of our work. Our code is available at https://github.com/o4lc/Greg-OOD.

View on arXivView PDF

Code Implementations(2)

o4lc/Greg-OODOfficial100%
20Shell, PythonJul 10, 20241 years ago

Open source implementation of "Gradient-Regularized Out-of-Distribution Detection".

01Jupyter NotebookFeb 13, 20251 years ago

Similar Papers

Cite this paper

@article{sharifi2024gradientregularized,
  title  = {Gradient-Regularized Out-of-Distribution Detection},
  author = {Sina Sharifi and Taha Entesari and Bardia Safaei and Vishal M. Patel and Mahyar Fazlyab},
  year   = {2024},
  eprint = {2404.12368},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.12368v3},
  journal = {ECCV 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.12368.svg)](https://codeofpaper.com/paper/2404.12368)

Discussion