advimman / lama

🦙 LaMa Image Inpainting, Resolution-robust Large Mask Inpainting with Fourier Convolutions, WACV 2022
https://advimman.github.io/lama-project/
Apache License 2.0
8.14k stars 864 forks source link

Prediction failed due to The size of tensor #295

Open DNucX opened 10 months ago

DNucX commented 10 months ago

Hello,

I have the following error when attempting to run predict:

Traceback (most recent call last):
  File "/home/user/pythonProjects/lama/bin/predict.py", line 84, in main
    batch = model(batch)
  File "/home/user/pythonProjects/inpenv/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/pythonProjects/lama/saicinpainting/training/trainers/default.py", line 59, in forward
    masked_img = img * (1 - mask)
RuntimeError: The size of tensor a (512) must match the size of tensor b (504) at non-singleton dimension 3

This only happened for one image. The image is jpg and the mask is png. Both have the same dimensions. For some reason, this particular image produces the above error. All other images that I have tried thus far worked.

The above was ran with: refine=False and device=cpu

Any insight is greatly appreciated! Thank you!