stable-diffusion-webui/scripts
xaedes 33b896d0cb
Scene-to-Image Prompt Layering System (#1179)
# Summary of the change

- new Scene-to-Image tab
- new scn2img function
- functions for loading and running monocular_depth_estimation with
tensorflow

# Description

(relevant motivation, which issue is fixed)

Related to discussion #925

> Would it be possible to have a layers system where we could do have
foreground, mid, and background objects which relate to one another and
share the style? So we could say generate a landscape, one another layer
generate a castle, and on another layer generate a crowd of people.

To make this work I made a prompt-based layering system in a new
"Scene-to-Image" tab.
You write a a multi-line prompt that looks like markdown, where each
section declares one layer.
It is hierarchical, so each layer can have their own child layers.

Examples: https://imgur.com/a/eUxd5qn
![](https://i.imgur.com/L61w00Q.png)

In the frontend you can find a brief documentation for the syntax,
examples and reference for the various arguments.

Here a short summary:

Sections with "prompt" and child layers are img2img, without child
layers they are txt2img.
Without "prompt" they are just images, useful for mask selection, image
composition, etc.
Images can be initialized with "color", resized with "resize" and their
position specified with "pos".
Rotation and rotation center are "rotation" and "center". 

Mask can automatically be selected by color or by estimated depth based
on https://huggingface.co/spaces/atsantiago/Monocular_Depth_Filter.

![](https://i.imgur.com/8rMHWmZ.png)

# Additional dependencies that are required for this change

For mask selection by monocular depth estimation tensorflow is required
and the model must be cloned to ./src/monocular_depth_estimation/
Changes in environment.yaml:
- einops>=0.3.0
- tensorflow>=2.10.0 

Einops must be allowed to be newer for tensorflow to work.

# Checklist:

- [x] I have changed the base branch to `dev`
- [x] I have performed a self-review of my own code
- [x] I have commented my code in hard-to-understand areas
- [x] I have made corresponding changes to the documentation

Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>
2022-10-02 18:23:37 +01:00
..
pipelines/stable_diffusion Add periodic checkpointing 2022-09-23 15:29:08 +01:00
__init__.py Added config.toml file again. 2022-09-26 06:53:14 -07:00
bridgeData_template.py Stable Horde bridge (#1204) 2022-10-02 18:22:27 +01:00
clip_interrogator.py Img2txt dependencies and necessary files. (#1354) 2022-09-28 12:37:15 -07:00
diffusers_textual_inversion_2.py Fix --config args 2022-09-26 23:58:41 -04:00
home.py License header 2022-09-26 14:02:48 +01:00
img2img.py Changed the default output folder to be shorter. 2022-10-02 09:46:30 -07:00
img2txt.py Merge remote-tracking branch 'origin/dev' into dev 2022-10-01 19:19:04 -07:00
imglab.py Changed the default streamlit import for hydralit as we will be using hydralit as replacement for the default streamlit library, hydralit provides better control over css as well as having a lot more options. (#1352) 2022-09-28 09:33:54 -07:00
logger.py Stable Horde bridge (#1204) 2022-10-02 18:22:27 +01:00
merge.py Added implementation of the Concepts Library tab made by @Qualzz. 2022-09-20 21:06:00 -07:00
modeldownload.py License header 2022-09-26 14:02:48 +01:00
ModelManager.py Fixed typo on the model manager 2022-09-30 02:04:32 -07:00
perlin.py when in outcrop mode, mask added regions and fill in with voroni noise for better outpainting 2022-09-09 10:13:38 -04:00
relauncher.py Stable Horde bridge (#1204) 2022-10-02 18:22:27 +01:00
scn2img.py Scene-to-Image Prompt Layering System (#1179) 2022-10-02 18:23:37 +01:00
sd_concept_library.py gallery_v1 2022-10-01 20:14:32 +02:00
sd_concepts_library_downloader.py License header 2022-09-26 14:02:48 +01:00
sd_utils.py Changed the default output folder to be shorter. 2022-10-02 09:46:30 -07:00
Settings.py Improved the Settings page layout and code structure. 2022-10-02 06:59:29 -07:00
stable_diffusion_pipeline.py Moved the model to server_state instead of session_state so it can be shared between multiple sessions, tabs and users as long as the streamlit server is running. 2022-09-25 00:03:05 -07:00
textual_inversion.py Changed the default streamlit import for hydralit as we will be using hydralit as replacement for the default streamlit library, hydralit provides better control over css as well as having a lot more options. (#1352) 2022-09-28 09:33:54 -07:00
txt2img.py Changed the default output folder to be shorter. 2022-10-02 09:46:30 -07:00
txt2vid.py Added LDSR to the UI. 2022-10-01 20:18:09 -07:00
webui_streamlit.py Removed some left over comments on webui_streamlit.py 2022-09-30 02:05:16 -07:00
webui.py Scene-to-Image Prompt Layering System (#1179) 2022-10-02 18:23:37 +01:00