sbb_binarization
sbb_binarization copied to clipboard
OSError: SavedModel file does not exist at: saved_model_2021_03_09/assets//{saved_model.pbtxt|saved_model.pb}
❯ sbb_binarize --model-dir saved_model_2021_03_09 actevedef_718448162.first-page/OCR-D-IMG/OCR-D-IMG_00000024.tif test.tif
Traceback (most recent call last):
File "/home/b-mg106/.virtualenvs/sbb_binarization_issue-47/bin/sbb_binarize", line 8, in <module>
sys.exit(main())
[...]File "/home/b-mg106/.virtualenvs/sbb_binarization_issue-47/lib/python3.9/site-packages/tensorflow/python/saved_model/loader_impl.py", line 116, in parse_saved_model
raise IOError(
OSError: SavedModel file does not exist at: saved_model_2021_03_09/assets//{saved_model.pbtxt|saved_model.pb}
This is with 0.1.0. Haven't tested master but that branch doesn't seem to have any changes related to this problem.
(2020-01-16 works)
saved_model_2020_01_16 is the variant with the 4 models saved_model_2021_03_09 is the variant with one model only I tested 0.1.0 (installed via pip, from PyPI)
A workaround:
mkdir tmp1234
mv saved_model_2021_03_09 tmp1234
mv tmp1234 saved_model_2021_03_09
This results in this directory structure:
% tree -d saved_model_2021_03_09
saved_model_2021_03_09
└── saved_model_2021_03_09
├── assets
└── variables
which makes the above call work.
I see two issues here:
- Zip files are not packed in the same way
- Therefore, with the information in the README alone it is difficult to get this working.
2020_01_16:
# WORKS
unzip saved_model_2020_01_16.zip
sbb_binarize --model-dir saved_model_2020_01_16 test.tif out.tif
2021_03_09:
# FAILS
unzip saved_model_2021_03_09.zip
sbb_binarize --model-dir saved_model_2021_03_09 test.tif out.tif
# WORKAROUND
unzip saved_model_2021_03_09.zip
# ADDITIONAL STEP REQUIRED HERE, compared to 2020_01_16:
mkdir some-topdir; mv saved_model_2021_03_09 some-topdir
sbb_binarize --model-dir some-topdir test.tif out.tif
I hope this makes the issue even clearer. The zips are not packed in the same way. And the README does not seem to give the information required to perform the workaround.
The "problem zip" saved_model_2021_03_09.zip is also the one at the top of the Models section. I would thus recommend:
- repacking it so it contains the additional top-directory to make it work.
- additionally providing complete instructions (wget + unzip + sbb_binarize)