arXiv:2504.11055cs.CV2025-04被引 7

提升零样本异常检测定位精度,尤其对微小异常更敏感。

Crane: Context-Guided Prompt Learning and Attention Refinement for Zero-Shot Anomaly Detection

  • 用上下文引导提示学习和注意力精修增强视觉-文本对齐
  • 图像级检测性能提升4.5%,像素级定位指标提高9.0%
  • 适用于工业缺陷检测,尤其关注细小异常场景

零样本异常检测与定位旨在仅使用源域数据学习,并泛化到无目标域样本的未知目标域。现有基于CLIP的方法通过比较视觉特征与正常/异常文本原型进行推理,但密集定位性能仍显著弱于图像级检测,尤其对小或细微异常区域。我们识别出两大关键局限:CLIP视觉编码器主要优化全局图文对齐,限制了细粒度空间细节保留;且学习到的正常/异常文本表示与密集视觉特征对齐不足。为此,提出Crane(上下文引导提示学习与注意力精修)框架:首先通过基于相关性的注意力模块适配视觉编码器,更好保留局部视觉结构;其次在训练中将可学习的正常/异常提示基于全局图像上下文进行条件化,提升实例感知的图文对齐;第三,引入异常感知的局部到全局融合机制,将异常相关的块特征注入全局图像表示,增强图像级检测敏感性。最后,证明同一相关性注意力设计也可用于DINOv2,得到性能更强的Crane+变体。在七个工业基准上,Crane相比最强基线图像级平均AP提升4.5%,Crane+像素级平均AUPRO提升9.0%。代码已公开于https://github.com/Alireza99Salehi/Crane。

原文摘要 · Abstract (English)

Zero-shot anomaly detection and localization aims to learn from source-domain data and generalize to unseen target domains without target-domain samples. Recent CLIP-based methods perform inference by comparing visual features with normal and abnormal textual prototypes; however, dense localization remains substantially weaker than image-level detection, especially for small or subtle abnormal regions. We identify two key limitations behind this gap: CLIP's vision encoder is primarily optimized for global image-text alignment, which limits its ability to preserve fine-grained spatial details, and the learned normal/abnormal text representations are not sufficiently aligned with dense visual features. To address these limitations, we propose Crane (Context-Guided Prompt Learning and Attention Refinement), a CLIP-based framework that first adapts the vision encoder with a correlation-based attention module to better preserve local visual structure. Second, it conditions learnable normal and abnormal prompts on global image context during training, improving instance-aware text-vision alignment. Third, it incorporates anomaly-aware local-to-global fusion, which injects anomaly-relevant patch features into the global image representation for more sensitive image-level detection. Finally, we show that the same correlation-based attention design can exploit spatial correlations from DINOv2, yielding a boosted variant, Crane+, with stronger localization ability. Across seven industrial benchmarks, Crane improves mean image-level AP by 4.5% over the strongest compared baseline, while Crane+ improves mean pixel-level AUPRO by 9.0%. The code is available at https://github.com/Alireza99Salehi/Crane.

异常检测零样本CLIP定位精度

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。