emedvedev/attention-ocr

Assertion Error on training

Closed this issue · 3 comments

Hi there,
I'm trying starting a training process with attention-ocr, but I get the following error.

Traceback (most recent call last):
  File "c:\users\mikyl\anaconda3\envs\tensorflow\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\mikyl\anaconda3\envs\tensorflow\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\mikyl\Anaconda3\envs\TensorFlow\Scripts\aocr.exe\__main__.py", line 9, in <module>
  File "c:\users\mikyl\anaconda3\envs\tensorflow\lib\site-packages\aocr\__main__.py", line 257, in main
    num_epoch=parameters.num_epoch
  File "c:\users\mikyl\anaconda3\envs\tensorflow\lib\site-packages\aocr\model\model.py", line 376, in train
    for batch in s_gen.gen(self.batch_size):
  File "c:\users\mikyl\anaconda3\envs\tensorflow\lib\site-packages\aocr\util\data_gen.py", line 71, in gen
    word = self.convert_lex(lex)
  File "c:\users\mikyl\anaconda3\envs\tensorflow\lib\site-packages\aocr\util\data_gen.py", line 89, in convert_lex
    assert len(lex) < self.bucket_specs[-1][1]
AssertionError

Do you know why it's thrown?

You probably have an image with a label that's longer than your max_prediction_length. It's 8 by default, so if you have labels over 8 characters, you'll get this error. You should adjust it with the --max-prediction CLI parameter.

worked!

Thanks! It worked