This is the official implementation of the paper "DRepT: Anomaly Detection Based on Transfer of Defect Representation with Transmittance Mask" in 2023 International Joint Conference on Neural Networks (IJCNN) [1] Paper.
The purpose is to improve the accuracy of anomaly detection for the target domain in surface anomaly detection (i.e., defect detection).
DRepT uses an anomaly image in the source domain and transfers its defect representation to a normal image in the target domain.
As a result, an anomaly image for the target domain is generated with high quality, and these anomaly images can be used for training the anomaly detection model.
Source domain: Normal images and Anomaly images (without Ground Truth)
Target domain: Normal images only
$ pip3 install torch torchvision numpy pillow tqdm tb-nightly future natsort opencv-python
$ git clone https://github.com/koba-jon/DRepT.git
$ cd DRepT
Example of MVTecAD[2]:
$ ln -s <mvtec_anomaly_detection_dataset_path> ./datasets/mvtec_anomaly_detection
$ bash datasets/MVTecAD_convert.sh
Example of MVTecAD[2] (Source: Carpet / Tile / Wood , Target: Leather):
$ bash scripts/MVTecAD/A_stage1/carpet.sh
$ bash scripts/MVTecAD/A_stage1/tile.sh
$ bash scripts/MVTecAD/A_stage1/wood.sh
$ bash scripts/MVTecAD/B_stage2/carpet.sh
$ bash scripts/MVTecAD/B_stage2/tile.sh
$ bash scripts/MVTecAD/B_stage2/wood.sh
$ bash scripts/MVTecAD/C_set/leather.sh
$ bash scripts/MVTecAD/D_stage3/leather.sh
$ bash scripts/MVTecAD/E_test/leather.sh
Example of "Carpet to Leather":
$ bash scripts/MVTecAD/X_transfer/22.sh
If you use this code for your research, please cite the following paper:
@inproceedings{KobayashiIJCNN2023,
author={Kobayashi, Hiroki and Hashimoto, Manabu},
title={DRepT: Anomaly Detection Based on Transfer of Defect Representation with Transmittance Mask},
booktitle={2023 International Joint Conference on Neural Networks (IJCNN)},
year={2023},
}
[1] H. Kobayashi and M. Hashimoto, "DRepT: Anomaly Detection Based on Transfer of Defect Representation with Transmittance Mask", 2023 International Joint Conference on Neural Networks (IJCNN), 2023.
[2] P. Bergmann, K. Batzner, M. Fauser, D. Sattlegger, and C. Steger, "The MVTec Anomaly Detection Dataset: A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection", International Journal of Computer Vision, Vol.129, issue 4, pp.1038-1059, 2021.