DriftAD: Visually-Guided Text Drift for Few-Shot Industrial Anomaly Detection

DriftAD: Visually-Guided Text Drift for Few-Shot Industrial Anomaly Detection

DriftAD:用于少样本工业异常检测的视觉引导文本漂移方法

Abstract: Few-shot anomaly detection (FSAD) has recently benefited from vision-language models such as CLIP, which enable anomaly detection by aligning visual features with text descriptions of normal and abnormal states. However, existing methods typically rely on static text prompts that are applied uniformly across the entire feature hierarchy and spatial dimensions. This rigid global-to-local matching fails to capture the highly localized and scale-dependent physical variations of industrial defects.

摘要: 少样本异常检测(FSAD)近期受益于 CLIP 等视觉-语言模型,这些模型通过将视觉特征与正常及异常状态的文本描述对齐来实现异常检测。然而,现有方法通常依赖于静态文本提示,并将其统一应用于整个特征层级和空间维度。这种僵化的全局到局部匹配方式,难以捕捉工业缺陷中高度局部化且具有尺度依赖性的物理变化。

To address this, we propose DriftAD, a FSAD framework built on three key modules. First, an Anomaly Signal Amplification (ASA) module enhances subtle defect signals through spatial and frequency branches before text-visual matching. Second, Visually-Guided Text Drift (VGTD) dynamically transforms frozen CLIP text embeddings, steering them into layer-wise, spatially-adaptive anomaly descriptors conditioned on local visual context at each encoder depth.

为了解决这一问题,我们提出了 DriftAD,这是一个基于三个关键模块构建的 FSAD 框架。首先,异常信号放大(ASA)模块在进行文本-视觉匹配之前,通过空间和频率分支增强细微的缺陷信号。其次,视觉引导文本漂移(VGTD)模块动态转换冻结的 CLIP 文本嵌入,根据编码器各深度的局部视觉上下文,将其引导为分层且具有空间自适应性的异常描述符。

Third, Drift-Guided Spatial Gating (DGSG) uses the drifted abnormal descriptor as a spatial probe to selectively enhance anomaly-relevant visual features. Additionally, a drift separation loss prevents representational collapse of the drifted descriptors, and a gate supervision loss enforces spatially discriminative gating in DGSG. Extensive experiments on MVTec-AD and VisA demonstrate state-of-the-art performance across all 1-, 2-, and 4-shot settings on both image-level and pixel-level metrics. Code is available at this https URL.

第三,漂移引导空间门控(DGSG)利用漂移后的异常描述符作为空间探针,有选择地增强与异常相关的视觉特征。此外,漂移分离损失防止了漂移描述符的表征坍缩,而门控监督损失则在 DGSG 中强制执行空间判别式门控。在 MVTec-AD 和 VisA 数据集上的大量实验表明,该方法在 1-shot、2-shot 和 4-shot 设置下,在图像级和像素级指标上均达到了最先进的性能。代码可在该链接获取。