lama icon indicating copy to clipboard operation
lama copied to clipboard

Tensor mismatch Error (works fine with 'refine')

Open varungupta31 opened this issue 3 years ago • 0 comments

Hey @windj007

I'm trying to inpaint my images - Size (360x640), with mask size of 360x640 as well. I have created masks such that: np.unique(mask) = [0,1]

I'm using the command -

python3 bin/predict.py model.path=$(pwd)/big-lama indir=/ssd_scratch/cvit/varun/640_360_lama_data/ outdir=/ssd_scratch/cvit/varun/LamaOut/

However, when I use refine, the code works.

python3 bin/predict.py refine=True model.path=$(pwd)/big-lama indir=/ssd_scratch/cvit/varun/640_360_lama_data/ outdir=/ssd_scratch/cvit/varun/LamaOut/

Error:

[2022-07-30 12:30:08,782][saicinpainting.training.trainers.base][INFO] - BaseInpaintingTrainingModule init done
[2022-07-30 12:30:14,837][saicinpainting.training.data.datasets][INFO] - Make val dataloader default from /ssd_scratch/cvit/varun/640_360_lama_data/
  0%|                                             | 0/2660 [00:00<?, ?it/s]
[2022-07-30 12:30:14,890][__main__][CRITICAL] - Prediction failed due to The size of tensor a (344) must match the size of tensor b (360) at non-singleton dimension 2:
Traceback (most recent call last):
  File "bin/predict.py", line 84, in main
    batch = model(batch)
  File "/home2/varungupta/miniconda3/envs/lama/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home2/varungupta/lama/saicinpainting/training/trainers/default.py", line 59, in forward
    masked_img = img * (1 - mask)
RuntimeError: The size of tensor a (344) must match the size of tensor b (360) at non-singleton dimension 2

Kindly help me out, Thank you :)

varungupta31 avatar Jul 30 '22 07:07 varungupta31