hustvl / ViTMatte

[Information Fusion (Vol.103, Mar. '24)] Boosting Image Matting with Pretrained Plain Vision Transformers
MIT License
339 stars 33 forks source link

Alpha dimension doesn't match picture dimensions #26

Open musja007 opened 9 months ago

musja007 commented 9 months ago

High all!

I'm trying to run the model from transformers on the picture given the trimap following this notebook: https://github.com/NielsRogge/Transformers-Tutorials/blob/master/ViTMatte/Quick_inference_with_ViTMatte_for_image_matting.ipynb

Screenshot from 2023-11-22 15-54-48

For some reason the dimensions of alpha don't match the original picture dimensions. Original picture is (1080, 1920) and alphas is (1088, 1952).

If I run the code from the notebook everything runs correctly. So I assume something might be wrong with the format of picture or trimap I'm trying to use?

To reproduce, links to files:

picture: https://drive.google.com/file/d/1eF9sQwvQ573rgO_IK5lGhr2iZCI-ncP1/view?usp=sharing trimap: https://drive.google.com/file/d/1wdx1McNBj92Q_ZuzFhJ79JUdfkd0ZYXH/view?usp=sharing

Thanks in advance!

JingfengYao commented 9 months ago

I think it may be because of the padding. Check here.