Home

Awesome

DAF

An officical implementation of "A Discrepancy Aware Framework for Robust Anomaly Detection"

image

Datasets

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.

Install

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

Training

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

Evaluate

The checkpoints is avaliable at Google Drive

To evaluate the performance with checkpoints:

bash test_DAF.sh

TODO List

Citation

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}}