MhLiao / MaskTextSpotter

A PyTorch implementation of Mask TextSpotter
https://github.com/MhLiao/MaskTextSpotter
413 stars 94 forks source link

pretrain model loading error #13

Closed machetelol closed 5 years ago

machetelol commented 5 years ago

Hi @MhLiao , Thanks for your amazing work, when I try to load your pretrain model to run the test, I meet the error below:

 File "tools/test_net.py", line 95, in <module>
    main()
  File "tools/test_net.py", line 64, in main
    _ = checkpointer.load(cfg.MODEL.WEIGHT)
  File "/home/pc/MaskTextSpotter/maskrcnn_benchmark/utils/checkpoint.py", line 62, in load
    self._load_model(checkpoint)
  File "/home/pc/MaskTextSpotter/maskrcnn_benchmark/utils/checkpoint.py", line 98, in _load_model
    load_state_dict(self.model, checkpoint.pop("model"))
  File "/home/pc/MaskTextSpotter/maskrcnn_benchmark/utils/model_serialization.py", line 80, in load_state_dict
    model.load_state_dict(model_state_dict)
  File "/home/pc/.conda/envs/mts/lib/python3.7/site-packages/torch/nn/modules/module.py", line 777, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for GeneralizedRCNN:
        size mismatch for roi_heads.box.feature_extractor.fc6.weight: copying a param with shape torch.Size([1024, 12544]) from checkpoint, the shape in current model is torch.Size([1024, 50176]).

I don't remember where I fixed except the torch.bool to torch.uint8 because I use the pytorch1.1, and in the pretrain.yaml I only change the SOLVER part... Is there any reason may cause this problem? Thx!

MhLiao commented 5 years ago

@machetelol I have fixed the parameter POOLER_RESOLUTION in the pretrain.yaml. It should work now.

machetelol commented 5 years ago

@MhLiao thx~