Coyote-A / ultimate-upscale-for-automatic1111

GNU General Public License v3.0
1.66k stars 163 forks source link

images came out segmented with squares/rectengles #111

Open trxsudo opened 1 year ago

trxsudo commented 1 year ago

some of the images came out like its been segmented. its like the whole picture is divided into equal squares/tiles. what did I do wrong? Have I been setting the denoising strength for too much? ( i set mine to 0.4 denoise)

eunnone commented 1 year ago

It appears that the tiles are not being merged properly in the recent webUI update 1.4. There is an extra gap between the tiles. Here's an example comparing them. I reverted back to version 1.3.2 (Jun 24), and it's working fine now. Hope its fixed in webui or here. mermaid1

maxinzheng commented 1 year ago

me too, how to reverted back to version 1.3.2, help me please.

dmzkrsk commented 1 year ago

Using git besect, it looks like this commit broke it https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/1503af60b0550d1a57c95a500df1fe1390178a27

I don't know internals much, so I'm unsure how it broke upscale

Splendide-Imaginarius commented 1 year ago

Hi there, I'm the author of https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/10295, which it sounds like might have inadvertently caused this. I've never used the Ultimate Upscale extension (it looks really cool though -- I'll probably use it now that I know it exists), so I'm not quite sure how to reproduce this on my end. Any chance you could provide an input image and settings for me to reproduce this on my end? Alternatively, if you're willing to try fiddling with the code based on instructions I can provide, maybe your test results can help me figure out what might be wrong.

cian0 commented 1 year ago

Hi there, I'm the author of AUTOMATIC1111/stable-diffusion-webui#10295, which it sounds like might have inadvertently caused this. I've never used the Ultimate Upscale extension (it looks really cool though -- I'll probably use it now that I know it exists), so I'm not quite sure how to reproduce this on my end. Any chance you could provide an input image and settings for me to reproduce this on my end? Alternatively, if you're willing to try fiddling with the code based on instructions I can provide, maybe your test results can help me figure out what might be wrong.

I can't use SD upscale anymore Input image: vlcsnap-2023-05-04-20h57m10s040_2

Output:

image

Basic settings (just changed scale to 4 instead of 2)

image

Splendide-Imaginarius commented 1 year ago

I can't use SD upscale anymore Input image:

@cian0 Can you provide the Git commit hashes of the WebUI that you tried, which worked and didn't work?

eunnone commented 1 year ago

@Splendide-Imaginarius My issue seems to be using ControlNet tile along with Ultimate SD Upscale, which was my preferred workflow for upscaling images.

741bd71873ebb16f61d36e4c8c0e64214501a638 works f9606b8826cb3e0467312c317c4a7b504e2bb6a2 has issues

Img2img No prompts. Model: revAnimated_v122 Sampler 0.6 Denoising Controlnet Tile Selcted, Ultimate SD Upscale with SwinIR Upscaler

Original Image Isssue1

741bd7 -Upscaled 2x 00003-3245978491

f9606b8 - Upscaled 2x 00007-3245978491 0

There seems to be issues at edges of tiles where they merge.

Splendide-Imaginarius commented 1 year ago

Thanks @eunnone, I'll try with those settings and see if I can reproduce it here. It may take me a few days.

Splendide-Imaginarius commented 1 year ago

I can reproduce the issue now; it does indeed appear that 1503af60b0550d1a57c95a500df1fe1390178a27 broke it. I'm not yet sure why that commit broke it; I will investigate further over the next few days. Thanks again to @eunnone for helping me reproduce it.

Jopezzia commented 1 year ago

I can reproduce the issue now; it does indeed appear that 1503af60b0550d1a57c95a500df1fe1390178a27 broke it. I'm not yet sure why that commit broke it; I will investigate further over the next few days. Thanks again to @eunnone for helping me reproduce it.

No, it's not this commit. Somewhere else is a problem. Tried reverting it but the problem didn't go away

Splendide-Imaginarius commented 1 year ago

I can reproduce the issue now; it does indeed appear that 1503af60b0550d1a57c95a500df1fe1390178a27 broke it. I'm not yet sure why that commit broke it; I will investigate further over the next few days. Thanks again to @eunnone for helping me reproduce it.

I have a candidate fix. It definitely fixes the broken behavior that @eunnone described, but I need a few more days to make sure it doesn't break outpainting (which was what 1503af60b0550d1a57c95a500df1fe1390178a27 was originally intended to fix).

No, it's not this commit. Somewhere else is a problem. Tried reverting it but the problem didn't go away

@Jopezzia it wouldn't surprise me if there are multiple bugs somewhere, and 1503af60b0550d1a57c95a500df1fe1390178a27 only caused one of them. After some investigation, I definitely see what's going wrong in 1503af60b0550d1a57c95a500df1fe1390178a27, it's a legit bug. (Also it's subtle enough that I definitely see why it evaded my notice when I wrote that commit, and why it didn't get caught in upstream PR review.)

trxsudo commented 1 year ago

IMG_4858 as I was trying to upscale from the top image to bottom one, there is a clear visable line of dark and light separation on the forehead of the face. its as if only a portion of the face is upscaled. I dont know it has something to do with after detailer or just ultimate upscaler. it completely messed up my upscaling process. im using the lastest version of ultimate upscaler and afterdetailer, and webui is 1.5.1

Splendide-Imaginarius commented 1 year ago

@eunnone Could you please try this branch and let me know how it goes?

https://github.com/Splendide-Imaginarius/stable-diffusion-webui/tree/mask-blur-property

Jopezzia commented 1 year ago

@Splendide-Imaginarius tried your branch now. Everything works) Original image: изображение Master branch: изображение Your branch: изображение

eunnone commented 1 year ago

@Splendide-Imaginarius The pictures don't look broken anymore after the fix. However, there still seems to be a problem with some missing(?) pixels/gap in the merged area, I think. Here's a video showing a small difference between version 1.3.2 and the Fixed version.

https://github.com/Coyote-A/ultimate-upscale-for-automatic1111/assets/49265911/d56291c1-e3bb-40dc-943e-17be0e990a60

1.3.2 upscale is closer to the original image compared to the fixed version. All images and prompts used: https://imgur.com/a/HFD5dNK Anyway The images are usable now. Thank you for your work!

Splendide-Imaginarius commented 1 year ago

Good to hear that we're moving in the right direction. Thanks @eunnone for pointing out the remaining breakage; it tentatively looks like I can reproduce that issue here. I'll see if I can diagnose the cause; may take a few more days.

Splendide-Imaginarius commented 1 year ago

I have a lead on what's causing the remaining breakage; hoping to have a candidate fix ready in a few days.

Splendide-Imaginarius commented 1 year ago

@eunnone Could you give this branch a try? https://github.com/Splendide-Imaginarius/stable-diffusion-webui/tree/mask-blur-property+kernel

eunnone commented 1 year ago

@Splendide-Imaginarius Tested with multiple images. Works flawlessly now. The upscales are identical to the ones in 1.3.2. Thank you for the fix ! :)

