This is an official code repository for DSV: An Alignment Validation Loss for Self-supervised Outlier Model Selection, which will be presented in ECML PKDD 2023. This repository is partially based on https://github.com/Runinho/pytorch-cutpaste.
Python 3.8.12 is recommended. Please see requirements.txt for the required
packages.
You should first download the datasets to run our code. Change the DATA_PATH
variable in utils.py based on the location of your datasets.
- MVTec AD: https://www.mvtec.com/company/research/datasets/mvtec-ad
- MPDD: https://github.com/stepanje/MPDD
Run train.py to train anomaly detector models. The default configuration in
the file, including model hyperparameters, are set to those used in the paper.
The parameters of models, learned embeddings, and anomaly scores are stored as a
result of training. You can test the training script by typing the following
command:
cd ../src
python train.py \
--type bottle \
--gpu 0 \
--epochs 100 \
--test-epochs 100 \
--augment cutdiff \
--patch-size 0.05 0.10 \
--patch-aspect 0.3 0.5 \
--patch-angle 30 \
--out ../out
Run eval.py to select the model based on the values of validation losses. It
also generates useful figures on embeddings and anomaly scores.
Please cite our paper if you utilize our code in your research:
@misc{yoo2023dsv,
title={DSV: An Alignment Validation Loss for Self-supervised Outlier Model Selection},
author={Jaemin Yoo and Yue Zhao and Lingxiao Zhao and Leman Akoglu},
year={2023},
eprint={2307.06534},
archivePrefix={arXiv},
primaryClass={cs.LG}
}