stable-diffusion-webui
stable-diffusion-webui copied to clipboard
LDSR Upscale producing black bars
Describe the bug When upscaling an image with LDSR or with a combination of LDSR and another upscaler the final image has "missing tiles". They are completely black when just using LDSR and semi black when using a combination.
To Reproduce Steps to reproduce the behavior:
- Go to extras
- Load an image
- Select LDSR as upscaler 1
- Generate and see error
Expected behavior The day before yesterday LDSR was working fine, so it might be a commit from the last two days.
Desktop (please complete the following information):
- OS: Ubuntu 22.04
- Browser: Firefox
- Commit revision: cccc5a20fce4bde9a4299f8790366790735f1d05
Did you use the "Scale to" option or the "Scale by" option?
Simple scale by 2x. You can still see remnants of the original picture behind the black bar on the picture that I posted. So not related to another aspect ratio.
What were the dimensions of the src image. I notice the black bar when the "downscale" resolution/aspect ratio doesn't align with my source, for example, if I give it an image that is 16:9 I'll get a bar along the bottom.
Add --no-half-vae
to your command line arguments in webui-user.bat
Add
--no-half-vae
to your command line arguments in webui-user.bat
Nope, still getting a black bar.
What were the dimensions of the src image. I notice the black bar when the "downscale" resolution/aspect ratio doesn't align with my source, for example, if I give it an image that is 16:9 I'll get a bar along the bottom.
Original: 704x512 -> Upscaled: 1408x1024
Can confirm that this happens with me too. Running with --no-half-vae and "scale by 2" LDSR
Desktop (please complete the following information):
OS: Win11 Browser: Chrome GPU: 2080
Add
--no-half-vae
to your command line arguments in webui-user.batNope, still getting a black bar.
What were the dimensions of the src image. I notice the black bar when the "downscale" resolution/aspect ratio doesn't align with my source, for example, if I give it an image that is 16:9 I'll get a bar along the bottom.
Original: 704x512 -> Upscaled: 1408x1024
Pretty sure LDSR only works correctly with images that, like SD, are a factor of 64. Downloading an image from the internet that's already a non-standard resolution seems to be the issue in every case of this that I've seen, my own included.
SD really does not like resolutions that aren't a factor of 64 on either axis.
I suppose it could be made to automatically crop the input images. Would be a bit more convenient than doing so in Krita.
Add
--no-half-vae
to your command line arguments in webui-user.batNope, still getting a black bar.
What were the dimensions of the src image. I notice the black bar when the "downscale" resolution/aspect ratio doesn't align with my source, for example, if I give it an image that is 16:9 I'll get a bar along the bottom.
Original: 704x512 -> Upscaled: 1408x1024
Pretty sure LDSR only works correctly with images that, like SD, are a factor of 64. Downloading an image from the internet that's already a non-standard resolution seems to be the issue in every case of this that I've seen, my own included.
SD really does not like resolutions that aren't a factor of 64 on either axis.
Image was generated in SD and 704/512 are both divisible by 64. But I tested 768x512 to be sure and weirdly I get a clean output without a black bar. So its definitely input resolution related.
reproducible in the current release 695377a8b9f7de28b880d96487a9ddf7230cff14
I noticed that black bars appear if the input image dimensions are not divisible by 128. I assume this happens because it is first downsampled to half of the original dimensions and than it is working with an image that is not divisible by 64. Tested with 512x832 - get the black bar at the bottom. 512x512 and 512x768 are properly upscaled. Is there a way to turn off the downsampling pass?
Changing down_sample_rate = target_scale / 4
to down_sample_rate = target_scale / 2
in ldsr_model_arch.py worked as it no longer produces a black bar on 512x832 input image with 2x upscale in extras tab, but it broke SD upscale in img2img tab as I'm getting HIP out of memory
when trying to upscale at target resolution. Not unexpected though.
Changing
down_sample_rate = target_scale / 4
todown_sample_rate = target_scale / 2
in ldsr_model_arch.py worked as it no longer produces a black bar on 512x832 input image with 2x upscale in extras tab, but it broke SD upscale in img2img tab as I'm gettingHIP out of memory
when trying to upscale at target resolution. Not unexpected though.
Confirmed this works for SD upscaling a 768x576 image. It took a very long time (15+ minutes on a 1080ti), so I'll probably leave it how it was and try to avoid images that aren't divisible by 128, but it's good to know that I can use LDSR on any of my old gens. Thanks for the info
it is still occurring. It is happening with different models and different sampler method. Sampling method Euler a, Euler, LMS .., Sampling Steps 100, Denoising strength 0.05, upscaler: None, Lanczos, R-ESRGAN 4x+, LDSR,
Closing as stale.