update README
parent
a7a615f9a3
commit
bbbce13558
|
|
@ -5,8 +5,8 @@
|
|||
- Revert Sampler **Hook** *(`internal`)*
|
||||
|
||||
### v2.0.alpha - 2024 Feb.29
|
||||
- Removed **LFS** *(`GitHub`)*
|
||||
- Changed Sampler **Hook** *(`internal`)*
|
||||
- Removed **LFS** *(`GitHub`)*
|
||||
|
||||
### v1.5.1 - 2023 Dec.03
|
||||
- Bug Fix by. **catboxanon**
|
||||
|
|
|
|||
67
README.md
67
README.md
|
|
@ -1,8 +1,8 @@
|
|||
# SD Webui Vectorscope CC
|
||||
This is an Extension for the [Automatic1111 Webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui), which performs a kind of **Offset Noise**[*](#offset-noise-tldr) natively,
|
||||
This is an Extension for the [Automatic1111 Webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui), which performs a kind of **Offset Noise** natively,
|
||||
allowing you to adjust the brightness, contrast, and color of the generations.
|
||||
|
||||
> Also compatible with [Forge](https://github.com/lllyasviel/stable-diffusion-webui-forge) !
|
||||
> Also compatible with [Forge](https://github.com/lllyasviel/stable-diffusion-webui-forge)!
|
||||
|
||||
**Important:** The color currently only works for **SD 1.5** Checkpoints
|
||||
|
||||
|
|
@ -61,17 +61,15 @@ Refer to the parameters and sample images below and play around with the values.
|
|||
- To save a Style, enter a name in the `Textbox` then click **Save Style**
|
||||
- To delete a Style, enter the name in the `Textbox` then click **Delete Style**
|
||||
- *Deleted Style is still in the `styles.json` in case you wish to retrieve it*
|
||||
- Click **Refresh Style** to update the `Dropdown` if you edited the `styles.json` directly
|
||||
- Click **Refresh Style** to update the `Dropdown` if you edited the `styles.json` manually
|
||||
|
||||
#### Advanced Settings
|
||||
- **Process Hires. fix:** By default, this Extension only functions during the **txt2img** phase, so that **Hires. fix** may "fix" the artifacts introduced during **txt2img**. Enable this to process **Hires. fix** phase too.
|
||||
- This option does not affect **img2img**
|
||||
|
||||
##### Noise Settings
|
||||
#### Noise Settings
|
||||
> let `x` denote the Tensor ; let `y` denote the operations
|
||||
|
||||
<!-- "Straight", "Straight Abs.", "Cross", "Cross Abs.", "Ones", "N.Random", "U.Random", "Multi-Res", "Multi-Res Abs." -->
|
||||
|
||||
- **Straight:** All operations are calculated on the same Tensor
|
||||
- `x += x * y`
|
||||
- **Cross:** All operations are calculated on the Tensor opposite of the `Alt.` setting
|
||||
|
|
@ -90,10 +88,10 @@ Refer to the parameters and sample images below and play around with the values.
|
|||
<p align="center"><img src="samples/Bright.jpg" width=768></p>
|
||||
<p align="center"><img src="samples/Dark.jpg" width=768></p>
|
||||
|
||||
##### Scaling Settings
|
||||
Previously, this Extension offsets the noise by the same amount each step.
|
||||
#### Scaling Settings
|
||||
By default, this Extension offsets the noise by the same amount each step.
|
||||
But due to the denoising process, this may produce undesired outcomes such as blurriness at high **Brightness** or noises at low **Brightness**.
|
||||
Thus, I added a scaling option to modify the offset amount.
|
||||
Therefore, I added a scaling option to modify the offset amount throughout the process.
|
||||
|
||||
> Essentially, the "magnitude" of the default Tensor gets smaller every step, so offsetting by the same amount will have stronger effects at later steps. This is reversed on the `Alt.` Tensor however.
|
||||
|
||||
|
|
@ -162,14 +160,13 @@ Thus, I added a scaling option to modify the offset amount.
|
|||
- [X] Extension Released
|
||||
- [X] Add Support for **X/Y/Z Plot**
|
||||
- [X] Implement different **Noise** functions
|
||||
- [X] Add **Randomize** functions
|
||||
- [X] Append Parameters onto Metadata
|
||||
- You can enable this in the **Infotext** section of the **Settings** tab
|
||||
- [X] Add **Randomize** button
|
||||
- [X] **Style** Presets
|
||||
- [X] Implement **Color Wheel** & **Color Picker**
|
||||
- [X] Implement better scaling algorithms
|
||||
- [X] Fix the **Brightness** issues *~~kinda~~*
|
||||
- [X] Add API Docs
|
||||
- [X] Append Parameters onto Metadata
|
||||
- You can enable this in the **Infotext** section of the **Settings** tab
|
||||
- [X] Add Infotext Support *(by. [catboxanon](https://github.com/catboxanon))*
|
||||
- [X] ADD **HDR** Script
|
||||
- [ ] Add Gradient features
|
||||
|
|
@ -183,15 +180,24 @@ Thus, I added a scaling option to modify the offset amount.
|
|||
<p align="center">The value is used as the random seed<br>You can refer to the console to see the randomized values</p>
|
||||
|
||||
## API
|
||||
You can use this Extension via [API](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API) by adding an entry in the `alwayson_scripts` of your payload.
|
||||
You can use this Extension via [API](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API) by adding an entry to the `alwayson_scripts` of your payload.
|
||||
An [example](samples/api_example.json) is provided.
|
||||
The `args` are sent in the following order:
|
||||
The `args` are sent in the following order in an `array`:
|
||||
|
||||
- **[Enable, Alt, Brightness, Contrast, Saturation, R, G, B, Process Hires. Fix, Noise Settings, Scaling Settings]**
|
||||
> `bool`, `bool`, `float`, `float`, `float`, `float`, `float`, `float`, `bool`, `str`, `str`
|
||||
- **Enable:** `bool`
|
||||
- **Alt:** `bool`
|
||||
- **Brightness:** `float`
|
||||
- **Contrast:** `float`
|
||||
- **Saturation:** `float`
|
||||
- **R:** `float`
|
||||
- **G:** `float`
|
||||
- **B:** `float`
|
||||
- **Process Hires. Fix:** `bool`
|
||||
- **Noise Settings:** `str`
|
||||
- **Scaling Settings:** `str`
|
||||
|
||||
## Known Issues
|
||||
- Does not work with `DDIM`, `UniPC` samplers
|
||||
- Does **not** work with `DDIM`, `UniPC` samplers
|
||||
- Has little effect when used with certain **LoRA**s
|
||||
- Colors are incorrect when using SDXL checkpoints
|
||||
|
||||
|
|
@ -203,19 +209,21 @@ The `args` are sent in the following order:
|
|||
- In the **Script** `Dropdown` at the bottom, there is now a new option: **`High Dynamic Range`**
|
||||
- This script will generate multiple images *("Brackets")* of varying brightness, then merge them into 1 HDR image
|
||||
- *Do provide feedback in the thread!*
|
||||
- **Highly Recommended** to use a deterministic sampler and high enough steps. `Euler` *(**not** `Euler a`)* worked the best in my experience.
|
||||
- **Highly Recommended** to use a deterministic sampler and high enough steps. `Euler` *(**not** `Euler a`)* worked well in my experience.
|
||||
|
||||
#### Settings
|
||||
- **Brackets:** The numer of images to generate
|
||||
- **Gaps:** The brightness difference between each image
|
||||
- **Automatically Merge:** When enabled, this will merge the images using a `OpenCV` algorithm and save to the `HDR` folder in the `outputs` folder; When disabled, this will return all images to the result section, for when you have a more advanced program such as Photoshop to do the merging.
|
||||
- **Automatically Merge:** When enabled, this will merge the images using an `OpenCV` algorithm and save to the `HDR` folder in the `outputs` folder; When disabled, this will return all images to the result section, for when you have a more advanced program such as Photoshop to do the merging.
|
||||
- All the images are still saved to the `outputs` folder regardless
|
||||
|
||||
<hr>
|
||||
|
||||
### Offset Noise TL;DR
|
||||
<details>
|
||||
<summary>Offset Noise TL;DR</summary>
|
||||
|
||||
The most common *version* of **Offset Noise** you may have heard of is from this [blog post](https://www.crosslabs.org/blog/diffusion-with-offset-noise),
|
||||
where it was discovered that the noise functions used during **training** were flawed, causing `Stable Diffusion` to always generate images with an average of `0.5`.
|
||||
where it was discovered that the noise functions used during **training** were flawed, causing `Stable Diffusion` to always generate images with an average of `0.5` *(**ie.** grey)*.
|
||||
|
||||
> **ie.** Even if you prompt for dark/night or bright/snow, the overall image still looks "grey"
|
||||
|
||||
|
|
@ -223,11 +231,11 @@ where it was discovered that the noise functions used during **training** were f
|
|||
|
||||
However, this Extension instead tries to offset the latent noise during the **inference** phase.
|
||||
Therefore, you do not need to use models that were specially trained, as this can work on any model.
|
||||
Though, the results may not be as good as using properly trained models.
|
||||
</details>
|
||||
|
||||
<hr>
|
||||
<details>
|
||||
<summary>How does this work?</summary>
|
||||
|
||||
### What is Under the Hood
|
||||
After reading through and messing around with the code,
|
||||
I found out that it is possible to directly modify the Tensors
|
||||
representing the latent noise used by the Stable Diffusion process.
|
||||
|
|
@ -242,15 +250,16 @@ Then, I tried to play around with the values of each channel and ended up discov
|
|||
Essentially, the 4 channels correspond to the **CMYK** color format,
|
||||
hence why you can control the brightness as well as the colors.
|
||||
|
||||
</details>
|
||||
|
||||
<hr>
|
||||
|
||||
### Vectorscope?
|
||||
#### Vectorscope?
|
||||
The Extension is named this way because the color interactions remind me of the `Vectorscope` found in **Premiere Pro**'s **Lumetri Color**.
|
||||
Those who are experienced in Color Correction should be rather familiar with this Extension.
|
||||
|
||||
<p align="center"><img src="scripts/Vectorscope.png" width=256></p>
|
||||
|
||||
<hr>
|
||||
<sup>~~Yes. I'm aware that it's just how digital colors work in general.~~</sup>
|
||||
|
||||
<sup>~~Yes. I'm aware that it's just how digital colors work in general.~~<br>
|
||||
~~We've come full **circle** *(\*ba dum tss)* now that a Color Wheel is actually added.~~</sup>
|
||||
<sup>~~We've come full **circle** *(\*ba dum tss)* now that a Color Wheel is actually added.~~</sup>
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
"args": [
|
||||
true,
|
||||
true,
|
||||
-2.5,
|
||||
0.5,
|
||||
-2.0,
|
||||
1.5,
|
||||
1.25,
|
||||
0.0,
|
||||
0.0,
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
from modules.sd_samplers_kdiffusion import KDiffusionSampler
|
||||
from modules import shared
|
||||
|
||||
import modules.scripts as scripts
|
||||
import gradio as gr
|
||||
import random
|
||||
from modules import shared, scripts
|
||||
|
||||
from scripts.cc_colorpicker import create_colorpicker
|
||||
from scripts.cc_style import StyleManager
|
||||
from scripts.cc_xyz import xyz_support
|
||||
import scripts.cc_const as const
|
||||
|
||||
style_manager = StyleManager()
|
||||
style_manager.load_styles()
|
||||
import gradio as gr
|
||||
import random
|
||||
|
||||
|
||||
VERSION = 'v2.0.0'
|
||||
|
||||
|
||||
style_manager = StyleManager()
|
||||
style_manager.load_styles()
|
||||
|
||||
|
||||
class VectorscopeCC(scripts.Script):
|
||||
def __init__(self):
|
||||
self.xyzCache = {}
|
||||
|
|
@ -29,9 +29,10 @@ class VectorscopeCC(scripts.Script):
|
|||
return scripts.AlwaysVisible
|
||||
|
||||
def ui(self, is_img2img):
|
||||
mode = ("img" if is_img2img else "txt")
|
||||
m = f"\"{mode}\""
|
||||
|
||||
with gr.Accordion(f"Vectorscope CC {VERSION}", elem_id=f"vec-cc-{'img' if is_img2img else 'txt'}", open=False):
|
||||
m = ("\"img\"" if is_img2img else "\"txt\"")
|
||||
with gr.Accordion(f"Vectorscope CC {VERSION}", elem_id=f"vec-cc-{mode}", open=False):
|
||||
|
||||
with gr.Row():
|
||||
enable = gr.Checkbox(label="Enable")
|
||||
|
|
@ -44,9 +45,9 @@ class VectorscopeCC(scripts.Script):
|
|||
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
r = gr.Slider(label="R", info='Cyan | Red', minimum=const.COLOR.minimum, maximum=const.COLOR.maximum, step=0.05, value=const.COLOR.default, elem_id=f"cc-r-{'img' if is_img2img else 'txt'}")
|
||||
g = gr.Slider(label="G", info='Magenta | Green',minimum=const.COLOR.minimum, maximum=const.COLOR.maximum, step=0.05, value=const.COLOR.default, elem_id=f"cc-g-{'img' if is_img2img else 'txt'}")
|
||||
b = gr.Slider(label="B", info='Yellow | Blue',minimum=const.COLOR.minimum, maximum=const.COLOR.maximum, step=0.05, value=const.COLOR.default, elem_id=f"cc-b-{'img' if is_img2img else 'txt'}")
|
||||
r = gr.Slider(label="R", info='Cyan | Red', minimum=const.COLOR.minimum, maximum=const.COLOR.maximum, step=0.05, value=const.COLOR.default, elem_id=f"cc-r-{mode}")
|
||||
g = gr.Slider(label="G", info='Magenta | Green',minimum=const.COLOR.minimum, maximum=const.COLOR.maximum, step=0.05, value=const.COLOR.default, elem_id=f"cc-g-{mode}")
|
||||
b = gr.Slider(label="B", info='Yellow | Blue',minimum=const.COLOR.minimum, maximum=const.COLOR.maximum, step=0.05, value=const.COLOR.default, elem_id=f"cc-b-{mode}")
|
||||
|
||||
r.input(None, [r, g, b], None, _js=f'(r, g, b) => {{ VectorscopeCC.updateCursor(r, g, b, {m}); }}')
|
||||
g.input(None, [r, g, b], None, _js=f'(r, g, b) => {{ VectorscopeCC.updateCursor(r, g, b, {m}); }}')
|
||||
|
|
@ -58,12 +59,12 @@ class VectorscopeCC(scripts.Script):
|
|||
|
||||
with gr.Row():
|
||||
style_choice = gr.Dropdown(label="Styles", choices=style_manager.list_style(), scale = 3)
|
||||
apply_btn = gr.Button(value="Apply Style", elem_id=f"cc-apply-{'img' if is_img2img else 'txt'}", scale = 2)
|
||||
apply_btn = gr.Button(value="Apply Style", elem_id=f"cc-apply-{mode}", scale = 2)
|
||||
refresh_btn = gr.Button(value="Refresh Style", scale = 2)
|
||||
|
||||
with gr.Row():
|
||||
style_name = gr.Textbox(label="Style Name", scale = 3)
|
||||
save_btn = gr.Button(value="Save Style", elem_id=f"cc-save-{'img' if is_img2img else 'txt'}", scale = 2)
|
||||
save_btn = gr.Button(value="Save Style", elem_id=f"cc-save-{mode}", scale = 2)
|
||||
delete_btn = gr.Button(value="Delete Style", scale = 2)
|
||||
|
||||
apply_btn.click(fn=style_manager.get_style, inputs=style_choice, outputs=[latent, bri, con, sat, r, g, b]).then(None, [r, g, b], None, _js=f'(r, g, b) => {{ VectorscopeCC.updateCursor(r, g, b, {m}); }}')
|
||||
|
|
@ -222,7 +223,7 @@ class VectorscopeCC(scripts.Script):
|
|||
p.extra_generation_params['Vec CC Version'] = VERSION
|
||||
|
||||
# Decouple from Steps
|
||||
scale:int = 10
|
||||
scale:int = 16
|
||||
|
||||
bri /= scale
|
||||
con /= scale
|
||||
|
|
|
|||
Loading…
Reference in New Issue