eti-p-doray / unet-gan-matting

Background Removal based on U-Net
MIT License
294 stars 83 forks source link

An error occurred while running the evaluation script #21

Closed xuanhan863 closed 5 years ago

xuanhan863 commented 5 years ago

When I run the evaluation script with: python3 eval.py data/matting/input/107_0.jpg data/matting/trimap/107_trimap.jpg result.jpg --checkpoint -1

An IndexError occurs on eval.py line 48 : alpha = cv2.split(foreground)[3]

afaq-ahmad commented 5 years ago

Hi xuanhan863, facing the same issue, did you found any solution?

antithing commented 5 years ago

Same here! Did either of you find a solution for this?

afaq-ahmad commented 5 years ago

python3 eval.py ./unet-gan-matting-master/scripts/data/input/0_0.jpg ./unet-gan-matting-master/scripts/data/matting/target/0.png ./unet-gan-matting-master/scripts/data/output --checkpoint -1

this gives some results

julesd16 commented 5 years ago

Hello! alpha = cv2.split(foreground)[3] change to alpha = cv2.split(foreground)[2].

theadventureoflinko commented 5 years ago

It seems that trimap image has to be an image which have an alpha channel. In my case, my trimap is a grayscale image, so I changed

alpha = cv2.split(foreground)[3]

to

alpha = foreground

I'm not sure that it is correct way, because output image is still not clean.