TransUNet icon indicating copy to clipboard operation
TransUNet copied to clipboard

run python test.py --dataset Synapse --vit_name R50-ViT-B_16 error

Open yangkunpeng-coder opened this issue 4 years ago • 8 comments

when I run "python test.py --dataset Synapse --vit_name R50-ViT-B_16"

but ,let me said, it raises below error :

"Traceback (most recent call last): File "test.py", line 122, in net.load_state_dict(torch.load(snapshot)) File "D:\Anaconda3\envs\dlgpuevn\lib\site-packages\torch\serialization.py", line 571, in load with _open_file_like(f, 'rb') as opened_file: File "D:\Anaconda3\envs\dlgpuevn\lib\site-packages\torch\serialization.py", line 229, in _open_file_like return _open_file(name_or_buffer, mode) File "D:\Anaconda3\envs\dlgpuevn\lib\site-packages\torch\serialization.py", line 210, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: '../model/TU_Synapse224/TU_pretrain_R50-ViT-B_16_skip3_bs24_224\epoch_29.pth'"

yangkunpeng-coder avatar Jun 23 '21 15:06 yangkunpeng-coder

when I run "python test.py --dataset Synapse --vit_name R50-ViT-B_16"

but ,let me said, it raises below error :

"Traceback (most recent call last): File "test.py", line 122, in net.load_state_dict(torch.load(snapshot)) File "D:\Anaconda3\envs\dlgpuevn\lib\site-packages\torch\serialization.py", line 571, in load with _open_file_like(f, 'rb') as opened_file: File "D:\Anaconda3\envs\dlgpuevn\lib\site-packages\torch\serialization.py", line 229, in _open_file_like return _open_file(name_or_buffer, mode) File "D:\Anaconda3\envs\dlgpuevn\lib\site-packages\torch\serialization.py", line 210, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: '../model/TU_Synapse224/TU_pretrain_R50-ViT-B_16_skip3_bs24_224\epoch_29.pth'"

yangkunpeng-coder avatar Jun 23 '21 15:06 yangkunpeng-coder

Change the max_epochs, batch_size as you used when training.

liyiersan avatar Aug 04 '21 04:08 liyiersan

Hey @yangkunpeng-coder were you able to resolve the above issue?

nerdykamil avatar Sep 22 '21 06:09 nerdykamil

Change the max_epochs, batch_size as you used when training.

Hey,how much would you change to?

Xback-yx avatar Oct 09 '21 09:10 Xback-yx

Change the max_epochs, batch_size as you used when training.

Hey,how much would you change to?

If you train the codes with batch_size as 32, max_epochs as 30, the change the arguments in test.py as batch_size = 32, max_epochs = 30.

liyiersan avatar Oct 09 '21 12:10 liyiersan

How to test without model weights?

jsjy1 avatar Oct 01 '22 04:10 jsjy1