LilitYolyan / CutPaste

Unofficial implementation of Google "CutPaste: Self-Supervised Learning for Anomaly Detection and Localization" in PyTorch
MIT License
114 stars 25 forks source link

python train.py --dataset_path D:\CutPaste-main\mvtec\train\ --num_class 3 #20

Open xaioffff opened 2 years ago

xaioffff commented 2 years ago

8484cc57d364913f86d8dd32ae279fd Is the raw data set format,I'm confused. What's the reason?I hope I can give you some solutions in your busy schedule.

LilitYolyan commented 2 years ago

@xaioffff check your dataset structure. You should have something like this: mvtec │ readme. │ license.txt
│ └─── bottle │ │ readme.txt │ │ lisence.txt │ │ │ └─── ground_truth │ | └─── broken_large │ | └─── broken_small
│ | └─── contamination │ | | └─── train | | └─── good | | | 000.png | | | ... │ | | └─── test | | └─── broken_large | | | | 000.png
| | | | ...
| | └─── broken_small | | | | 000.png
| | | | ... | | └─── contamination | | | | 000.png | | | | ...
| | └─── good | | | | 000.png | | | | ... └─── cable | ... └─── zipper

In the command, you should specify the path like this ./mvtec/bottle/train. It trains model for each class separately/

xaioffff commented 2 years ago

@xaioffff check your dataset structure. You should have something like this: mvtec │ readme. │ license.txt │ └─── bottle │ │ readme.txt │ │ lisence.txt │ │ │ └─── ground_truth │ | └─── broken_large │ | └─── broken_small │ | └─── contamination │ | | └─── train | | └─── good | | | 000.png | | | ... │ | | └─── test | | └─── broken_large | | | | 000.png | | | | ... | | └─── broken_small | | | | 000.png | | | | ... | | └─── contamination | | | | 000.png | | | | ... | | └─── good | | | | 000.png | | | | ... └─── cable | ... └─── zipper

In the command, you should specify the path like this ./mvtec/bottle/train. It trains model for each class separately/ 64ee72bf5dada2a742687a1e8ce7ef6 5cd4aa4dae473469633d4864588f4a3 I looked at the previous question.It has also been changed in accordance with your requirements.But it still doesn't solve the problem.Am I using python3.6, cuda10.1?I use Windows

xaioffff commented 2 years ago

@xaioffff check your dataset structure. You should have something like this: mvtec │ readme. │ license.txt │ └─── bottle │ │ readme.txt │ │ lisence.txt │ │ │ └─── ground_truth │ | └─── broken_large │ | └─── broken_small │ | └─── contamination │ | | └─── train | | └─── good | | | 000.png | | | ... │ | | └─── test | | └─── broken_large | | | | 000.png | | | | ... | | └─── broken_small | | | | 000.png | | | | ... | | └─── contamination | | | | 000.png | | | | ... | | └─── good | | | | 000.png | | | | ... └─── cable | ... └─── zipper

In the command, you should specify the path like this ./mvtec/bottle/train. It trains model for each class separately/ 64ee72bf5dada2a742687a1e8ce7ef6 5cd4aa4dae473469633d4864588f4a3 I looked at the previous question.It has also been changed in accordance with your requirements.But it still doesn't solve the problem.Am I using python3.6, cuda10.1?I use Windows

LilitYolyan commented 2 years ago

I see. The reason may be in os differences. In dataset object we have if self.train_images and self.mode == 'train': self.images = glob(self.train_images + "/*")

where "/*" may not work in Windows. You can change that part, use pathlib instead of glob , it may solve your issue

xaioffff commented 2 years ago

The result of the required substitution is image image image I really appreciate your patience。But I'm very sorry it still doesn't work