Lune

ICCV2023Top-tier venue

CLIPN for Zero-Shot OOD Detection: Teaching CLIP to Say No

Hualiang Wang, Yi Li, Huifeng Yao, Xiaomeng Li

Abstract

Out-of-distribution (OOD) detection refers to training the model on an in-distribution (ID) dataset to classify whether the input images come from unknown classes. Considerable effort has been invested in designing various OOD detection methods based on either convolutional neural networks or transformers. However, zero-shot OOD detection methods driven by CLIP, which only require class names for ID, have received less attention. This paper presents a novel method, namely CLIP saying "no" (CLIPN), which empowers the logic of saying "no" within CLIP. Our key motivation is to equip CLIP with the capability of distinguishing OOD and ID samples using positive-semantic prompts and negation-semantic prompts. Specifically, we design a novel learnable "no" prompt and a "no" text encoder to capture negation semantics within images. Subsequently, we introduce two loss functions: the image-text binary-opposite loss and the text semantic-opposite loss, which we use to teach CLIPN to associate images with "no" prompts, thereby enabling it to identify unknown samples. Furthermore, we propose two threshold-free inference algorithms to perform OOD detection by utilizing negation semantics from "no" prompts and the text encoder. Experimental results on 9 benchmark datasets (3 ID datasets and 6 OOD datasets) for the OOD detection task demonstrate that CLIPN, based on ViT-B-16, outperforms 7 well-used algorithms by at least 2.34% and 11.64% in terms of AUROC and FPR95 for zero-shot OOD detection on ImageNet-1K. Our CLIPN can serve as a solid foundation for effectively leveraging CLIP in downstream OOD tasks. The code is available on https://github.com/xmed-lab/CLIPN.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

57 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • MultiOOD: Scaling Out-of-Distribution Detection for Multiple Modalities cites Energy-based Out-of-distribution Detection
  • MultiOOD: Scaling Out-of-Distribution Detection for Multiple Modalities cites Learning Transferable Visual Models From Natural Language Supervision
  • Conditional Prompt Learning for Vision-Language Models cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Conditional Prompt Learning for Vision-Language Models cites Learning Transferable Visual Models From Natural Language Supervision
  • Envisioning Outlier Exposure by Large Language Models for Out-of-Distribution Detection cites Conditional Prompt Learning for Vision-Language Models
  • Envisioning Outlier Exposure by Large Language Models for Out-of-Distribution Detection cites Energy-based Out-of-distribution Detection
  • Envisioning Outlier Exposure by Large Language Models for Out-of-Distribution Detection cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Envisioning Outlier Exposure by Large Language Models for Out-of-Distribution Detection cites Learning Transferable Visual Models From Natural Language Supervision
  • AdaNeg: Adaptive Negative Proxy Guided OOD Detection with Vision-Language Models cites Energy-based Out-of-distribution Detection
  • AdaNeg: Adaptive Negative Proxy Guided OOD Detection with Vision-Language Models cites Learning Transferable Visual Models From Natural Language Supervision
  • AdaNeg: Adaptive Negative Proxy Guided OOD Detection with Vision-Language Models cites Out-of-Distribution Detection with Negative Prompts
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Learning Transferable Visual Models From Natural Language Supervision
  • Improving Context Understanding in Multimodal Large Language Models via Multimodal Composition Learning cites Learning Transferable Visual Models From Natural Language Supervision
  • Learning Transferable Visual Models From Natural Language Supervision cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Out-of-Distribution Detection with Negative Prompts cites Energy-based Out-of-distribution Detection
  • Out-of-Distribution Detection with Negative Prompts cites Learning Transferable Visual Models From Natural Language Supervision
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers57

  1. Improving Context Understanding in Multimodal Large Language Models via Multimodal Composition LearningWei Li, Hehe Fan, Yongkang Wong, Yi Yang et al.ICML 2024 · 49 citations
  2. Out-of-Distribution Detection with Negative PromptsJun Nie, Yonggang Zhang, Zhen Fang, Tongliang Liu et al.ICLR 2024 · 48 citations
  3. MultiOOD: Scaling Out-of-Distribution Detection for Multiple ModalitiesHao Dong, Yue Zhao, Eleni N. Chatzi, Olga FinkNeurIPS 2024 · 43 citations
  4. Envisioning Outlier Exposure by Large Language Models for Out-of-Distribution DetectionChentao Cao, Zhun Zhong, Zhanke Zhou, Yang Liu et al.ICML 2024 · 34 citations
  5. AdaNeg: Adaptive Negative Proxy Guided OOD Detection with Vision-Language ModelsYabin Zhang, Lei ZhangNeurIPS 2024 · 30 citations

Builds on16

  1. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  2. Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
  3. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  4. Energy-based Out-of-distribution DetectionWeitang Liu, Xiaoyun Wang, John D. Owens, Yixuan LiNeurIPS 2020 · 2,213 citations
  5. Conditional Prompt Learning for Vision-Language ModelsKaiyang Zhou, Jingkang Yang, Chen Change Loy, Ziwei LiuCVPR 2022 · 1,438 citations

Related papers

  1. Zero-Shot Out-of-Distribution Detection Based on the Pre-trained Model CLIPSepideh Esmaeilpour, Bing Liu, Eric Robertson, Lei ShuAAAI 2022 · 219 citations
  2. Adaptive Multi-prompt Contrastive Network for Few-shot Out-of-distribution DetectionXiang Fang, Arvind Easwaran, Blaise GenestICML 2025
  3. LoCoOp: Few-Shot Out-of-Distribution Detection via Prompt LearningAtsuyuki Miyai, Qing Yu, Go Irie, Kiyoharu AizawaNeurIPS 2023 · 174 citations
  4. Exploring the Limits of Out-of-Distribution DetectionStanislav Fort, Jie Ren, Balaji LakshminarayananNeurIPS 2021 · 443 citations
  5. ID-like Prompt Learning for Few-Shot Out-of-Distribution DetectionYichen Bai, Zongbo Han, Bing Cao, Xiaoheng Jiang et al.CVPR 2024
Dusk over the sea between two cliffs drawn in fine vertical lines