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

img_range parameter incorrect for BasicSR implementation #6

Open
terrainer opened this issue Jan 29, 2024 · 6 comments
Open

img_range parameter incorrect for BasicSR implementation #6

terrainer opened this issue Jan 29, 2024 · 6 comments

Comments

@terrainer
Copy link

terrainer commented Jan 29, 2024

Hi,

Thank you for your code! This performs very impressively at such fast speeds and low memory usage.
This BasicSR implementation has one major flaw in its img_range parameter. The default value is 255., but a much more suitable value would be 1..

This is because BasicSR normalizes inputs to a range of [0,1]. EDSR, which is seemingly where the 255. value comes from, does not do this, and also does its zero-centering via a much different MeanShift function. You'll notice that any other network with a BasicSR implementation and this same mean/range code, such as SwinIR , uses the value of 1..

Currently, the usage of this value vastly blows up expected ranges of [0,1] or [-0.5, 0.5] to [-127.5, 127.5], causing high instability. Unfortunately, the editing of this parameter also breaks inference for anything expecting img_range to be 255., and so the current official pretrains would not work if inference were to be done with img_range: 1.. They would have to be re-trained with the updated value.

Kind regards,
terrainer

@reddured
Copy link

Could this issue be related to the problem you mentioned ?
#9

@terrainer
Copy link
Author

Could this issue be related to the problem you mentioned ? #9

Very likely to be the case

@reddured
Copy link

I noticed you finetuned some SPAN models yourself (like SPANkendata). Have you managed to correct this issue or at least mitigate pixel artifacts on output image ? It doesn't seem to appear on the comparison shot related to your SPANkendata model (https://github.com/terrainer/AI-Upscaling-Models/blob/main/4xSPANkendata/comparison/Upscale.png). Thanks.

@terrainer
Copy link
Author

terrainer commented Jul 31, 2024 via email

@reddured
Copy link

reddured commented Aug 1, 2024

Do you mean this is fixed in chaiNNer / neosr by using a denoising algorithm on output image (like NLM denoising) ?

@terrainer
Copy link
Author

terrainer commented Aug 7, 2024 via email

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

2 participants