tmbdev / clstm

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

clstmocr - error opening clstm file (trained model) #138

Closed lomograb closed 6 years ago

lomograb commented 7 years ago

I have a trained uw3 model which had trained about 4000 iterations. Then, when I execute clstmocr, I face some error:

./clstmocr image.jpg 
#: load = uw3-500-4000.clstm
#: conf = 0
#: output = text
#: save_text = 1
FATAL: error on open

Any ideas ?

wrznr commented 7 years ago

No idea yet but a confirmation of your report:

kmw@lal:~/projects/dta/ocropus/baz$ load=baz.clstm conf=1 ~/built/clstm/clstmocr test_bin/facs_1_tl_21.bin.png
#: load = baz.clstm
#: conf = 1
#: output = text
#: save_text = 1
FATAL: error on open
wrznr commented 7 years ago

Using the absolute path does not help either. @kba Could you please have a look at this? I am pretty sure that this caused by incorrect invocation of clstmocr.

kba commented 7 years ago

I don't have a machine to test ATM, hopefully in over the weekend I'll get it back @zuphilip Can you try?

wrznr commented 7 years ago

As I suspected, incorrect invocation. Should have a look at test-ocr.sh first: The argument to clstmocr has to be a text file containing image paths rather than an image file:

kmw@lal:~/projects/dta/ocropus/baz$ echo "test_bin/facs_1_tl_21.bin.png" > test_single.lst
kmw@lal:~/projects/dta/ocropus/baz$ load=baz-4000.clstm ~/built/clstm/clstmocr test_single.lst
#: load = baz-4000.clstm
#: conf = 0
#: output = text
#: save_text = 1
test_bin/facs_1_tl_21.bin.png   behalten wird, müißte alsn spätestenm Aniamg Dirz mit den krcben von Solisten
wrznr commented 7 years ago

@lomograb Can you try and confirm in order to resolve this issue?

ghost commented 7 years ago

@wrznr you are right. now clstmocr produces values, what do they mean?

0   7   32  0.999997
1   19  32  0.999999
2   32  32  0.999993
3   36  32  0.986836
4   41  32  0.997986
5   56  1585    0.998276
6   60  32  0.404907
7   72  1585    0.957227
8   78  1585    0.958865
9   85  1585    0.847094
10  89  1585    0.966943
11  97  32  0.783419
wrznr commented 7 years ago

@christophered I am sorry, but for me it does not produce numbers but rather output text (cf. console output from my post above). If you provide your invocation command, I will try to interpret those numbers.

wrznr commented 7 years ago

@christophered Okay, figured it out. You invoked clstmocr with the env variable conf=1, i.e.:

load=baz-4000.clstm conf=1 ~/built/clstm/clstmocr test_single.lst

The numbers give you 1. Position in output text, 2. starting pixel (that's a wild guess, @kba Could you pls confirm?), 3. Recognized char (i.e. decimal unicode point), 4. char confidence (i.e. how sure was the system at this point). If you set conf=0 (or leave it out), the numbers disappear and only the recognized text is printed.

I guess the issue could be closed now, right?