Haoming02 / sd-webui-resharpen

An Extension for Automatic1111 Webui that increases/decreases the details of images
MIT License
70 stars 5 forks source link
stable-diffusion-webui stable-diffusion-webui-plugin

# SD Webui ReSharpen This is an Extension for the Automatic1111 Webui, which allows you to increase or decrease the amount of details of the generation during the Stable Diffusion pipeline.

ie. This is not just a postprocessing filter

How to Use

There is simply a slider that controls the "sharpness" of the images, defaulting to 0.

Though, don't actually use values too close 1 or -1 as it will become distorted

For txt2img, there is also a second slider for the Hires. Fix pass. You can set positive for the normal pass and negative for the hr pass, or vice versa, for some interesting effects.

There is also now a scaling setting, allowing you to adjust the strength throughout the process (eg. lower the sharpness towards the end).

This Extension is disabled during the ADetailer phase

Note: Ancestral samplers (eg. Euler a) do not work. Tested and confirmed to work for both Euler and DPM++ 2M Karras.

Samples

Sharpness -0.5 -0.25 0.0 0.25 0.5
Result

How does it work?

I initially wrote this Extension to try speeding up the Diffusion process. Since the latent noises gradually converges to around 0, I tried to see if I can just add the delta between the current step and the previous step, perhaps multipled by a scaler, to the current Tensor, in order to help it reaches 0 faster. However, after fiddling around for a week, I still couldn't get it to consistently produce an actually better result. So I gave up on the original idea.

Though in the process, I also found out this "sharpening" interaction. If I had to guess, since the Diffusion is a denoising process, if I add the delta again, then it will overly denoise to create a blurry image; if I subtract the delta, then it will basically add the noise back to create a noisy image.

To Do