chinchia / Defect-Detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-Scale Patch-Based Representation Learning for Image Anomaly Detection and Segmentation (paper link, published in WACV 2022)

Authors - Chin-Chia Tsai, Tsung-Hsuan Wu, Shang-Hong Lai

image

Abstract - Unsupervised representation learning has been proven to be effective for the challenging anomaly detection and segmentation tasks. In this paper, we propose a multi-scale patch-based representation learning method to extract critical and representative information from normal images. By taking the relative feature similarity between patches of different local distances into account, we can achieve better representation learning. Moreover, we propose a refined way to improve the self-supervised learning strategy, thus allowing our model to learn better geometric relationship between neighboring patches. Through sliding patches of different scales all over an image, our model extracts representative features from each patch and compares them with those in the training set of normal images to detect the anomalous regions. Our experimental results on MVTec AD dataset and BTAD dataset demonstrate the proposed method achieves the state-of-the-art accuracy for both anomaly detection and segmentation.

Framework

The framework is inspired from PatchSVDD.

image

Dataset

MVTec AD dataset
BTAD dataset

Usage

Step 1. Change the DATASET_PATH variable.

Set the DATASET_PATH to the root path of MVTec AD dataset.

Step 2. Training.

python main_train.py --obj=bottle --lr=1e-5 --lambda_value=1e-3 --D=64

obj denotes the name of the class in MVTec AD dataset.
lambda_value denotes the value of 'lambda' in Eq. 5 of the paper.
D denotes the number of embedding dimension.
lr denotes the learning rate of Adam optimizer.
groups_64 denotes the groups of the cluster for patch size 64.
groups_32 denotes the groups of the cluster for patch size 32.
groups_16 denotes the groups of the cluster for patch size 16.

Step 3. Testing and get anomaly maps.

python main_visualize.py --obj=bottle

obj denotes the name of the class in MVTec AD dataset.

Qualitative Results

image

Experiments Results

image

Citation

Chin-Chia Tsai, Tsung-Hsuan Wu, and Shang-Hong Lai, "Multi-Scale Patch-Based Representation Learning for Image Anomaly Detection and Segmentation," 2022 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), 2022, pp. 3065-3073, doi: 10.1109/WACV51458.2022.00312.

BibTex

@InProceedings{Tsai_2022_WACV,
    author    = {Tsai, Chin-Chia and Wu, Tsung-Hsuan and Lai, Shang-Hong},
    title     = {Multi-Scale Patch-Based Representation Learning for Image Anomaly Detection and Segmentation},
    booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
    month     = {January},
    year      = {2022},
    pages     = {3992-4000}
}

About


Languages

Language:Python 100.0%