CVPR'23论文《WinCLIP: Zero-/few-shot anomaly classification and segmentation》的非官方实现(论文链接:https://openaccess.thecvf.com/content/CVPR2023/papers/Jeong_WinCLIP_Zero-Few-Shot_Anomaly_Classification_and_Segmentation_CVPR_2023_paper.pdf)。
单张 NVIDIA GeForce RTX 3090
下载异常检测数据集并将其转换为 MVTec AD 格式。(对于我们在论文中使用的数据集,我们提供了转换脚本)
数据集文件夹结构应如下所示:
DATA_PATH/
subset_1/
train/
good/
test/
good/
defect_class_1/
defect_class_2/
defect_class_3/
...
...修改 dataset_root_dir、datasetname、shot(位于 main.py)以及 OBJECT_TYPE(位于 mvtec_dataset.py)的值。 例如,若在 visa 的 candle 类别上以 k=2 运行:
dataset_root_dir = "/visa_anomaly_detection"
datasetname = "visa"
shot = 0
OBJECT_TYPE = ["candle"]并运行
python main.py本实现用于生成我们 CVPR'24 InCTRL 论文 中的 WinCLIP 结果。如果您觉得本实现对您的研究有帮助,我们希望您能通过引用 InCTRL 论文来表示认可:
@inproceedings{zhu2024toward,
title={Toward generalist anomaly detection via in-context residual learning with few-shot sample prompts},
author={Zhu, Jiawen and Pang, Guansong},
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
pages={17826--17836},
year={2024}
}