tmbdev / clstm

A small C++ implementation of LSTM networks, focused on OCR.
Apache License 2.0
821 stars 224 forks source link

Error while using clstm models that I trained and test it ! #140

Open Hadi58 opened 7 years ago

Hadi58 commented 7 years ago

@tmbdev Hi ! when I use default clstm models like arabic-beirut-200.clstm model, it's ok and convert successfully: user@user ~/Desktop/mags $ kraken -i images/tt1.jpg image.txt binarize segment ocr -m arabic-beirut- 200.clstm Loading RNN default ✓ Binarizing ✓ Segmenting ✓ Processing ✓ Writing recognition results for /tmp/tmpq1EMeq ✓ but when I use any clstm models that I trained and tested them I get: user@user ~/Desktop/mags $ kraken -i images/tt1.jpg image.txt binarize segment ocr -m persian-keyhan-5000.clstm Loading RNN default ✓ Binarizing ✓ Segmenting ✓ Traceback (most recent call last): File "/usr/local/bin/kraken", line 10, in sys.exit(cli()) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1093, in invoke return _process_result(rv) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1031, in _process_result ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke return callback(args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/kraken/kraken.py", line 167, in process_pipeline task(base_image=base_image, input=input, output=output) File "/usr/local/lib/python2.7/dist-packages/kraken/kraken.py", line 125, in recognizer for pred in it: File "/usr/local/lib/python2.7/dist-packages/kraken/rpred.py", line 211, in mm_rpred pred = nets[script].predictString(line) File "/usr/local/lib/python2.7/dist-packages/kraken/lib/models.py", line 88, in predictString line = line.reshape(-1, self.rnn.ninput(), 1) ValueError: can only specify one unknown dimension

I use kraken version 0.9.6 : user@user ~/Desktop/mags $ kraken --version kraken, version 0.9.6.dev8 and compile separate-derivs branch to train my clstm model.