Holmeyoung / crnn-pytorch

Pytorch implementation of CRNN (CNN + RNN + CTCLoss) for all language OCR.
MIT License
378 stars 105 forks source link

size mismatch for rnn.1.embedding.weight #75

Closed zexuyann closed 7 months ago

zexuyann commented 7 months ago

Traceback (most recent call last): File "D:\Study\software files\bishe\crnn-pytorch-master\demo.py", line 29, in model.load_state_dict(torch.load(model_path)) File "D:\Study\software\anaconda\envs\yolo\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for CRNN: size mismatch for rnn.1.embedding.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([119, 512]). size mismatch for rnn.1.embedding.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([119]).

this code is in train.py. i do not understand where is wrong. thanks