microsoft / Semi-supervised-learning

A Unified Semi-Supervised Learning Codebase (NeurIPS'22)
https://usb.readthedocs.io
MIT License
1.33k stars 176 forks source link

Evaluation of STL10 (USB_CV) #169

Closed ShambhaviCodes closed 11 months ago

ShambhaviCodes commented 12 months ago

Bug

Running eval.py produces this bug of dimension mismatch. I changed the net value in the eval.py to 'vit_base_patch16_96' as well.

Reproduce the Bug

Running the command :

python eval.py --dataset stl10 --num_classes 10 --load_path ./saved_models/usb_cv/fixmatch_stl10_40_0/model_best.pth

Error Messages and Logs

Traceback (most recent call last): File "eval.py", line 84, in feat = net(image, only_feat=True) File "/home/ar94990/miniconda3/envs/usb/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/home/ar94990/Semi-supervised-learning/semilearn/nets/vit/vit.py", line 220, in forward x = self.extract(x) File "/home/ar94990/Semi-supervised-learning/semilearn/nets/vit/vit.py", line 203, in extract x = self.pos_drop(x + self.pos_embed) RuntimeError: The size of tensor a (5) must match the size of tensor b (37) at non-singleton dimension 1

Hhhhhhao commented 11 months ago

Hi, you might need to set the img_size argument in eval.py as 96 for STL10