zhiyuanyou / UniAD

[NeurIPS 2022 Spotlight] A Unified Model for Multi-class Anomaly Detection
Apache License 2.0
250 stars 28 forks source link

UniAD

Official PyTorch Implementation of A Unified Model for Multi-class Anomaly Detection, Accepted by NeurIPS 2022 Spotlight.

Image text Image text

1. Quick Start

1.1 MVTec-AD

|-- data
    |-- MVTec-AD
        |-- mvtec_anomaly_detection
        |-- json_vis_decoder
        |-- train.json
        |-- test.json
Platform GPU Detection AUROC Localization AUROC Checkpoints Note
slurm group 8 GPUs (NVIDIA Tesla V100 16GB) 96.7 96.8 here A unified model for all categories
torch.distributed.launch 1 GPU (NVIDIA GeForce GTX 1080 Ti 11 GB) 97.6 97.0 here A unified model for all categories

1.2 CIFAR-10

|-- data
    |-- CIFAR-10
        |-- cifar-10-batches-py
Normal Samples {01234} {56789} {02468} {13579} Mean
AUROC 84.4 79.6 93.0 89.1 86.5

2. Visualize Reconstructed Features

We highly recommend to visualize reconstructed features, since this could directly prove that our UniAD reconstructs anomalies to their corresponding normal samples.

2.1 Train Decoders for Visualization

2.2 Visualize Reconstructed Features

3. Questions

3.1 Explanation of Evaluation Results

The first line of the evaluation results are shown as follows.

clsname pixel mean max std

The pixel means anomaly localization results.

The mean, max, and std mean post-processing methods for anomaly detection. That is to say, the anomaly localization result is an anomaly map with the shape of H x W. We need to convert this map to a scalar as the anomaly score for this whole image. For this convert, you have 3 options:

In our paper, we use max for MVTec-AD and mean for CIFAR-10.

3.2 Visualize Learned Query Embedding

If you have finished the training of the main model and decoders (used for visualization) for MVTec-AD, you could also choose to visualize the learned query embedding in the main model.

Some results are very interesting. The learned query embedding partly contains some features of normal samples. However, we did not fully figure out this and this part was not included in our paper.

Image text Image text

Acknowledgement

We use some codes from repositories including detr and efficientnet.