qurator-spk / sbb_textline_detection

Detect textlines in document images
Apache License 2.0
88 stars 18 forks source link

IndexError: list index out of range #27

Closed jbarth-ubhd closed 4 years ago

jbarth-ubhd commented 4 years ago

I'll have >= 3 images where this error occurs: schiltberger1580/025 schiltberger1580/029 schiltberger1580/033

I'm using ocr-d, with sbb_textline_detector commit 689822c63aa3d539341dbd50168907c7499976a6 with this model files:

jb@xxx:~/sbb-models> md5sum *
348fc636df6d4c323754c6145d80f9e9  model_page_mixed_best.h5
16ad73f7a6ed08a29e64d2763771ed28  model_strukturerkennung.h5
cef95b9346922490722c1c2c98d46023  model_textline_new.h5

procedure is:

ocrd workspace init
ocrd workspace add -G IMG -i 0001 -m image/tif 0001.tif 
/usr/bin/time ocrd-olena-binarize -I IMG -O BIN -m mets.xml -p '{"impl":"sauvola"}'
/usr/bin/time ocrd-sbb-textline-detector -I BIN -O SEG -m mets.xml -p '{"model":"/home/jb/sbb-models"}'
jbarth-ubhd commented 4 years ago

oops... schiltberger1580/025 (using original, non-binarized tiff): no problem with commit 8618be2d9e492ccaadfc322cd8184c63243b539f

...
/home/jb/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py:3335: RuntimeWarning: Mean of empty slice.
  out=out, **kwargs)
/home/jb/.local/lib/python3.6/site-packages/numpy/core/_methods.py:161: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
time total = 94.02
time needed for page extraction = 7.03
time needed for text region extraction and get contours = 33.46
time needed for textlines = 41.65
time needed to get slopes of regions (deskewing) = 11.72
time needed to get order of regions = 0.07
time needed to implement deskewing = 0.07
jbarth-ubhd commented 4 years ago

no problem with binarized schiltberger1580/025, too...

mikegerber commented 4 years ago

We discussed this problem internally just recently. It is/was a multi threading problem that might not happen on every run.

However, it should be fixed in b9caa8e onwards, so the 8618be2d version should be ok with all your files now. As I understand your comments, your problems were with an earlier version and is fixed with 8618be2d version?

mikegerber commented 4 years ago
/home/jb/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py:3335: RuntimeWarning: Mean of empty slice.
  out=out, **kwargs)
/home/jb/.local/lib/python3.6/site-packages/numpy/core/_methods.py:161: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)

These are unrelated and should not lead to a fatal problem.

jbarth-ubhd commented 4 years ago

However, it should be fixed in b9caa8e onwards

latest ocrd_all/sbb_textline_detector is of

commit 689822c63aa3d539341dbd50168907c7499976a6 (HEAD, origin/master, origin/HEAD, master)
Date:   Thu Jan 16 15:57:20 2020 +0100

so not fixed in ocrd_all.

mikegerber commented 4 years ago

so not fixed in ocrd_all.

Yes the version there was not up to date. I submitted a PR to fix this for you.

mikegerber commented 4 years ago

https://github.com/OCR-D/ocrd_all/pull/71 is merged now, in ocrd_all. Please re-open this bug if I you still have the issue with that version.