Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I try to run generate_blur.py, I got this RuntimeError #9

Open
Suncheng2019 opened this issue Sep 27, 2021 · 3 comments
Open

Comments

@Suncheng2019
Copy link

The size of the image which I used is 640*640. It can be diviable by 128. Thanks for your help!

Sample #0/10
Traceback (most recent call last):
File ".\generate_blur.py", line 53, in
main()
File ".\generate_blur.py", line 45, in main
LQ_tensor = model.adaptKernel(HQ_tensor, kernel)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\kernel_encoding\kernel_wizard.py", line 157, in adaptKernel
out = self.adapter(x_sharp, kernel)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\kernel_encoding\kernel_wizard.py", line 99, in forward
return self.model(x, k)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\backbones\unet_parts.py", line 103, in forward
return self.up(self.submodule(self.down(x), noise))
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\backbones\unet_parts.py", line 109, in forward
return torch.cat((self.up(self.submodule(self.down(x), noise)), x), dim=1)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\backbones\unet_parts.py", line 109, in forward
return torch.cat((self.up(self.submodule(self.down(x), noise)), x), dim=1)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\backbones\unet_parts.py", line 109, in forward
return torch.cat((self.up(self.submodule(self.down(x), noise)), x), dim=1)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Project\Pycharm\blur-kernel-space-exploring-main\models\backbones\unet_parts.py", line 107, in forward
return torch.cat((self.up(torch.cat((self.down(x), noise), dim=1)), x), dim=1)
RuntimeError: Sizes of tensors must match except in dimension 2. Got 2 and 5 (The offending index is 0)

@Suncheng2019
Copy link
Author

I download the pre_trained model vgg19-dcbb9e9d.pth in C:, I can run generate_bule.py and also get the following print :
Sample #0/10
Sample #1/10
Sample #2/10
Sample #3/10
Sample #4/10
Sample #5/10
Sample #6/10
Sample #7/10
Sample #8/10
Sample #9/10
And I use this order to run it:
python generate_blur.py --yml_path=options/generate
_blur/default.yml --image_path=imgs/sharp_imgs/mushishi.png --num_samples=10 --save_path=./res.png

but I don't get the res.png , I don't know why. Could you please help me out? Thank you ver much!

@Fangzhenxuan
Copy link

你解决这个问题了吗
他的代码好像只能跑256*256大小的图片

@rose-jinyang
Copy link

Hello
Is it possible to generate a blurry image in any resolution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants