An officical implementation of "A Discrepancy Aware Framework for Robust Anomaly Detection"
Download the MVTecAD dataset from here.
Download the DAGM dataset from here.
In some experiments, we use the DTD dataset as the source of anomaly data.
First, Install PyTorch>= 1.11.0 and torchvision, and then install additional dependencies according to the requirements.txt. For instance,
pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
pip install -r requirements.txt
Before training, some custom parameters need to be configured. For example:
python train.py --root_path '/YourMVTecPath' --source_path '/YourDTDPath' --batch_size 8 --lr 2e-4 --defect_cls bottle
The checkpoints is avaliable at Google Drive
To evaluate the performance with checkpoints:
bash test_DAF.sh
- Update the complete code for training and evaluation
- Update the checkpoints
- ...
If you find this work helpful, please consider to cite our paper:
@ARTICLE{10272031,
author={Cai, Yuxuan and Liang, Dingkang and Luo, Dongliang and He, Xinwei and Yang, Xin and Bai, Xiang},
journal={IEEE Transactions on Industrial Informatics},
title={A Discrepancy Aware Framework for Robust Anomaly Detection},
year={2023},
volume={},
number={},
pages={1-10},
doi={10.1109/TII.2023.3318302}}