AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.59k stars 26.9k forks source link

[Bug] SCUNet: tiles are visible #12524

Open adegerard opened 1 year ago

adegerard commented 1 year ago

Is there an existing issue for this?

What happened?

Denoise a picture with tiling enabled. input_noisy a11111_denoised_tiles tile size: 256, overlap: 64 a1111_denoised_256_64_tiles

This is a side effect because SCUNet uses local and non-local properties. Tiling is a non sense.

Steps to reproduce the problem

  1. Generate a noisy image or use attached
  2. SCUNet, (upscale=1), set tile size and tile overlap
  3. Denoise

What should have happened?

In fact, this is due to the fact that the SCUNet algo uses local and non-local properties. Tiling is a non sense for SCUNet: refer to the paper.

Version or Commit where the problem happens

68f336b

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

No

List of extensions

No

Console logs

Launching Web UI with arguments: 
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to A:\adegerard\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors

100%|██████████████████████████████████████████████████████████████████| 3.97G/3.97G [01:56<00:00, 36.5MB/s]
Calculating sha256 for A:\adegerard\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors: Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 323.2s (launcher: 196.4s, import torch: 3.3s, import gradio: 1.3s, setup paths: 1.5s, other imports: 1.9s, setup codeformer: 0.1s, list SD models: 117.3s, load scripts: 0.8s, create ui: 0.4s).
6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
Loading weights [6ce0161689] from A:\adegerard\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
Creating model from config: A:\adegerard\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: Doggettx... done.
Model loaded in 6.3s (calculate hash: 3.8s, load weights from disk: 0.1s, create model: 0.4s, apply weights to model: 0.7s, apply half(): 0.6s, move model to device: 0.6s).
Downloading: "https://github.com/cszn/KAIR/releases/download/v1.0/scunet_color_real_gan.pth" to A:\adegerard\stable-diffusion-webui\models\ScuNET\ScuNET.pth

100%|██████████████████████████████████████████████████████████████████| 68.6M/68.6M [00:01<00:00, 36.5MB/s]
ScuNET tiles: 100%|█████████████████████████████████████████████████████████| 24/24 [00:01<00:00, 18.32it/s]
ScuNET tiles: 100%|█████████████████████████████████████████████████████████| 30/30 [00:01<00:00, 17.55it/s]
ScuNET tiles: 100%|█████████████████████████████████████████████████████████| 30/30 [00:01<00:00, 19.98it/s]
ScuNET tiles: 100%|█████████████████████████████████████████████████████████| 30/30 [00:01<00:00, 19.09it/s]
ScuNET tiles: 100%|█████████████████████████████████████████████████████████| 30/30 [00:01<00:00, 18.39it/s]

Additional information

Disable Tiling.

catboxanon commented 1 year ago

Should the options in settings for SCUNet just be removed, and to never use tiling then?

adegerard commented 1 year ago

imho, tiling should not be used with SCUNet, unless someone find a way to remove or reduce these artifacts. Drawback is that an OOM error may occur depending on the image size and the amount of VRAM.

example: with my RTX4080, I can denoise images up to 4096x3277 without oom but it takes so long time. (more than 1 minute). I usually denoise lower images (720x576) without any problem.

I do not know if there a way to detect if an OOM error may occur before running it.

edit: sometimes, this is not noticeable. Maybe set the tiling size by default to 0 and display a (red?) warning when the user enables it.