Skip to content

cqylunlun/CRAS

Repository files navigation

CRAS

PWC PWC PWC PWC

Center-aware Residual Anomaly Synthesis for Multi-class Industrial Anomaly Detection

Qiyu Chen, Huiyuan Luo, Haiming Yao, Wei Luo, Zhen Qu, Chengkan Lv*, Zhengtao Zhang

IEEE DOI Link & ArXiv Preprint Link

Table of Contents

Introduction

This repository contains source code for CRAS implemented with PyTorch. CRAS aims to address inter-class interference and intra-class overlap in multi-class anomaly detection through center-aware residual learning and distance-guided anomaly synthesis.

This repository also contains the self-built dataset ITDD proposed in our paper. Here, we present a brief summary of CRAS's performance across several benchmark datasets.

Multi-class MVTec AD VisA MPDD ITDD
I-AUROC 98.3% 93.5% 95.0% 99.4%
P-AUROC 98.0% 97.7% 98.3% 97.8%
Single-class MVTec AD VisA MPDD ITDD
I-AUROC 99.7% 97.0% 98.8% 99.6%
P-AUROC 98.4% 98.4% 98.7% 98.0%

Environments

Create a new conda environment and install required packages.

conda create -n cras_env python=3.9.21
conda activate cras_env
pip install -r requirements.txt

Experiments are conducted on NVIDIA GeForce RTX 4090 (24GB). Same GPU and package version are recommended.

Data Preparation

The public datasets employed in the paper are listed below. The MVTec AD and MPDD datasets retain their original directory structures. However, you need to run the provided script to convert the VisA dataset to the same layout as MVTec AD.

We also release the model weights of CRAS on MVTec AD reported in the paper. If you want to further explore based on these models, you need to download the results folder (Download link) and move it to the root directory of this repository. Note that you should clear the existing results folder before moving.

Run Experiments

Edit ./shell/run-dataset-setting.sh to configure arguments --datapath, --classes, and hyperparameter settings. Please modify argument --test to 'ckpt' / 'test' to toggle between training and testing modes.

bash run-dataset-setting.sh

"Note that 'dataset' refers to any dataset. Currently, the shell folder contains scripts for four datasets under the single-class and multi-class settings, such as run-mvtec-multi.sh for MVTec AD under multi-class setting. If you want to train your own dataset, please create a new run-*-*.sh file."

Dataset Release

The Industrial Textile Defect Detection (ITDD) dataset includes 1885 industrial textile images categorized into 4 categories: cotton fabric, dyed fabric, hemp fabric, and plaid fabric. These classes are collected from the industrial production sites of WEIQIAO Textile. ITDD is an upgraded version of WFDD that reorganizes three original classes and adds one new class.

Citation

Please cite the following paper if the code and dataset help your project:

@article{chen2025center,
  title={Center-aware Residual Anomaly Synthesis for Multiclass Industrial Anomaly Detection},
  author={Chen, Qiyu and Luo, Huiyuan and Yao, Haiming and Luo, Wei and Qu, Zhen and Lv, Chengkan and Zhang, Zhengtao},
  journal={IEEE Transactions on Industrial Informatics}, 
  year={2025},
  volume={21},
  number={9},
  pages={7276-7286},
}

Acknowledgements

Thanks for the great inspiration from SimpleNet, GLASS, and PBAS.

License

The code and dataset in this repository are licensed under the MIT license.

About

[TII 2025] Official Implementation and Dataset Release for "Center-aware Residual Anomaly Synthesis for Multi-class Industrial Anomaly Detection"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors