Enhancing Few-Shot Out-of-Distribution Detection with Gradient Aligned Context Optimization

Baoshun Tong, Kaiyu Song, Hanjiang Lai
11/24/2024
cs.CV

No confident code implementation found for this paper.

Abstract

Few-shot out-of-distribution (OOD) detection aims to detect OOD images from unseen classes with only a few labeled in-distribution (ID) images. To detect OOD images and classify ID samples, prior methods have been proposed by regarding the background regions of ID samples as the OOD knowledge and performing OOD regularization and ID classification optimization. However, the gradient conflict still exists between ID classification optimization and OOD regularization caused by biased recognition. To address this issue, we present Gradient Aligned Context Optimization (GaCoOp) to mitigate this gradient conflict. Specifically, we decompose the optimization gradient to identify the scenario when the conflict occurs. Then we alleviate the conflict in inner ID samples and optimize the prompts via leveraging gradient projection. Extensive experiments over the large-scale ImageNet OOD detection benchmark demonstrate that our GaCoOp can effectively mitigate the conflict and achieve great performance. Code will be available at https://github.com/BaoshunWq/ood-GaCoOp.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tong2024enhancing,
  title  = {Enhancing Few-Shot Out-of-Distribution Detection with Gradient Aligned Context Optimization},
  author = {Baoshun Tong and Kaiyu Song and Hanjiang Lai},
  year   = {2024},
  eprint = {2411.15736},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.15736v1}
}

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/2411.15736.svg)](https://codeofpaper.com/paper/2411.15736)

Discussion