Implement Metadata

Added an option to append parameters into generation
pull/8/head
Haoming 2023-07-08 20:33:28 +08:00
parent 75fa0bc0ac
commit 83f193dda4
7 changed files with 62 additions and 44 deletions

34
CHANGELOG.md Normal file
View File

@ -0,0 +1,34 @@
## v1.3.4 - 2023 Jul.08
- Implement Metadata
## v1.3.3 - 2023 Jul.07
- Bug Fix
## v1.3.2 - 2023 Jul.07
- Implement Color Wheel
## v1.3.1 - 2023 Jul.06
- Bug Fix
## v1.3.0 - 2023 Jul.06
- Implement Style Presets
## v1.2.1 - 2023 Jul.05
- Add Reset & Randomize Functions
## v1.2.0 - 2023 Jul.03
- Implement Multiple Noise Functions
## v1.1.3 - 2023 Jun.26
- Automatically Refresh Sliders
## v1.1.2 - 2023 Jun.23
- Bug Fix
## v1.1.1 - 2023 Jun.22
- Batch Support
## v1.1.0 - 2023 Jun.21
- X/Y/Z Plot Support
## v1.0.0 - 2023 Jun.20
- Extension Released

View File

@ -141,7 +141,8 @@ refer to the parameters and sample images below and play around with the values.
- [ ] Implement a better scaling algorithm
- [ ] Fix the Brightness issues
- [ ] Add Gradient feature
- [ ] Append Parameters onto Metadata
- [X] Append Parameters onto Metadata
- You can enable this in the **Infotext** section of the **Settings** tab
- [X] Implement ~~Color Picker~~ Color Wheel
- [ ] Add Support for **Inpaint**
@ -198,4 +199,5 @@ Those who are experienced in Color Correction should be rather familiar with thi
<p align="center"><img src="samples/Vectorscope.png" width=256></p>
<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>

View File

@ -1,32 +0,0 @@
v1.0.0 - 2023 Jun.20
Extension Released
v1.1.0 - 2023 Jun.21
X/Y/Z Plot Support
v1.1.1 - 2023 Jun.22
Batch Support
v1.1.2 - 2023 Jun.23
Bug Fix
v1.1.3 - 2023 Jun.26
Automatically Refresh Sliders
v1.2.0 - 2023 Jul.03
Implement Multiple Noise Functions
v1.2.1 - 2023 Jul.05
Add Reset & Randomize Functions
v1.3.0 - 2023 Jul.06
Implement Style Presets
v1.3.1 - 2023 Jul.06
Bug Fix
v1.3.2 - 2023 Jul.07
Implement Color Wheel
v1.3.3 - 2023 Jul.07
Bug Fix

View File

@ -4,23 +4,24 @@ from modules import shared
import gradio as gr
import random
from scripts.cc_version import *
from scripts.cc_noise import *
from scripts.cc_style import StyleManager
from scripts.cc_version import VERSION
from scripts.cc_version import clean_outdated
from scripts.cc_colorpicker import create_colorpicker
from scripts.cc_colorpicker import horizontal_js
from scripts.cc_colorpicker import vertical_js
from scripts.cc_style import StyleManager
style_manager = StyleManager()
style_manager.load_styles()
og_callback = KDiffusionSampler.callback_state
class VectorscopeCC(scripts.Script):
def __init__(self):
clean_outdated('cc.py')
style_manager.load_styles()
global og_callback
og_callback = KDiffusionSampler.callback_state
self.xyzCache = {}
self.xyz_support()
@ -228,6 +229,10 @@ class VectorscopeCC(scripts.Script):
if stop < 1:
return p
if shared.opts.cc_metadata and shared.opts.cc_metadata is True:
cc_params = f'Alt: {latent}, Skip: {early}, Brightness: {bri}, Contrast: {con}, Saturation: {sat}, RGB: ({r}, {g}, {b}), Noise: {method}, Proc. Hr.F: {doHR}'
p.extra_generation_params.update({f'Vec. CC [{VERSION}]': cc_params})
bri /= steps
con = pow(con, 1.0 / steps) - 1
sat = pow(sat, 1.0 / steps)
@ -280,7 +285,7 @@ class VectorscopeCC(scripts.Script):
target = gaussian_noise(d[mode])
if 'Abs' in method:
target = abs_cvt(target)
target = to_abs(target)
batchSize = d[mode].size(0)

View File

@ -1,9 +1,12 @@
from modules import devices
import torch
def abs_cvt(latent):
def to_abs(latent):
return torch.abs(latent)
def zeros(latent):
return torch.zeros_like(latent)
def ones(latent):
return torch.ones_like(latent)
@ -18,7 +21,7 @@ def multires_noise(latent, use_zero:bool, iterations=8, discount=0.4):
Reference: https://wandb.ai/johnowhitaker/multires_noise/reports/Multi-Resolution-Noise-for-Diffusion-Model-Training--VmlldzozNjYyOTU2
Credit: Kohya_SS
"""
noise = torch.zeros_like(latent) if use_zero else ones(latent)
noise = zeros(latent) if use_zero else ones(latent)
batchSize = noise.size(0)
height = noise.size(2)

6
scripts/cc_settings.py Normal file
View File

@ -0,0 +1,6 @@
from modules import script_callbacks, shared
def on_ui_settings():
shared.opts.add_option("cc_metadata", shared.OptionInfo(False, "Add Vectorscope CC parameters to generation information", section=("infotext", "Infotext")))
script_callbacks.on_ui_settings(on_ui_settings)

View File

@ -1,7 +1,7 @@
import modules.scripts as scripts
import json
VERSION = 'v1.3.3'
VERSION = 'v1.3.4'
def clean_outdated(EXT_NAME:str):
with open(scripts.basedir() + '/' + 'ui-config.json', 'r') as json_file: