emedvedev / attention-ocr

A Tensorflow model for text recognition (CNN + seq2seq with visual attention) available as a Python package and compatible with Google Cloud ML Engine.
MIT License
1.08k stars 256 forks source link

Assertion Error on training #151

Closed mikylucky closed 5 years ago

mikylucky commented 5 years ago

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?

emedvedev commented 5 years ago

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.

mikylucky commented 5 years ago

worked!

Guneetkaur03 commented 4 years ago

Thanks! It worked