GlassyWu / AECR-Net

Contrastive Learning for Compact Single Image Dehazing, CVPR2021
339 stars 48 forks source link

Runtime error: The size of tensor a (275) must match the size of tensor b (276) at non-singleton dimension 3 #28

Closed cherrysherryplus closed 2 years ago

cherrysherryplus commented 2 years ago

When one of the input image's resolution (width or height) is not divisiable by 8 (or the downsampling rate in the AER-Net forward process), the error happens.


The error message

image

The input clear image (550 x 975)

1714

Should I do some resize or crop work with my own dataset both when training and testing? What should I do to make images with random size as a legal input?

Thanks a lot.

cherrysherryplus commented 2 years ago
# The difference between x_down2 and x_up1 causes the error
input haze size: (550, 975)
x_down2 haze size: torch.Size([1, 128, 488, 275])
x_up1 haze size: torch.Size([1, 128, 488, 276])