bo-zhang-cs / CACNet-Pytorch

Unofficial PyTorch implementation of "Composing Photos Like a Photographer"
MIT License
52 stars 15 forks source link

Question about keep_aspect_ratio #5

Closed super233 closed 2 years ago

super233 commented 2 years ago

Hi, thanks for your sharing awesome codes.

Dose your reproduced CACNet only normally run with the setting of keep_aspect_ratio=False? I have tried to run with the setting of keep_aspect_ratio=True and crop_batch_size=1, however there encountered the following error, I want to know what cause it. Could you please share your perspectives about keep_aspect_ratio=True? :-)

File "/root/CACNet/CACNet.py", line 194, in forward
    regression[...,0::2] = offsets[..., 0::2] + self.all_anchors[...,0:1]
RuntimeError: The size of tensor a (44) must match the size of tensor b (28) at non-singleton dimension 2
super233 commented 2 years ago

I found that it was caused by using image_size to initialize PostProcess in "CACNet.py".