Splendide-Imaginarius commented 1 year ago

@eunnone Great, thanks for testing! I'll submit the fix upstream in the next few days.

Splendide-Imaginarius commented 1 year ago

@eunnone Could you confirm whether the upstream dev branch is working properly now? (My branch was merged a few hours ago.)

eunnone commented 1 year ago

@Splendide-Imaginarius Upscales look a bit worse on dev branch. There seems to be some smoothing/blurring. Screenshot 2023-08-12 004325 Screenshot 2023-08-12 002149

I got this controlnet error(?), might not be related

Version: v1.5.1-377-gae6b3090
Commit hash: ae6b30907db2060962c533de79ab4bd2c6b12297
Installing requirements
Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: C:\SD_Auto\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Civitai Helper: No setting file, use default
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 23.7.11, num models: 9
2023-08-12 00:29:42,366 - ControlNet - INFO - ControlNet v1.1.237
ControlNet preprocessor location: C:\SD_Auto\extensions\sd-webui-controlnet\annotator\downloads
2023-08-12 00:29:42,498 - ControlNet - INFO - ControlNet v1.1.237
Loading weights [f8bb2922e1] from C:\SD_Auto\models\Stable-diffusion\revAnimated_v122.safetensors
C:\SD_Auto\extensions\sd-webui-controlnet\scripts\controlnet_ui\controlnet_ui_group.py:167: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row(elem_classes=["cnet-image-row"]).style(equal_height=True):
C:\SD_Auto\extensions\sd-webui-controlnet\scripts\controlnet_ui\controlnet_ui_group.py:181: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  self.generated_image = gr.Image(
Creating model from config: C:\SD_Auto\configs\v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860
Splendide-Imaginarius commented 1 year ago

@eunnone Hmm, interesting. My mask-blur-property+kernel branch is based on dev from July 27, so maybe something else got broken in upstream dev between then and now? Not a lot of time went by since then, so hopefully that's easy to figure out via bisecting. Probably not related to anything I did though. :/

eunnone commented 1 year ago

It seems this commit causing the blur issue.

Test for blur https://imgur.com/a/P9TfAnK (images and prompts)

catboxanon commented 1 year ago

Are you using PLMS, DDIM, or UniPC? If not that's especially concerning. If you can post the original images used and created with PNG info (from both versions if you can) as well as your sysinfo from the settings page I can try looking a bit more into it.

Edit: I see you posted your prompts in https://github.com/Coyote-A/ultimate-upscale-for-automatic1111/issues/111#issuecomment-1663504109. Assuming that's up-to-date I'll see if I can work off that. Since it isn't using one of the aforementioned samplers something certainly seems to have gone wrong.

Edit 2: Can confirm using the commit before the CFG denoiser impl (https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/2a72d76d6f3d34b1ffccec7736b19e7d52033dad) + merged with https://github.com/Splendide-Imaginarius/stable-diffusion-webui/tree/mask-blur-property+kernel, it produces the correct, non-blurry result. Using the same setup but with the commit that breaks it (https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/8285a149d8c488ae6c7a566eb85fb5e825145464) produces the blurry result. I'll see what's causing this exactly now.


Edit 3: Figured it out. There should be a PR shortly.

catboxanon commented 1 year ago

@eunnone Should be fixed as of https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/c1a31ec9f75c8dfe4ddcb0061f06e2704db98359. I can confirm that fixes it on my end. The results are now sharp as they were before.

eunnone commented 1 year ago

@catboxanon Thank you for the fix. Can confirm upscales are working perfectly now.