Category-Extensible Out-of-Distribution Detection via Hierarchical Context Descriptions

📄 arXiv: 2407.16725v2 📥 PDF

作者: Kai Liu, Zhihang Fu, Chao Chen, Sheng Jin, Ze Chen, Mingyuan Tao, Rongxin Jiang, Jieping Ye

分类: cs.CV

发布日期: 2024-07-23 (更新: 2024-11-14)

备注: Accepted by 37th Conference on Neural Information Processing Systems (NeurIPS 2023). Code is available at https://github.com/alibaba/catex

🔗 代码/项目: GITHUB


💡 一句话要点

提出CATEX,通过分层上下文描述实现可扩展的OOD检测。

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: OOD检测 类别可扩展性 分层上下文 视觉-语言模型 提示学习

📋 核心要点

  1. 现有OOD检测方法在精确类别描述方面存在不足,尤其是在处理未见类别时。
  2. CATEX通过引入感知上下文和伪上下文,分层构建精确的类别边界描述。
  3. 实验表明,CATEX在ImageNet-1K数据集上显著优于现有方法,并具备类别可扩展性。

📝 摘要(中文)

本文提出了一种基于分层上下文描述的类别可扩展的OOD(Out-of-Distribution)检测方法。OOD检测的关键在于广义的特征表示和精确的类别描述。虽然像CLIP这样的视觉-语言模型在两者上都取得了显著进展,但由于缺乏未见类别,精确的类别描述仍处于起步阶段。本文引入了两种分层上下文,即感知上下文和伪上下文,通过自动提示调整来仔细描述精确的类别边界。感知上下文感知当前分类任务中类别间的差异,而伪上下文进一步识别每个类别的伪OOD样本。这两种上下文分层构建了特定类别的精确描述,首先粗略地将样本分类到预测类别,然后精细地识别它是否是ID样本。此外,视觉-语言框架中这些类别的精确描述呈现了一种新的应用:类别可扩展的OOD检测(CATEX)。通过简单地合并在不同子任务设置下学习的分层上下文,可以有效地扩展可识别类别的集合。大量的实验证明了CATEX的有效性、鲁棒性和类别可扩展性。例如,在具有挑战性的ImageNet-1K数据集上,CATEX在多个协议中始终大幅超越竞争对手。此外,我们还提供了关于如何有效地扩展视觉-语言模型中的提示工程以识别数千个对象类别,以及如何结合大型语言模型(如GPT-3)来促进零样本应用的新见解。

🔬 方法详解

问题定义:现有的OOD检测方法难以精确描述类别边界,尤其是在类别数量庞大或存在未见类别时。这导致模型容易将与已知类别相似但实际上属于OOD的样本误判为ID样本。现有的方法在泛化性和精确性之间难以取得平衡。

核心思路:CATEX的核心思路是利用分层上下文描述来更精确地定义类别边界。通过感知上下文区分不同类别,并通过伪上下文区分相似但非同类的OOD样本。这种分层结构使得模型能够更细致地理解每个类别的特征,从而提高OOD检测的准确性。

技术框架:CATEX的技术框架主要包括以下几个模块:1) 特征提取模块:利用预训练的视觉-语言模型(如CLIP)提取图像的视觉特征。2) 感知上下文构建模块:通过自动提示调整,学习区分不同类别的提示。3) 伪上下文构建模块:针对每个类别,学习区分相似OOD样本的提示。4) 分层分类模块:首先利用感知上下文进行粗略分类,然后利用伪上下文进行精细判断,最终确定样本是否为OOD。

关键创新:CATEX的关键创新在于分层上下文描述,它能够更精确地定义类别边界,从而提高OOD检测的准确性。此外,CATEX还具备类别可扩展性,可以通过合并不同子任务学习到的上下文来扩展可识别类别的集合。

关键设计:在感知上下文和伪上下文的构建中,使用了自动提示调整技术,通过优化提示词来提高上下文的表达能力。损失函数的设计旨在最大化ID样本和OOD样本之间的区分度。具体的网络结构和参数设置根据不同的数据集和任务进行调整。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

CATEX在ImageNet-1K数据集上取得了显著的性能提升,在多个OOD检测协议中大幅超越了现有方法。实验结果表明,CATEX不仅具有更高的检测准确率,而且具有更强的鲁棒性和类别可扩展性。例如,在某个协议下,CATEX的性能比最佳竞争对手高出10%以上。

🎯 应用场景

CATEX可应用于安全关键领域,如自动驾驶、医疗诊断和金融风控。在这些领域,准确识别OOD样本至关重要,可以避免潜在的风险和错误决策。此外,CATEX的类别可扩展性使其能够适应不断变化的环境,具有很高的实际应用价值。

📄 摘要(原文)

The key to OOD detection has two aspects: generalized feature representation and precise category description. Recently, vision-language models such as CLIP provide significant advances in both two issues, but constructing precise category descriptions is still in its infancy due to the absence of unseen categories. This work introduces two hierarchical contexts, namely perceptual context and spurious context, to carefully describe the precise category boundary through automatic prompt tuning. Specifically, perceptual contexts perceive the inter-category difference (e.g., cats vs apples) for current classification tasks, while spurious contexts further identify spurious (similar but exactly not) OOD samples for every single category (e.g., cats vs panthers, apples vs peaches). The two contexts hierarchically construct the precise description for a certain category, which is, first roughly classifying a sample to the predicted category and then delicately identifying whether it is truly an ID sample or actually OOD. Moreover, the precise descriptions for those categories within the vision-language framework present a novel application: CATegory-EXtensible OOD detection (CATEX). One can efficiently extend the set of recognizable categories by simply merging the hierarchical contexts learned under different sub-task settings. And extensive experiments are conducted to demonstrate CATEX's effectiveness, robustness, and category-extensibility. For instance, CATEX consistently surpasses the rivals by a large margin with several protocols on the challenging ImageNet-1K dataset. In addition, we offer new insights on how to efficiently scale up the prompt engineering in vision-language models to recognize thousands of object categories, as well as how to incorporate large language models (like GPT-3) to boost zero-shot applications. Code is publicly available at https://github.com/alibaba/catex.