SDXL moire/dither effect - picture quality
Hello, I love OnnxStream and I think its a great project! Unbelievable that this is made possible!
I just want to ask about the SDXL picture quality - i know that this is not the main point for OnnxStream - but I've noticed in all my generated SDXL images some kind of moire, dither, scanline effect in details, while the rest of the image seems soft. Can this be improved with someting? (parameter, prompts, compiling with different options)
hi,
I noticed this effect too.
If you try to generate an image here:
https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0?text=an+astronaut+riding+a+horse+on+mars
it is possible to notice the same effect, but I think it is less visible since the image is returned as JPEG rather than PNG.
Thanks, Vito
I use SDXL in a1111 and ComfyUI, but only in OnnxStream this effect is clearly visible. Look at the face of this dude.
hi,
the OnnxStream models are exported directly from the Hugging Face SDXL models, so the inference result should be numerically (almost) the same.
But I think I understand what the "problem" is: for a low number of inference steps, dithering appears.
I did a series of tests with this code in a Colab with GPU:
from diffusers import AutoPipelineForText2Image, EulerAncestralDiscreteScheduler
import torch
from IPython.display import Image, display
pipeline = AutoPipelineForText2Image.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
).to("cuda")
pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)
prompt = "a photo of an astronaut riding a horse on mars"
image = pipeline(prompt=prompt, num_inference_steps=10).images[0]
display(image)
in this image, the dithering is present in the lower part, where there is sand:
Vito
Hello Vito, thank you for your response.
You're right, this artifacts also are visible in a1111 generated SDXL images. I noticed, that the SDXL images generated with Onnxstream are less saturated, and therefore the dither effect is more visible at lower steps.
Maybe its the VAE?
For comparing, the right image is generated with Onnxsteam
Hey @lustfeind
Decided to take a look at this myself and I think I found the issue or at least seems to substantially improve the image quality for XL models. Have a look at the pull request below and let me know if this fixes your issue or not https://github.com/vitoplantamura/OnnxStream/pull/50