# 零样本异常检测

零样本异常检测（zero-shot anomaly detection, ZSAD）是一种机器学习方法，无需在目标域的有标注样本上训练，而是利用预训练模型或辅助数据集中的知识，来检测并定位目标域中的异常。在基于图像的零样本异常检测中，模型通常输出图像级异常分数和像素级异常图，数值越大表示内容越异常；特定方法还可能将这些数值归一化到 [0, 1] 区间。<sup>[1](https://openaccess.thecvf.com/content/ICCV2025/papers/Zhu_Fine-grained_Abnormality_Prompt_Learning_for_Zero-shot_Anomaly_Detection_ICCV_2025_paper.pdf)</sup> 相关工作涵盖工业缺陷图像、医学影像、<sup>[2](https://doi.org/10.48550/arxiv.2310.18961)</sup> 三维点云、<sup>[3](https://papers.nips.cc/paper_files/paper/2024/file/9a263e235f6d1521d13a8531c7974951-Paper-Conference.pdf)</sup> 视频<sup>[4](https://proceedings.neurips.cc/paper_files/paper/2025/file/2aa95cf3b6aefa84d6b001928b107b4e-Paper-Conference.pdf)</sup> 以及表格数据。<sup>[5](https://arxiv.org/pdf/2302.07849v4.pdf)</sup>

| 关键事实 | 数值 |
|---|---|
| 输出 | 图像级异常分数加像素级异常图，数值越大表示内容越异常；部分方法将这些数值归一化到 [0, 1]<sup>[1](https://openaccess.thecvf.com/content/ICCV2025/papers/Zhu_Fine-grained_Abnormality_Prompt_Learning_for_Zero-shot_Anomaly_Detection_ICCV_2025_paper.pdf)</sup> |
| 利用的先验知识 | CLIP，一种在 4 亿对图像-文本上训练的对比视觉-语言模型<sup>[6](https://arxiv.org/pdf/2109.02748v1)</sup> |
| WinCLIP，零样本 MVTec-AD | 分类 AUROC 91.8%，分割 AUROC 85.1%；加入一个正常样本后为 93.1%/95.2%<sup>[7](https://doi.org/10.48550/arxiv.2303.14814)</sup> |
| MuSc，零样本 MVTec-AD | 图像 AUROC 97.8%，像素 AUROC 97.3%，不使用提示或训练<sup>[8](https://arxiv.org/pdf/2401.16753v1)</sup> |
| AnomalyDINO，单样本 MVTec-AD | AUROC 96.6%，免训练，较 WinCLIP+ 的 93.1% 有所提升<sup>[9](https://openaccess.thecvf.com/content/WACV2025/papers/Damm_AnomalyDINO_Boosting_Patch-Based_Few-Shot_Anomaly_Detection_with_DINOv2_WACV_2025_paper.pdf)</sup> |
| 已知的医学领域失败案例 | 所有受评估的基于 CLIP 的零样本异常检测模型在 BraTS 脑肿瘤分割上的 Dice 分数均低于 50%<sup>[10](https://arxiv.org/pdf/2411.09310)</sup> |

## 工作原理

先验知识来自大型预训练模型。CLIP 是一种多模态图像与文本 Transformer，通过在 4 亿对互联网图像-文本上进行对比学习训练而成，因此图像特征与文本特征可以通过余弦相似度进行比较，无需任务特定的训练。<sup>[6](https://arxiv.org/pdf/2109.02748v1)</sup> 零样本异常检测方法将测试图像与正常性和异常性的文本概念或参考概念进行打分比对。

朴素提示之所以失效，是因为 CLIP 的预训练对齐的是物体类别语义，而非异常语义；诸如“一张[类别]的照片”或“损坏的[类别]”之类的模板无法将正常样本与缺陷样本区分开来，这正是需要在辅助异常检测数据上调优可学习提示的原因。<sup>[2](https://doi.org/10.48550/arxiv.2310.18961)</sup> 第二种错位是架构层面的：预训练期间只有 CLIP 的类别 token 受到语言信号的监督，用于分割的图像特征图则缺乏文本对齐。<sup>[11](https://doi.org/10.48550/arxiv.2311.00453)</sup>

## 实现方式

实践者的流程如下。首先，选择预训练骨干网络；WinCLIP 使用 LAION-400M CLIP 搭配 ViT-B/16+ 编码器。<sup>[7](https://doi.org/10.48550/arxiv.2303.14814)</sup> 其次，设计提示：WinCLIP 的组合式提示集成（Compositional Prompt Ensemble）枚举状态词（如完好与损坏）与模板（如用于视觉检测的“一张[c]的照片”）的所有组合，采用正常[o]与异常[o]的两类设计。<sup>[7](https://doi.org/10.48550/arxiv.2303.14814)</sup> 后续方法用词典定义、<sup>[12](https://openaccess.thecvf.com/content/WACV2024/papers/Li_PromptAD_Zero-Shot_Anomaly_Detection_Using_Text_Prompts_WACV_2024_paper.pdf)</sup> 大语言模型生成的描述<sup>[13](https://arxiv.org/pdf/2409.00556)</sup> 或可学习嵌入<sup>[2](https://doi.org/10.48550/arxiv.2310.18961)</sup> 替代手工提示。第三，计算异常图，通常基于块级视觉特征与正常/异常文本嵌入之间的余弦相似度。<sup>[14](https://doi.org/10.48550/arxiv.2411.06071)</sup> 第四，将块级分数聚合为图像分数并设定阈值。在少样本设置中，少量正常图像的块特征被存入记忆库，通过余弦相似度检索，再与语言引导的预测融合。<sup>[7](https://doi.org/10.48550/arxiv.2303.14814)</sup>

## 起源

这一脉络始于通过多模态表示学习实现的零样本分类。塞皮德·埃斯梅尔普尔及其同事提出的 ZO-CLIP（2021 年，arXiv）将 CLIP 扩展到零样本开放集检测，无需已见类别的训练数据。<sup>[6](https://arxiv.org/pdf/2109.02748v1)</sup> 早期基于 CLIP 的异常检测研究，包括 ZOC 以及 陈旭海及其同事的 CLIP-AD 论文（2023 年，arXiv），主要关注异常分类。<sup>[2](https://doi.org/10.48550/arxiv.2310.18961)</sup>

郑钟宪及其同事的 WinCLIP 论文（2023 年，arXiv）提出了基于窗口的 CLIP，用于零样本和少正常样本的异常分类与分割；AnomalyCLIP 的作者将其誉为“零样本异常检测方向的开创性工作”。<sup>[2](https://doi.org/10.48550/arxiv.2310.18961)</sup> 陈、韩和张的 APRIL-GAN（2023 年，腾讯优图实验室）在 WinCLIP 语言引导框架的基础上，获得 CVPR 2023 VAND 挑战赛零样本赛道第一名。<sup>[15](https://ar5iv.labs.arxiv.org/html/2305.17382)</sup>

## 变体

各命名方法的主要差异在于获取正常/异常语义的方式。WinCLIP 依赖手工窗口提示和多次前向传播。<sup>[7](https://doi.org/10.48550/arxiv.2303.14814)</sup> APRIL-GAN 增加线性投影层，将 CLIP 图像特征映射到联合嵌入空间以进行分割。<sup>[15](https://ar5iv.labs.arxiv.org/html/2305.17382)</sup> AnomalyCLIP 学习两个与物体无关的文本提示，捕捉与前景物体无关的通用正常性和异常性，单次前向传播即可获得分割结果。<sup>[2](https://doi.org/10.48550/arxiv.2310.18961)</sup> AdaCLIP 将跨图像共享的静态提示与每张测试图像生成的动态提示相结合。<sup>[16](https://doi.org/10.48550/arxiv.2407.15795)</sup> FAPrompt 利用每张测试图像最异常块的数据相关先验，学习复合的、分解的异常提示。<sup>[1](https://openaccess.thecvf.com/content/ICCV2025/papers/Zhu_Fine-grained_Abnormality_Prompt_Learning_for_Zero-shot_Anomaly_Detection_ICCV_2025_paper.pdf)</sup> FiLo++ 融合大语言模型生成的细粒度描述与基于 [Grounding DINO](https://www.edgepedia.org/zh/grounding-dino) 的可变形定位。<sup>[17](https://doi.org/10.48550/arxiv.2501.10067)</sup> AA-CLIP 训练异常感知文本锚点，通过解缠损失（Disentangle Loss）强制正常锚点与异常锚点正交。<sup>[18](https://doi.org/10.48550/arxiv.2503.06661)</sup> AFR-CLIP 用图像引导的校正提示嵌入之间的文本对文本相似度替代图像-文本余弦相似度。<sup>[19](https://doi.org/10.48550/arxiv.2503.12910)</sup> PA-CLIP 增加双记忆库，将背景变化模式与真实缺陷特征解耦。<sup>[20](https://doi.org/10.48550/arxiv.2503.01292)</sup>

自 2023 年末以来，提示工程逐渐让位于可学习、免训练和大语言模型辅助的设计。FADE 使用 ChatGPT 3.5 自动生成异常描述，在零样本设置下达到 89.6%（MVTec-AD）和 91.5%（VisA）的像素 AUROC，加入一个正常样本后升至 95.4% 和 97.5%。<sup>[13](https://arxiv.org/pdf/2409.00556)</sup> 一条免训练流水线结合 GPT-3 提示、Grounding DINO 物体定位和 CLIP 匹配，在 MVTec-AD 上达到 93.2% AUROC。<sup>[21](https://arxiv.org/pdf/2411.19220)</sup> 无语言和基于 DINOv2 的方法相继出现：VisualAD 完全移除文本编码器，优化两个可学习向量，可训练参数减少 99% 以上而性能损失可忽略，<sup>[22](https://openaccess.thecvf.com/content/CVPR2026/papers/Hou_VisualAD_Language-Free_Zero-Shot_Anomaly_Detection_via_Vision_Transformer_CVPR_2026_paper.pdf)</sup> AD-DINOv3 通过异常感知校准适配 DINOv3。<sup>[23](https://doi.org/10.1109/icassp55912.2026.11464463)</sup> 免训练的纯视觉方案包括 MuSc，它不需要提示或训练，而是对无标签测试图像进行互相打分——正常块在其他图像中能找到许多相似块，而异常块则很少，<sup>[8](https://arxiv.org/pdf/2401.16753v1)</sup> 以及 AnomalyDINO，它通过测试块与 DINOv2 正常特征记忆库的最近邻距离进行打分。<sup>[9](https://openaccess.thecvf.com/content/WACV2025/papers/Damm_AnomalyDINO_Boosting_Patch-Based_Few-Shot_Anomaly_Detection_with_DINOv2_WACV_2025_paper.pdf)</sup>

## 应用

在医学影像中，FiLo++ 在单样本设置下于 BrainMRI 上达到 86.6% 的图像级 AUC。<sup>[17](https://doi.org/10.48550/arxiv.2501.10067)</sup> 多模态大语言模型带来了带推理的检测：Anomaly-OV 引入了 Anomaly-Instruct-125k 指令数据集和经人工审核的 VisA-D&R 基准，<sup>[24](https://arxiv.org/html/2502.07601v2)</sup> AnomalyAgent 是一个免训练的智能体框架，较最强的免训练基线提升最多 2.7% AUROC。<sup>[25](https://doi.org/10.48550/arxiv.2605.30140)</sup> 在视频领域，一个基于冻结视觉语言模型和多模态大语言模型的链式测试时推理框架在 UCF-Crime、XD-Violence、UBnormal 和 MSAD 上取得了最先进的零样本结果。<sup>[4](https://proceedings.neurips.cc/paper_files/paper/2025/file/2aa95cf3b6aefa84d6b001928b107b4e-Paper-Conference.pdf)</sup> PointAD 将该任务扩展到三维点云，将 MVTec3D-AD 的 I-AUROC 从 CLIP 加渲染的 61.2% 提升至 82.0%。<sup>[3](https://papers.nips.cc/paper_files/paper/2024/file/9a263e235f6d1521d13a8531c7974951-Paper-Conference.pdf)</sup>

## 局限与替代方案

已记录的失败模式包括以下方面。域差距：与任何零样本异常检测方法一样，AdaCLIP 在测试数据显著偏离辅助训练数据时可能失败。<sup>[16](https://doi.org/10.48550/arxiv.2407.15795)</sup> 提示语义粗糙：诸如“损坏”或“缺陷”之类的提示会遗漏细微偏差，例如地毯纹理上的色斑，手工提示方法在其未见域（如 BTAD、MPDD、BrainMRI）的异常上表现不佳。<sup>[1](https://openaccess.thecvf.com/content/ICCV2025/papers/Zhu_Fine-grained_Abnormality_Prompt_Learning_for_Zero-shot_Anomaly_Detection_ICCV_2025_paper.pdf)</sup> 状态词不敏感：AFR-CLIP 报告称，图像与“一张正常/异常螺丝的照片”等提示的图文相似度几乎无法区分，通常集中在 0.5 左右。<sup>[19](https://doi.org/10.48550/arxiv.2503.12910)</sup> 环境误报：光照变化和视角变换会导致虚假检测，PA-CLIP 的记忆库可减轻这一问题。<sup>[20](https://doi.org/10.48550/arxiv.2503.01292)</sup> 非自然图像：CLIP 在 MNIST 数字等数据上表现不佳，推测是因为它在自然互联网图像上训练。<sup>[5](https://arxiv.org/pdf/2302.07849v4.pdf)</sup> 医学分割：在 BraTS 脑肿瘤上，所有受评估的基于 CLIP 的模型即使使用医学预训练的 PMC-CLIP，Dice 分数也低于 50%，这些作者认为鉴于异常体素稀疏，应优先使用 Dice 而非 AUROC。<sup>[10](https://arxiv.org/pdf/2411.09310)</sup> 通用多模态大语言模型的召回率远低于精确率，表明对视觉异常不敏感。<sup>[24](https://arxiv.org/html/2502.07601v2)</sup>

主要替代方案是域内单类方法。PatchCore 及相关方法从预训练分类器中提取块特征，将测试块与正常特征记忆库进行打分比对，这种最近邻范式至少可追溯至 2002 年。<sup>[9](https://openaccess.thecvf.com/content/WACV2025/papers/Damm_AnomalyDINO_Boosting_Patch-Based_Few-Shot_Anomaly_Detection_with_DINOv2_WACV_2025_paper.pdf)</sup> WinCLIP+ 在单样本 MVTec-AD 上超越 PatchCore 9.7%，在单样本 VisA 上超越 5.3%。<sup>[7](https://doi.org/10.48550/arxiv.2303.14814)</sup> 对于表格数据，ACR 不依赖专门用于零样本异常检测的基础模型，而是将批归一化与元训练相结合，将正常多数样本拉向批中心，使异常样本落在更远处，并报告了表格数据的首个零样本异常检测结果。<sup>[5](https://arxiv.org/pdf/2302.07849v4.pdf)</sup>

## References

1. [Fine-grained Abnormality Prompt Learning for Zero-shot Anomaly Detection (FAPrompt, ICCV 2025)](https://openaccess.thecvf.com/content/ICCV2025/papers/Zhu_Fine-grained_Abnormality_Prompt_Learning_for_Zero-shot_Anomaly_Detection_ICCV_2025_paper.pdf)
2. [Zhou, Qihang and colleagues (2023). AnomalyCLIP: Object-agnostic Prompt Learning for Zero-shot Anomaly Detection. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2310.18961)
3. [PointAD: Comprehending 3D Anomalies from Points and Pixels for Zero-shot 3D Anomaly Detection (NeurIPS 2024)](https://papers.nips.cc/paper_files/paper/2024/file/9a263e235f6d1521d13a8531c7974951-Paper-Conference.pdf)
4. [A Unified Reasoning Framework for Holistic Zero-Shot Video Anomaly Analysis (NeurIPS 2025)](https://proceedings.neurips.cc/paper_files/paper/2025/file/2aa95cf3b6aefa84d6b001928b107b4e-Paper-Conference.pdf)
5. [Zero-Shot Anomaly Detection via Batch Normalization (ACR)](https://arxiv.org/pdf/2302.07849v4.pdf)
6. [Zero-Shot Open Set Detection by Extending CLIP (ZO-CLIP)](https://arxiv.org/pdf/2109.02748v1)
7. [Jeong, Jongheon and colleagues (2023). WinCLIP: Zero-/Few-Shot Anomaly Classification and Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2303.14814)
8. [MuSc: Zero-Shot Industrial Anomaly Classification and Segmentation with Mutual Scoring of Unlabeled Images](https://arxiv.org/pdf/2401.16753v1)
9. [AnomalyDINO: Boosting Patch-Based Few-Shot Anomaly Detection with DINOv2 (WACV 2025)](https://openaccess.thecvf.com/content/WACV2025/papers/Damm_AnomalyDINO_Boosting_Patch-Based_Few-Shot_Anomaly_Detection_with_DINOv2_WACV_2025_paper.pdf)
10. [Evaluating CLIP-based models for zero-shot anomaly detection in medical imaging (BraTS)](https://arxiv.org/pdf/2411.09310)
11. [Chen, Xuhai and colleagues (2023). CLIP-AD: A Language-Guided Staged Dual-Path Model for Zero-shot Anomaly Detection. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2311.00453)
12. [PromptAD: Zero-Shot Anomaly Detection Using Text Prompts (WACV 2024)](https://openaccess.thecvf.com/content/WACV2024/papers/Li_PromptAD_Zero-Shot_Anomaly_Detection_Using_Text_Prompts_WACV_2024_paper.pdf)
13. [FADE: Few-shot/zero-shot Anomaly Detection Engine (BMVC 2024)](https://arxiv.org/pdf/2409.00556)
14. [Ham, Jiyul, Jung, Yonggon, Baek, Jun-Geol (2024). GlocalCLIP: Object-agnostic Global-Local Prompt Learning for Zero-shot Anomaly Detection. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2411.06071)
15. [APRIL-GAN: A Zero-/Few-Shot Anomaly Classification and Segmentation Method for CVPR 2023 VAND Workshop Challenge](https://ar5iv.labs.arxiv.org/html/2305.17382)
16. [Cao, Yunkang and colleagues (2024). AdaCLIP: Adapting CLIP with Hybrid Learnable Prompts for Zero-Shot Anomaly Detection. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2407.15795)
17. [Gu, Zhaopeng and colleagues (2025). FiLo++: Zero-/Few-Shot Anomaly Detection by Fused Fine-Grained Descriptions and Deformable Localization. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2501.10067)
18. [Ma, Wenxin and colleagues (2025). AA-CLIP: Enhancing Zero-shot Anomaly Detection via Anomaly-Aware CLIP. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2503.06661)
19. [Yuan, Jingyi and colleagues (2025). AFR-CLIP: Enhancing Zero-Shot Industrial Anomaly Detection with Stateless-to-Stateful Anomaly Feature Rectification. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2503.12910)
20. [Pan, Yurui and colleagues (2025). PA-CLIP: Enhancing Zero-Shot Anomaly Detection through Pseudo-Anomaly Awareness. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2503.01292)
21. [Zero-shot training-free industrial image anomaly detection via a multimodal pipeline (GPT-3 + Grounding DINO + CLIP)](https://arxiv.org/pdf/2411.19220)
22. [VisualAD: Language-Free Zero-Shot Anomaly Detection via Vision Transformer (CVPR 2026)](https://openaccess.thecvf.com/content/CVPR2026/papers/Hou_VisualAD_Language-Free_Zero-Shot_Anomaly_Detection_via_Vision_Transformer_CVPR_2026_paper.pdf)
23. [AD-DINOv3: Enhancing DINOv3 for Zero-Shot Anomaly Detection with Anomaly-Aware Calibration (ICASSP 2026)](https://doi.org/10.1109/icassp55912.2026.11464463)
24. [Towards Zero-Shot Anomaly Detection and Reasoning with Multimodal Large Language Models (Anomaly-OV)](https://arxiv.org/html/2502.07601v2)
25. [Zhang, Yi and colleagues (2026). AnomalyAgent: Training-Free Agentic Models for Zero-/Few-Shot Anomaly Detection. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2605.30140)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › 机器学习与神经计算 › 机器学习方法 › 监督、无监督与半监督学习 › 异常与新颖性检测

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/zero-shot-anomaly-detection

English original: https://www.edgepedia.org/zero-shot-anomaly-detection
