wdhudiekou / UMF-CMGR

[IJCAI2022 Oral] Unsupervised Misaligned Infrared and Visible Image Fusion via Cross-Modality Image Generation and Registration
MIT License
153 stars 17 forks source link

KeyError: 'spatial_transform.grid' #13

Closed Yixing-Wu closed 1 year ago

Yixing-Wu commented 1 year ago

When I use test_reg.py and pretrained model reg_0280.pth to test the registration process,I got a keyerror: 'spatial_transform.grid'. Can you help me? The more information about this error is as following:

===> loading trained model '../reg_0280.pth' Traceback (most recent call last): File "test_reg.py", line 187, in main(args) File "test_reg.py", line 61, in main net.load_state_dict(model_state_dict) File "/home/wu/UMF/Test/../models/deformable_net.py", line 74, in load_state_dict state_dict.pop('spatial_transform.grid') KeyError: 'spatial_transform.grid'

AbandonedWarlord commented 1 year ago

I got the same error when I was doing alignment training and importing the pre-training provided by the author, so I hope I can learn how to solve it. => loading model '../cache/Reg_only/reg_0280.pth' Traceback (most recent call last): File "train_reg.py", line 163, in main(args, visdom) File "train_reg.py", line 76, in main net.load_state_dict(model_state_dict) File "../models/deformable_net.py", line 74, in load_state_dict state_dict.pop('spatial_transform.grid') KeyError: 'spatial_transform.grid'

wdhudiekou commented 1 year ago

If you follow the given experimental requirements, you should not encounter similar problems. Please check the version of the code base, e.g., PyTorch and kornia.