stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: LDSR altering colors

Open ProgramsArt opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Hi!

It looks like LDSR acts weird upscaling colors now.

If you thoroughly compare the results with another upscaler, like Foolhardy Remacri, you will notice that it lacks detail as before (it is now strangely low detail and flat, almost clipped), and most notably, the amount of saturation increase. Remacri is now upscaling more accurately than LDSR.

I found this in:

-SD Upscale -Upscaling (extras tab)

Unfortunately, I've tried disabling Vae, different samplers, IMG2IMG color correction, DDIM options....

This happens on the "old" stable diff 1.4 and 1.5 (and other custom models as well). I am not using SD 2.0 or x-formers.

Click images to zoom and notice better the new behaviour:

LDSR Oversaturated SD Upscalers Comparison 1 SD Upscalers Comparison 2 Color Comparison Upscalers

Small Gif where I compare the change with a colorchecker:

SD-Upscaler-Comparison

I can put all the parameters to recreate this.

As you can notice, the increased saturation is there and it looks like LDSR now tries even to "vectorize" like those anime upscalers, where before this upscaler used to shine, adding detail where no other could.

What should have happened?

I think colors should be preserved as they were originally, no better, no worse. The final image could look better for some and it may look prettier as Instagram filters do, but upscalers aren't supposed to do that, right?

Apologies If I did something wrong. This was only to show this change in LDSR behaviour.

Thank you all for all your hard work. Thanks a lot!

Commit where the problem happens

Extras Tab Upscalers

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

ProgramsArt avatar Dec 11 '22 19:12 ProgramsArt

Brilliant idea using a colour palette gif to show the problem!

However, after some testing, I'm not sure if the problem is with this repo, or it's just how LDSR works.

What I did was to use the original LDSR upscaler at https://replicate.com/nightmareai/latent-sr, run the flower image through it, and the result still changes the colour saturation.

So perhaps that's how it's supposed to be? (I hope not though)

Original image

Upscaled by the original LDSR upscaler image

wywywywy avatar Dec 11 '22 21:12 wywywywy

So perhaps that's how it's supposed to be? (I hope not though)

You're probably right.

It could probably be due to the dataset used to pre-train this upscaler (strange, but who knows), emphasizing some colors more than others or applying some kind of Post-pro.... But with almost 2GB, it is strange to be almost "beaten"(IMHO) by a 65MB upscaler. This is just my opinion, I could be very wrong.

I still think LDSR is the best, or it was.... Because I am still disappointed with the clipping areas.

I'm going to keep testing results.

Thanks!

ProgramsArt avatar Dec 11 '22 21:12 ProgramsArt

For record keeping, if you update with git pull, you can find the older commit versions you used that had the old ldsr implementation. open a terminal by right clicking in your webui folder and do git reflog to see the list of the older instances you used.

you can install a second webui folder and use that whenever you need, to use it as it was. do a git revert <yourcommithash> to turn your second webui folder into the older version

ClashSAN avatar Dec 12 '22 06:12 ClashSAN

Thank you!

ProgramsArt avatar Dec 12 '22 18:12 ProgramsArt

https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/5644 have been merged, if this resolves your issue, please close it, thanks

aliencaocao avatar Dec 24 '22 06:12 aliencaocao

I realized today that LDSR indeed modifies colors. A grey pixel for example (#666666 RGB 102,102,102) becomes greenish (#686b65 RGB 104,107,101). If I compare an original, to an ESRGAN_4x upscaled (respects colors perfectly), then to the LDSR version, it becomes obvious that LDSR does not respect colors properly for some reason. It does an outstanding job. Blows out of the water Topaz Photo AI. But there's definitely a slight change of tint in the whole image :/ Wonder why that is.

hansolocambo avatar Jan 12 '23 12:01 hansolocambo