ocropus-archive / DUP-ocropy

Python-based tools for document analysis and OCR
Apache License 2.0
3.42k stars 591 forks source link

Pickle fails with EOFError while loading models on Windows #12

Closed dniku closed 9 years ago

dniku commented 9 years ago

Here's the traceback (I edited the path to \ocropy):

D:\ocropy>python ocropus-rpred -Q 2 -m D:\ocropy\models\fraktur.pyrnn.gz  T:\0001.bin.png

########## ocropus-rpred -Q 2 -m D:\ocropy\models\fr

#inputs 1
# loading object D:\ocropy\models\fraktur.pyrnn.gz
Traceback (most recent call last):
  File "ocropus-rpred", line 103, in <module>
    network = ocrolib.load_object(args.model,verbose=1)
  File "D:\ocropy\ocrolib\common.py", line 513, in load_object
    return unpickler.load()
EOFError

0001.bin.png is:

0001 bin

fraktur.pyrnn.gz is freshly downloaded from http://www.tmbdev.net/fraktur.pyrnn.gz. I am running Win7 x64 and Python 2.7.6 x64.

Also, why do the instructions first suggest downloading en-default.pyrnn.gz and then running with fraktur.pyrnn.gz?

tmbdev commented 9 years ago

Did you download the model in binary mode?

That particular page and example is in Fraktur (traditional German script), not English, so you need a different model.

CruzzRazor commented 6 years ago

I am getting the same problem while loading the model in windows. what should i do? the error message is as follows

$ ./run-test
INFO:  # ./tests/testpage.png
INFO:  === ./tests/testpage.png 1
INFO:  estimating skew angle
INFO:  estimating thresholds
INFO:  rescaling
INFO:  ./tests/testpage.png lo-hi (0.39 1.44) angle  0.1 no-normalization
INFO:  writing
INFO:
INFO:  ########## C:/Users/allud/ocropy/env/Scripts/ocropus-gpageseg temp/????
INFO:
INFO:  temp\0001.bin.png
INFO:  scale 19.493589
INFO:  computing segmentation
INFO:  computing column separators
INFO:  considering at most 3 whitespace column separators
INFO:  computing lines
INFO:  propagating labels
INFO:  spreading labels
INFO:  number of lines 100
INFO:  finding reading order
INFO:  writing lines
INFO:      91  temp\0001.bin.png 19.5 92
INFO:
INFO:  ########## C:/Users/allud/ocropy/env/Scripts/ocropus-rpred -n temp/????
INFO:
INFO:  #inputs: 92
# loading object .\models\en-default.pyrnn.gz
Traceback (most recent call last):
  File "C:/Users/allud/ocropy/env/Scripts/ocropus-rpred", line 120, in <module>
    network = ocrolib.load_object(args.model,verbose=1)
  File "c:\python27\Lib\ocrolib\common.py", line 445, in load_object
    return unpickler.load()
EOFError
(env)
amitdo commented 6 years ago

https://www.google.co.il/search?q=pickle+EOFError

csteelatgburg commented 6 years ago

In version 1.3.3 I found the common.py is opening the model using gunzip, which is not available on Windows natively. Adding an import gzip, uncommenting line 442 and commenting out 443 resolved the issue for me.