This repository provides the related code and experimental details for our research on CMGL
Environment installation
conda create -n CMGL python==3.8
conda activate CMGL
pip install -r requirements.txtData preparation
-
Download MVTec AD dataset form here
-
Download VisA dataset form here
-
Download BTAD dataset form here
-
Download KSDD2 dataset form here
-
Download RSDD dataset form here
-
Download DAGM, dataset form here
-
Download DTD-Synthetic dataset form here
-
The weld anomaly samples are sourced from corporate collaborations. If you want to the data,please send the email to us. We will send the download link once we receive and confirm your signed agreement.
-
Before run the model , each dataset is required to be processed into the following format:
./datasets/mvisa/data ├── visa ├── candle ├── train ├── good ├── visa_0000_000502.bmp ├── test ├── good ├── visa_0011_000934.bmp ├── anomaly ├── visa_000_001000.bmp ├── ground_truth ├── anomaly1 ├── visa_000_001000.png ├── mvtec ├── bottle ├── train ├── good ├── mvtec_000000.bmp ├── test ├── good ├── mvtec_good_000272.bmp ├── anomaly ├── mvtec_broken_large_000209.bmp ├── ground_truth ├── anomaly ├── mvtec_broken_large_000209.png ├── meta_mvtec.json ├── meta_visa.json
The related data processing scripts are located in the ./dataset directory.
Pretrained weights
- The pretrained weights of CLIP can be downloaded form here [ViT-L-14-336(default), ViT-B-16-224, ViT-L-14-224].
Training model
-
Run the script
bash train.sh
Testing model
- Run the script
bash test.sh
- If there are any issues with the code, please send the email to us. The email address will be made public after the peer-review process.
