xinntao / Real-ESRGAN

Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration.
BSD 3-Clause "New" or "Revised" License
27.64k stars 3.47k forks source link

blur_kernel_size option not used in code #66

Open jmhummel opened 3 years ago

jmhummel commented 3 years ago

Hi, I noticed that the blur_kernel_size and blur_kernel_size2 configuration variable are read here: https://github.com/xinntao/Real-ESRGAN/blob/f83472d0113b8af82b5c5dcaa6e5a9dc88e466a7/realesrgan/data/realesrgan_dataset.py#L43

But they are not used when generating the kernel size range to sample from (or anywhere else in the codebase) The range is hardcoded to always sample from [7, 9, ... 19, 21]: https://github.com/xinntao/Real-ESRGAN/blob/f83472d0113b8af82b5c5dcaa6e5a9dc88e466a7/realesrgan/data/realesrgan_dataset.py#L63

xinntao commented 3 years ago

@jmhummel Thanks for reporting this bug. I will fix it later :-)

jmhummel commented 3 years ago

You're welcome. If it helps, I made these changes in my copy so I could modify both the min and max kernel size:

self.blur_kernel_range = opt['blur_kernel_range']
self.kernel_range = list(range(blur_kernel_range[0], blur_kernel_range[1] + 1, 2))

I also updated the YAML configs to use blur_kernel_range: [7, 21], and changed any hard-coded values of 21 to use self.blur_kernel_range[1]