KupynOrest / DeblurGAN

Image Deblurring using Generative Adversarial Networks
Other
2.51k stars 517 forks source link

Images always square shaped? #83

Open shivam2296 opened 6 years ago

shivam2296 commented 6 years ago

Hi Orest, I find errors whenever the input is a rectangular shaped image. Is there any way to process a high dimension image (1024X720) directly?

--------------------------------------------------------COMMAND------------------------------------------------------------------- python test.py --dataroot mypics3 --model test --dataset_mode single --loadSizeX=1024 --loadSizeY=720 --resize_or_crop=scale_width --learn_residual

--------------------------------------------------------ERROR------------------------------------------------------------------------ File "test.py", line 36, in model.test() File "/home2/shivam/DeblurGAN/models/test_model.py", line 37, in test self.fake_B = self.netG.forward(self.real_A) File "/home2/shivam/DeblurGAN/models/networks.py", line 148, in forward output = input + output RuntimeError: The size of tensor a (341) must match the size of tensor b (344) at non-singleton dimension 2

Also, I'm facing GPU runtime error for square-shaped images having dimensions above 512X512 with no down-scaling. Is there any way out? Or I should process my images in patches of 256X256.

kaikang90 commented 6 years ago

Hi, @shivam2296 , you can try to increase below code at the end of function "base_dataset.py" -> "def get_transform(opt):" , " elif opt.resize_or_crop == 'resize_or_crop_for_test': osize = [opt.loadSizeY, opt.loadSizeX] transform_list.append(transforms.Scale(osize, Image.BICUBIC)) " Then run with parameter "--resize_or_crop resize_or_crop_for_test".

hanshan1 commented 5 years ago

Hi, @shivam2296 , you can try to increase below code at the end of function "base_dataset.py" -> "def get_transform(opt):" , " elif opt.resize_or_crop == 'resize_or_crop_for_test': osize = [opt.loadSizeY, opt.loadSizeX] transform_list.append(transforms.Scale(osize, Image.BICUBIC)) " Then run with parameter "--resize_or_crop resize_or_crop_for_test".

I did on this way and met the question: RuntimeError: The size of tensor a (161) must match the size of tensor b (164) at non-singleton dimension 2

shivam2296 commented 5 years ago

Okay, thanks. I will look into it.

On Tue 30 Oct, 2018, 3:14 PM HanShan1, notifications@github.com wrote:

Hi, @shivam2296 https://github.com/shivam2296 , you can try to increase below code at the end of function "base_dataset.py" -> "def get_transform(opt):" , " elif opt.resize_or_crop == 'resize_or_crop_for_test': osize = [opt.loadSizeY, opt.loadSizeX] transform_list.append(transforms.Scale(osize, Image.BICUBIC)) " Then run with parameter "--resize_or_crop resize_or_crop_for_test".

I did on this way and met the question: RuntimeError: The size of tensor a (161) must match the size of tensor b (164) at non-singleton dimension 2

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KupynOrest/DeblurGAN/issues/83#issuecomment-434234595, or mute the thread https://github.com/notifications/unsubscribe-auth/AWH51mANzlDxtlVcb8rlZAdHb9XpQDcZks5uqB-PgaJpZM4U7OnT .