# Self-Tuning Self-Supervised Anomaly Detection

This is an anonymized code repository for *Self-Tuning Self-Supervised Anomaly
Detection* (submitted to ICLR 2024).

## Requirements

Our code is written by Python 3.8.12 and PyTorch 1.10.1. Please see
`requirements.txt` for the required packages.

## How to Run

The bash script `main.sh` contains a demo co
mmand to run our ST-SSAD on a
demonstrative example which contains only a part of the MVTecAD dataset. Various
options can be given to `train.py` to run the code for other scenarios. For
example, the initial augmentation hyperparameters can be given by the two
arguments `--init-scale 0.01` and `--init-angle 45`.

## Datasets

This repository contains **only a part of** the MVTecAD dataset in the `data`
directory just to check whether the code runs well. The full dataset needs to be
downloaded manually to reproduce our experiments:
- MVTecAD: https://www.mvtec.com/company/research/datasets/mvtec-ad

The SVHN dataset is downloaded automatically when the code is run with a
different option `--data svhn`. This requires changing other options as well,
e.g., `--augment rotate --obj-type 6 --ano-type 9`.
