TongkunGuan / SIGA

[CVPR2023] Self-supervised Implicit Glyph Attention for Text Recognition
https://openaccess.thecvf.com/content/CVPR2023/papers/Guan_Self-Supervised_Implicit_Glyph_Attention_for_Text_Recognition_CVPR_2023_paper.pdf
104 stars 3 forks source link

test加载模型错误 #4

Open sixgod696 opened 1 year ago

sixgod696 commented 1 year ago

你好,在加载模型进行test时,显示以下错误 Traceback (most recent call last): File "/content/drive/MyDrive/SRresaerch/SIGA/SIGA_R/test.py", line 223, in <module> test(opt) File "/content/drive/MyDrive/SRresaerch/SIGA/SIGA_R/test.py", line 127, in test model.load_state_dict(pretrained_state_dict['net']) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for DataParallel: Unexpected key(s) in state_dict: "module.model_one.Transformation.GridGenerator.inv_delta_C", "module.model_one.Transformation.GridGenerator.P_hat".请问这可能是什么导致的问题?

TongkunGuan commented 1 year ago

你好,在加载模型进行test时,显示以下错误 Traceback (most recent call last): File "/content/drive/MyDrive/SRresaerch/SIGA/SIGA_R/test.py", line 223, in <module> test(opt) File "/content/drive/MyDrive/SRresaerch/SIGA/SIGA_R/test.py", line 127, in test model.load_state_dict(pretrained_state_dict['net']) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for DataParallel: Unexpected key(s) in state_dict: "module.model_one.Transformation.GridGenerator.inv_delta_C", "module.model_one.Transformation.GridGenerator.P_hat".请问这可能是什么导致的问题?

Please refer to SIGA_R/modules/transformation.py 中 GridGenerator, you can ignore the issue. Try to use load_state_dict(model_path, strict=False)

nishitanand commented 5 months ago

Hi after making this change in SIGA_S/test.py, I am getting th error - 'No module named 'Parallel_test''. KIndly provide the code of Parallel_test