diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Add support for Outpainting with SDXL

Open DN6 opened this issue 2 years ago • 5 comments

SDXL for Outpainting functionality can be improved. Attached are some attempts at Outpainting with StableDiffusionXLInpaintPipeline and stabilityai/stable-diffusion-xl-base-1.0 checkpoint.

Given this image/mask combination ((black pixels ignored and white pixels are to be filled)

and the prompt A girl sitting in a library full of books, the pipeline produces the following images

The pipeline is filling in details in the masked area that is related to the prompt, but doesn't seem to make any use of the image provided (the masked area is filled independently of the image content). This is likely due to the fact that the base SDXL UNet is not conditioned on outpainting masks and the pipeline relies on an approximation to perform inpainting/outpainting:

https://github.com/huggingface/diffusers/blob/87ae330056f6942817656c8f7146283e90cf986b/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py#L1318-L1328

A UNet that accepts Mask Latents in the channels dimension should fix the issue.

I've attached a Colab Notebook here to test Outpainting: https://colab.research.google.com/gist/DN6/a94626ac9e062f2ff1cc31b8bc2f72ed/sdxl_outpainting.ipynb

DN6 avatar Aug 22 '23 16:08 DN6

PR: #4746 Should be able to address the issues mentioned above.

DN6 avatar Aug 28 '23 13:08 DN6

The above example is an inpainting pipeline, but a non-inpainting ckpt/weights, so this is the results I would expect. Have you tried diffusers/stable-diffusion-xl-1.0-inpainting-0.1 ?

reimager avatar Sep 15 '23 17:09 reimager

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Oct 18 '23 15:10 github-actions[bot]

book_land

If you use the checkpoint reimager mentions you can get results like this! Thanks reimager.

relh avatar Mar 05 '24 22:03 relh

@relh what is reimager? can you share a code example how do you get this result?

yiyixuxu avatar Mar 09 '24 04:03 yiyixuxu

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Apr 02 '24 15:04 github-actions[bot]