IceClear / StableSR

[IJCV2024] Exploiting Diffusion Prior for Real-World Image Super-Resolution
https://iceclear.github.io/projects/stablesr/
Other
2.11k stars 138 forks source link

about size match of tensor #131

Open zcdliuwei opened 4 months ago

zcdliuwei commented 4 months ago

First of all, thank you for your amazing open source project I used the following image as my low resolution input, with width and height of 512 and 768 respectively: d7bc8707-94c4-4c2a-a031-3e0764396b31

Then, I wanted to super-resolution to 1024 and executed the following command: python scripts/sr_val_ddpm_text_T_vqganfin_oldcanvas_tile.py --config configs/stableSRNew/v2-finetune_text_T_512.yaml --ckpt ckpt/stablesr_turbo.ckpt --init-img inputs/test_example --outdir output --ddpm_steps 4 --dec_w 0.5 --seed 42 --n_samples 1 --vqgan_ckpt ckpt/vqgan_cfw_00011.ckpt --colorfix_type wavelet --upscale 2

Then I received the following error message: image

Strangely, when I changed upscale to 1, 3, 4, 5, 6, and 7, I all got the expected results, except for an error when upscale=2 was reported,I hope to receive your guidance,thanks!

IceClear commented 4 months ago

Hi. This is because you are using a tile size larger than your image size. See here.

zcdliuwei commented 4 months ago

Hi. This is because you are using a tile size larger than your image size. See here.

Thank you for your reply

Do you mean that the tile size should be smaller than the target resolution of 1024, in my case?

But when I used the following command, specifying tile size=1600, which is greater than the target resolution of 1024, I obtained the correct super-resolution result: python scripts/sr_val_ddpm_text_T_vqganfin_oldcanvas_tile.py --config configs/stableSRNew/v2-finetune_text_T_512.yaml --ckpt ckpt/stablesr_turbo.ckpt --init-img inputs/test_example --outdir output --ddpm_steps 4 --dec_w 0.5 --seed 42 --n_samples 1 --vqgan_ckpt ckpt/vqgan_cfw_00011.ckpt --colorfix_type wavelet --upscale 2 --vqgantile_size 1600

Similarly, when I scaled down tile size=512 and vqgantile_strid=500, there was no error reported: python scripts/sr_val_ddpm_text_T_vqganfin_oldcanvas_tile.py --config configs/stableSRNew/v2-finetune_text_T_512.yaml --ckpt ckpt/stablesr_turbo.ckpt --init-img inputs/test_example --outdir output --ddpm_steps 4 --dec_w 0.5 --seed 42 --n_samples 1 --vqgan_ckpt ckpt/vqgan_cfw_00011.ckpt --colorfix_type wavelet --upscale 2 --vqgantile_size 512 --vqgantile_strid 500

IceClear commented 3 months ago

Hi. Sry for the late reply since I am quite busy recently. It seems like a size checking problem since the default tile size of sr_val_ddpm_text_T_vqganfin_oldcanvas_tile is 1280 and for images below 1280 we usually use sr_val_ddpm_text_T_vqganfin_oldcanvas w/o tiling. You may either adjust the default tiling size in sr_val_ddpm_text_T_vqganfin_oldcanvas_tile or try sr_val_ddpm_text_T_vqganfin_oldcanvas.

zcdliuwei commented 3 months ago

Hi. Sry for the late reply since I am quite busy recently. It seems like a size checking problem since the default tile size of sr_val_ddpm_text_T_vqganfin_oldcanvas_tile is 1280 and for images below 1280 we usually use sr_val_ddpm_text_T_vqganfin_oldcanvas w/o tiling. You may either adjust the default tiling size in sr_val_ddpm_text_T_vqganfin_oldcanvas_tile or try sr_val_ddpm_text_T_vqganfin_oldcanvas.

Thank you for your kind reply I will give it a try soon