Home

Awesome

Catching Both Gray and Black Swans: Open-set Supervised Anomaly Detection (CVPR2022)

By Choubo Ding, Guansong Pang, Chunhua Shen

Official PyTorch implementation of "Catching Both Gray and Black Swans: Open-set Supervised Anomaly Detection".

Prerequisites

This code is written in Python 3.7 and requires the packages listed in requirements.txt. Install with pip install -r requirements.txt preferably in a virtualenv.

Run

Step 1. Setup the Anomaly Detection Dataset

Download the Anomaly Detection Dataset and convert it to MVTec AD format. (For datasets we used in the paper, we provided the convert script.) The dataset folder structure should look like:

DATA_PATH/
    subset_1/
        train/
            good/
        test/
            good/
            defect_class_1/
            defect_class_2/
            defect_class_3/
            ...
    ...

Step 2. Running DRA

python train.py --dataset_root=./data/mvtec_anomaly_detection \
                --classname=carpet \
                --experiment_dir=./experiment

Citation

@inproceedings{ding2022catching,
      title={Catching Both Gray and Black Swans: Open-set Supervised Anomaly Detection}, 
      author={Ding, Choubo and Pang, Guansong and Shen, Chunhua},
      booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
      year={2022}
}