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

I want to predict single image ,can you teach me what shoulde I do ? #15

Closed DeepSpace98 closed 2 years ago

AnnaManasyan commented 2 years ago

Single image from MVTec dataset or your custom data?

DeepSpace98 commented 2 years ago

Single image from MVTec dataset or your custom data?

I want to use the train.py 's model to predict my custom data,but I don't know how to code the predict.py

AnnaManasyan commented 2 years ago

So, you need to change the dataset in train_dataloader in train.py from MVTec to CutPaste_Dataet from dataset.py . After you can train your model on custom dataset. Finally, you can check the "mvtec_anomaly_detection" method in anomaly_detection.py to see how the anomaly scores are determined for MVTec test set and wite similar code for testing single image. It's a little bit overhead as the codebase is mainly for MVtec dataset and doesn't support custom dataset or single image testing for now.