I've made an Extension "Anti Burn (average smoothing of last steps images)"! #7464
Replies: 4 comments 4 replies
-
Nice, will give it a try. Nothing more frustrating than seeing a good looking image on the live preview and then the final result seeming worse. |
Beta Was this translation helpful? Give feedback.
-
added to the index |
Beta Was this translation helpful? Give feedback.
-
hello :) tried yesterday your extension and results are nice. |
Beta Was this translation helpful? Give feedback.
-
I've pushed an update addressing this bug: Basically, for some samplers my extension detected two half-steps for each actual step, which means that averaging lied (so you had to set twice the needed count). If somebody had used "slow" samplers (like Heun or SDE), now you will need to lower your Count and Skip values to get result nearly-equal to previous version (or set the compatibility checkbox). Also I've added new "Stop" slider, which aborts the generation right away, but only at the first pass of highres.fix! You can use it to either simulate Skip for lowres pass, or to save time making draft generations (but ensure they will look similar when you'll disable Stop), which especially useful to ancestral unstable samplers. This is how Stop might be used, prompt Steps: 10, Sampler: Heun, CFG scale: 7, Seed: 164395240, Size: 512x512, Model hash: 58c5c27858, Model: suzumehachi_V10, Denoising strength: 0.5, Hires upscale: 2, Hires steps: 20, Hires upscaler: Lanczos The second image was utilizing Stop=9 to drop the last step of first pass. This is how lowres versions look like: You will need to update my extension from WebUI to see new slider. P.S. If somebody will help me at #7907, I'll make it so loading an image made with enabled Anti Burn – will populate correct settings from the generation info. |
Beta Was this translation helpful? Give feedback.
-
Here is the repo: https://github.com/klimaleksus/stable-diffusion-webui-anti-burn
Sometimes, very last step of generation is corrupting the image, and there were a few userscripts that aimed to prevent this by discarding some steps at the end.
Also, there are extensions and userscripts that dump all of intermediate samples to .png files – so it is possible to see, which one was the best.
I thought: what if I take a short chain of images near to the end of generation – and try to average them by simple arithmetic mean? Will this improve overall quality by smoothing out random corrupted details?
Turns out it did! (And even better, if I'll merge the result again with "median" value for each channel).
Then I realized that averaging already rendered images – is worse than averaging their float values right after VAE step. So I've came up with the idea of this extension.
Install it, and you will get a new section in WebUI in txt2img/img2img tabs:
It allows you to:
Example of averaged result, sampler – PLMS with 32 steps, model – DreamShaper 2.52
Original:
Skipping 3 steps and then averaging 3 steps:
More examples are posted on my extension page.
Beta Was this translation helpful? Give feedback.
All reactions