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

about train.py #22

Open mouxinyue1 opened 2 years ago

mouxinyue1 commented 2 years ago

hello! Thank you for your code contribution!I follow the setup instruction to run train.py , But I encountered the following problems:

$ python train.py --dataset_path cutpaste/mvtec/bottle/train --num_class 3

Missing logger folder: tb_logs/exp1 Traceback (most recent call last): File "train.py", line 103, in model = CutPaste(hparams = args) File "train.py", line 19, in init self.model = CutPasteNet(encoder = hparams.encoder, pretrained = hparams.pretrained, dims = hparams.dims, num_class = hparams.num_class) File "/home/lwz/CutPaste-Li/model.py", line 49, in init super().init(encoder, pretrained, dims, num_class) File "/home/lwz/CutPaste-Li/model.py", line 23, in init self.out = nn.Linear(dims[-1], num_class) File "/home/lwz/.conda/envs/cutpasteli/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 85, in init self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs)) TypeError: empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType), but expected one of:

(tuple of ints size, , tuple of names names, torch.memory_format memory_format, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad) (tuple of ints size, , torch.memory_format memory_format, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad) I am really confused about that, could you please give me some advice? Is this a problem with the installation package version? Have you solved the problem yet? Can you give me some advice?

Chichiviriche commented 2 years ago

I got the same error : solved if you enter correctly the path, for example : python train.py --dataset_path /home/laurent/CutPaste/bottle/train --num_class 3 is starting correctly

xaioffff commented 2 years ago

I got the same error : solved if you enter correctly the path, for example : python train.py --dataset_path /home/laurent/CutPaste/bottle/train --num_class 3 is starting correctly

However, errors are still reported. How can I resolve this problem? It's been tried on both systems