New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prediction step using very deep neural networks feature of calamari #67
Comments
Unfortunately, I can not verify this on my machine. The error occurs when loading the ckpt.json file. I guess there is something wrong with that file (possibly empty, please paste the file content). Please check if a model from https://github.com/Calamari-OCR/calamari_models/tree/master/antiqua_modern is working. |
This is the content of the ckpt.json https://github.com/Calamari-OCR/calamari_models/blob/53c8523aa31d14a79b26d9126ee68f1781beaa61/default/ModernEnglish.ckpt.json |
Also with the older files I can successfully predict and not reproduce your error:
What operating system and python version are you using? (I successfully tested Ubuntu with python 3.5 and 3.6) import json
json.load(open("PATH_TO_ckpt.json", 'r')) |
The first command is passed successfully But the second returns the same error that cause my problem |
I am very glad, that the very same error occurred. This shows that this is not an issue with Calamari but rather with your operating/file system since only python commands of the standard library are used. It also might be an encoding issue (utf-8 as default is required). Can you paste the output of import sys
print(sys.getdefaultencoding()) # should be utf-8 and print(open("PATH_TO_ckpt.json", 'r').read()) Possibly, you might also consider to upgrade your python version: testing 3.6 (custom repo required) or a newer minor release of 3.5.
|
After installing Calamari_ocr with Python3.6 this is the error occurred: |
This means, that your computer (cpu) does not support the current official build of tensorflow, because the AVX instructions are not available by your cpu, in other words your cpu is too old. Two options: consider to install an older tensorflow version (pip install tensorflow==1.7) or compile tensorflow yourself. What was the output of the upper commands? Did the json file load properly? Or can you open it successfully in a browser (e. g. firefox)? |
Thanks for your help. |
So, the file is printed properly, however
As conclusion, either the file is really corrupted, but since I assume that firefox loads it correctly, and the printed string is valid json (unfortunately, you did not send me the content or the file as I requested), something must be wrong with your python environment, and therefore has nothing to do with Calamari. |
@Tailor2019 Recently, another user had a similar error due to additional hidden files in the models directory. Please also check whether only that single models is loading and not a second (hidden) one. |
Hi, |
Hi,
I installed calamari-0.2.4 . Tried to test on this simple example ""https://user-images.githubusercontent.com/33478216/46499779-a909b480-c829-11e8-87f2-d4a34d84ab69.png""
by:
calamari-predict --checkpoint calamari_models/default/ModernEnglish.ckpt --files data.png
It returns this Error 👍
Found 1 files in the dataset
Traceback (most recent call last):
File "/home/pc/my_calamari_env/bin/calamari-predict", line 11, in
load_entry_point('calamari-ocr==0.2.4', 'console_scripts', 'calamari-predict')()
File "/home/pc/my_calamari_env/lib/python3.5/site-packages/calamari_ocr-0.2.4-py3.5.egg/calamari_ocr/scripts/predict.py", line 151, in main
run(args)
File "/home/pc/my_calamari_env/lib/python3.5/site-packages/calamari_ocr-0.2.4-py3.5.egg/calamari_ocr/scripts/predict.py", line 61, in run
predictor = MultiPredictor(checkpoints=args.checkpoint, batch_size=args.batch_size, processes=args.processes)
File "/home/pc/my_calamari_env/lib/python3.5/site-packages/calamari_ocr-0.2.4-py3.5.egg/calamari_ocr/ocr/predictor.py", line 202, in init
self.predictors = [Predictor(cp, batch_size=batch_size, processes=processes) for cp in checkpoints]
File "/home/pc/my_calamari_env/lib/python3.5/site-packages/calamari_ocr-0.2.4-py3.5.egg/calamari_ocr/ocr/predictor.py", line 202, in
self.predictors = [Predictor(cp, batch_size=batch_size, processes=processes) for cp in checkpoints]
File "/home/pc/my_calamari_env/lib/python3.5/site-packages/calamari_ocr-0.2.4-py3.5.egg/calamari_ocr/ocr/predictor.py", line 100, in init
ckpt = Checkpoint(checkpoint, auto_update=self.auto_update_checkpoints)
File "/home/pc/my_calamari_env/lib/python3.5/site-packages/calamari_ocr-0.2.4-py3.5.egg/calamari_ocr/ocr/checkpoint.py", line 20, in init
self.json = json.load(f)
File "/usr/lib/python3.5/json/init.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.5/json/init.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 7 column 1 (char 6)
Thanks for your help :)
The text was updated successfully, but these errors were encountered: