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
23.61k stars 3.1k forks source link

TypeError: Model.__init__() got an unexpected keyword argument 'num_class' #1201

Open ShehneelAhmedKhan opened 7 months ago

ShehneelAhmedKhan commented 7 months ago

I have trained my custom model following this repo and now when I am trying to run this, I get the following error.

image

donjuanpond commented 1 month ago

I'm having the same problem - @ShehneelAhmedKhan were you ever able to fix it?

Sandman2127 commented 1 month ago

Same problem, anyone ???

I think my major issue is knowing which model to define in the ~/.EasyOCR/user_network/ if I simply retrained the ['en'] model.

donjuanpond commented 1 month ago

I was able to solve it by using the python file mentioned in this tutorial for saving / loading the model: https://alimustoofaa.medium.com/easyocr-training-custom-dataset-8fc31cfec1fe. Essentially, the problem was occurring because I was using code I copied from the model.py file for saving / loading, and that takes num_classes through the opt AttrDict. When loading the model, you need the format to have num_classes directly as a parameter.

Sandman2127 commented 1 month ago

Excellent, thank you for your help @donjuanpond we are all up and running now !