YoojLee / Uniformaly

Uniformaly: Towards Task-Agnostic Unified Anomaly Detection
Apache License 2.0
12 stars 1 forks source link

UniFormaly: Towards Task-Agnostic Unified Anomaly Detection

This repository contains the official PyTorch implementation of UniFormaly: Towards Task-Agnostic Unified Anomaly Detection.

overview_readme

0. Prepare Enviroments

Install Conda

wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
if [[ "$(md5sum **Anaconda3**-2020.07-Linux-x86_64.sh | cut -d' ' -f1)" == "1046c40a314ab2531e4c099741530ada" ]]; then echo "OK"; else echo "No"; fi
chmod +x Anaconda3-2020.07-Linux-x86_64.sh
./Anaconda3-2020.07-Linux-x86_64.sh
rm Anaconda3-2020.07-Linux-x86_64.sh

After installation, please close terminal and reopen it!

Create Conda Virtual Environment

conda env create -f uniformaly_env.yaml
conda activate uniformaly

1. Prepare Dataset

To download MVTecAD, excute the following:

bash prepare_dataset.sh

Following the file structure below and set your dataset path.

For Species-60, we provide details on 60 classes in our Appendix. If you would like to reproduce results for Species-60, please refer to our Appendix and prepare datasets as below.

YOUR_SPECIES60_PATH/
├── one_class_test
│   ├── abudefduf_vaigiensis
│   │   ├── 14683823.jpg
│   │   ├── 19987354.jpg
│   │   ├── ...
│   ├── acanthurus_coeruleus
│   ├── acarospora_socialis
│   ├── ...
│   └── zelus_renardii
└── one_class_train
    ├── abudefduf_vaigiensis
    │   ├── 10026878.jpeg
    │   ├── 10126060.jpg
    │   ├── ...
    ├── acanthurus_coeruleus
    │   ├── ...
    ├── ...
    └── zelus_renardii

We also used CIFAR-10/100, ImageNet-30, MTD, BTAD, and CPD datasets.

2. How to execute UniFormaly

Defect Detection

bash run_defect.sh

Semantic Anomaly Detection

For semantic anomaly detection, we provide scripts for each dataset.

Multi-class Anomaly Detection

For multi-class anomaly detection, we provide scripts for each dataset.

Anomaly Clustering

bash run_clustering.sh

3. Citation & Acknowledgements

Our repository is based on PatchCore.
Please consider citing them in your publications if they help your research.

@inproceedings{roth2022towards,
  title={Towards total recall in industrial anomaly detection},
  author={Roth, Karsten and Pemula, Latha and Zepeda, Joaquin and Sch{\"o}lkopf, Bernhard and Brox, Thomas and Gehler, Peter},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={14318--14328},
  year={2022}
}
@inproceedings{caron2021emerging,
  title={Emerging properties in self-supervised vision transformers},
  author={Caron, Mathilde and Touvron, Hugo and Misra, Ishan and J{\'e}gou, Herv{\'e} and Mairal, Julien and Bojanowski, Piotr and Joulin, Armand},
  booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
  pages={9650--9660},
  year={2021}
}
@article{zhou2021ibot,
  title={ibot: Image bert pre-training with online tokenizer},
  author={Zhou, Jinghao and Wei, Chen and Wang, Huiyu and Shen, Wei and Xie, Cihang and Yuille, Alan and Kong, Tao},
  journal={arXiv preprint arXiv:2111.07832},
  year={2021}
}