Local Ai

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

arXiv:2504.11055v3 Announce Type: replace Abstract: Zero-shot anomaly detection and localization aims to learn from source-domain data and generalize to unseen target domains without target-domain sam

DGX agentpaper
local-aiarxiv-cs-cv

arXiv:2504.11055v3 Announce Type: replace Abstract: 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.

Related

Source: arXiv cs.CV | 2026-08-24

Loading related sources…