Skip to content
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

Error during Line-Segmentation || TypeError: '<' not supported between instances of 'Image' and 'float' #102

Closed
lsubhd opened this issue Dec 11, 2020 · 6 comments
Projects

Comments

@lsubhd
Copy link

lsubhd commented Dec 11, 2020

Dear all,

once again I have come up with a problem during line segmentation:

File "/usr/local/lib/python3.6/dist-packages/ocr4all_helpers-0.2.2-py3.6.egg/ocr4all_helpers/pagelineseg.py", line 634, in cli
pool.map(parallel, dataset)
File "/usr/lib/python3.6/multiprocessing/pool.py", line 266, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/usr/local/lib/python3.6/dist-packages/ocr4all_helpers-0.2.2-py3.6.egg/ocr4all_helpers/pagelineseg.py", line 625, in parallel
remove_images=args.remove_images)
File "/usr/local/lib/python3.6/dist-packages/ocr4all_helpers-0.2.2-py3.6.egg/ocr4all_helpers/pagelineseg.py", line 369, in pagexmllineseg
cropped = Image.fromarray(nlbin.adaptive_binarize(np.array(cropped)).astype(np.uint8))
File "/usr/local/lib/python3.6/dist-packages/ocr4all_helpers-0.2.2-py3.6.egg/ocr4all_helpers/lib/nlbin.py", line 47, in adaptive_binarize
extreme = (np.sum(image<0.05)+np.sum(image>0.95))*1.0/np.prod(image.shape)
TypeError: '<' not supported between instances of 'Image' and 'float'

Is there any further information you need?

Regards,
Leonie

@maxnth
Copy link
Member

maxnth commented Dec 11, 2020

Sorry to hear that the line segmentation isn't working as intended for you once again.
This looks like an easy to fix error in our helper scripts so I'm optimistic that we'll find a solution for this.
Would it be possible to send us one of the PAGE XML files where this error appears (either uploaded here or via mail)?

@lsubhd
Copy link
Author

lsubhd commented Dec 15, 2020

I hope the XML-file in the "data\processing" folder is what you wanted.

0017.zip

@maxnth
Copy link
Member

maxnth commented Dec 15, 2020

I hope the XML-file in the "data\processing" folder is what you wanted.

My text probably was a bit misleading as I only mentioned the XML files but if possible, we'd need the binary / nrm image as well, as both annotations and images are used during line segmentation.

@lsubhd
Copy link
Author

lsubhd commented Dec 15, 2020

In that case - here is the image:

processing png --> 0017 bin

input png --> 0017

@maxnth maxnth added the bug label Dec 18, 2020
@maxnth
Copy link
Member

maxnth commented Jan 7, 2021

We sadly couldn't reproduce the error with the attached files but interestingly got an Image is not bi-level error instead, which is now fixed and will be shipped with the next minor release.
We'll keep looking into the above mentioned bug though.

@maxnth maxnth added this to To do in 0.6 Sep 23, 2021
@maxnth
Copy link
Member

maxnth commented Oct 12, 2021

We changed parts of the line segmentation implementation and couldn't reproduce the error with that version as well.
In case the problem still persists, please reopen this issue.

@maxnth maxnth closed this as completed Oct 12, 2021
@maxnth maxnth moved this from To do to Done in 0.6 Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.6
Done
Development

No branches or pull requests

2 participants