JaidedAI / EasyOCR

Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
https://www.jaided.ai
Apache License 2.0
24.41k stars 3.16k forks source link

Custom Example - Size mismatch for Prediction.weight & Size mismatch for Prediction.bias - Custom Model #487

Closed falhafizh closed 3 years ago

falhafizh commented 3 years ago

Hi,

i have followed and did all the instructions exactly the same as custom_model.md

I always have problems: raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Model: size mismatch for Prediction.weight: copying a param with shape torch.Size([97, 256]) from checkpoint, the shape in current model is torch.Size([99, 256]). size mismatch for Prediction.bias: copying a param with shape torch.Size([97]) from checkpoint, the shape in current model is torch.Size([99]).

What should I do? @rkcosmos

here my reader param: easyocr.Reader( lang_list=["en"], gpu=False, model_storage_directory=EASYOCR_PATH+"model/", download_enabled=False, user_network_directory=EASYOCR_PATH+"user_network/", recog_network='custom_example' )

falhafizh commented 3 years ago

CUSTOM MODEL

When using custom model ( I used custome_example.zip exactly with instrunctions in here )

So, the symbol changes when loaded from custom_example.yaml to €

I try to replace it directly : Inject Character

So, Problem solved