monniert / docExtractor

(ICFHR 2020 oral) Code for "docExtractor: An off-the-shelf historical document element extraction" paper
https://www.tmonnier.com/docExtractor
MIT License
85 stars 10 forks source link

bug -- tester.py #17

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi @monniert

Thank you very much for sharing the code with us.

When running the "tester.py" script, there is the following bug related to Image.blend (Ihave checked that pred_img.size = img.size). Is it related to resize function ?

(926, 1280) (926, 1280) Traceback (most recent call last): File "tester.py", line 122, in tester.run() File "tester.py", line 66, in run self.save_prob_and_seg_maps() File "tester.py", line 101, in save_prob_and_seg_maps blend_img = Image.blend(img, pred_img, alpha=0.4) File "/home/pejc/anaconda2/envs/layout/lib/python3.8/site-packages/PIL/Image.py", line 3011, in blend return im1._new(core.blend(im1.im, im2.im, alpha)) ValueError: images do not match

Thank you in advance

ghost commented 2 years ago

Problem resolved. img.mode is the origin of this bug. We need to convert the input image to RBG mode before using blend.

monniert commented 2 years ago

Hey indeed I will add img.convert('RGB') in the script, thanks!