Self-Tuning Self-Supervised Image Anomaly Detection

July 21, 2025 ยท View on GitHub

This project is an official implementation of Self-Tuning Self-Supervised Image Anomaly Detection by Jaemin Yoo, Lingxiao Zhao, and Leman Akoglu (KDD 2025).

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 command to run our framework 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:

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.