Official implementation of PromptAD: Learning Prompts with only Normal Samples for Few-Shot Anomaly Detection (CVPR2024)
conda create -n prompt_ad python==3.10
conda activate prompt_ad
bash install.sh
Download the dataset from MvTec.
Download the dataset from VisA.
Modify the source and target paths for the VisA dataset in ./dataset/prepare_visa_public.py
python ./dataset/prepare_visa_public.py
Modify the source paths for MvTec and VisA in ./dataset/mvtec.py
and ./dataset/visa.py
python run_cls.py # image-level
python run_seg.py # pixel-level
Please cite the following paper if this work helps your project:
@article{li2024promptad,
title={PromptAD: Learning Prompts with only Normal Samples for Few-Shot Anomaly Detection},
author={Li, Xiaofan and Zhang, Zhizhong and Tan, Xin and Chen, Chengwei and Qu, Yanyun and Xie, Yuan and Ma, Lizhuang},
journal={arXiv preprint arXiv:2404.05231},
year={2024}
}
We thank the great works WinCLIP and CoOp for assisting with our work.