FangShancheng / ABINet

Read Like Humans: Autonomous, Bidirectional and Iterative Language Modeling for Scene Text Recognition
Other
420 stars 72 forks source link

Unable to perform case sensitive recognition #89

Open shivpoojansaini opened 1 year ago

shivpoojansaini commented 1 year ago

As there are 3 types of character set under the data directory i.e

ABINET\ABINet\demo.py:66, in load(model, file, device, strict) 64 if set(state.keys()) == {'model', 'opt'}: 65 state = state['model'] ---> 66 model.load_state_dict(state, strict=strict) 67 return model

abinet\abinet_env\lib\site-packages\torch\nn\modules\module.py:1604, in Module.load_state_dict(self, state_dict, strict) 1599 error_msgs.insert( 1600 0, 'Missing key(s) in state_dict: {}. '.format( 1601 ', '.join('"{}"'.format(k) for k in missing_keys))) 1603 if len(error_msgs) > 0: -> 1604 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( 1605 self.class.name, "\n\t".join(error_msgs))) 1606 return _IncompatibleKeys(missing_keys, unexpected_keys)

RuntimeError: Error(s) in loading state_dict for ABINetIterModel: size mismatch for vision.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]). size mismatch for vision.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]). size mismatch for language.proj.weight: copying a param with shape torch.Size([512, 37]) from checkpoint, the shape in current model is torch.Size([512, 63]). size mismatch for language.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]). size mismatch for language.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]). size mismatch for alignment.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]). size mismatch for alignment.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]).`