monniert/docExtractor

bug -- tester.py

marouamehri opened this issue · 2 comments

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

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

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