Removed Skip

use the scaling settings instead
pull/19/head
Haoming 2023-11-01 17:42:34 +08:00
parent c00b03c4e7
commit 4b536edb18
7 changed files with 14 additions and 30 deletions

View File

@ -1,3 +1,6 @@
### v1.4.7 - 2023 Nov.01
- Removed **Skip** parameter
### v1.4.6 - 2023 Sep.19 ### v1.4.6 - 2023 Sep.19
- Add **HDR** Script - Add **HDR** Script

View File

@ -13,8 +13,6 @@ Refer to the parameters and sample images below and play around with the values.
#### Parameters #### Parameters
- **Enable:** Turn on/off this Extension - **Enable:** Turn on/off this Extension
- **Alt:** Modify an alternative Tensor instead, causing the effects to be significantly stronger - **Alt:** Modify an alternative Tensor instead, causing the effects to be significantly stronger
- **Skip:** Skip the last percentage of steps and only process the first few steps
- *Not as useful now since you can tune the [Scaling Settings](#scaling-settings) instead*
- **Brightness:** Adjust the overall brightness of the image - **Brightness:** Adjust the overall brightness of the image
- **Contrast:** Adjust the overall contrast of the image - **Contrast:** Adjust the overall contrast of the image
- **Saturation:** Adjust the overall saturation of the image - **Saturation:** Adjust the overall saturation of the image
@ -184,8 +182,8 @@ You can use this Extension via [API](https://github.com/AUTOMATIC1111/stable-dif
An [example](samples/api_example.json) is provided. An [example](samples/api_example.json) is provided.
The `args` are sent in the following order: The `args` are sent in the following order:
- **[Enable, Alt, Brightness, Contrast, Saturation, R, G, B, Skip, Process Hires. Fix, Noise Settings, Scaling Settings]** - **[Enable, Alt, Brightness, Contrast, Saturation, R, G, B, Process Hires. Fix, Noise Settings, Scaling Settings]**
> `bool`, `bool`, `float`, `float`, `float`, `float`, `float`, `float`, `float`, `bool`, `str`, `str` > `bool`, `bool`, `float`, `float`, `float`, `float`, `float`, `float`, `bool`, `str`, `str`
## Known Issues ## Known Issues
- Does not work with `DDIM`, `UniPC` samplers - Does not work with `DDIM`, `UniPC` samplers

View File

@ -15,9 +15,8 @@
true, true,
true, true,
-2.5, -2.5,
0.5,
1.25, 1.25,
1.25,
0.0,
0.0, 0.0,
0.0, 0.0,
0.0, 0.0,
@ -27,4 +26,4 @@
] ]
} }
} }
} }

View File

@ -43,8 +43,7 @@ class VectorscopeCC(scripts.Script):
with gr.Row(): with gr.Row():
enable = gr.Checkbox(label="Enable") enable = gr.Checkbox(label="Enable")
latent = gr.Checkbox(label="Alt.") latent = gr.Checkbox(label="Alt. (Stronger Effects)")
early = gr.Slider(label="Skip", minimum=0.0, maximum=1.0, step=0.1, value=0.0)
with gr.Row(): with gr.Row():
bri = gr.Slider(label="Brightness", minimum=-6.0, maximum=6.0, step=0.1, value=0.0) bri = gr.Slider(label="Brightness", minimum=-6.0, maximum=6.0, step=0.1, value=0.0)
@ -86,7 +85,7 @@ class VectorscopeCC(scripts.Script):
with gr.Row(): with gr.Row():
reset_btn = gr.Button(value="Reset") reset_btn = gr.Button(value="Reset")
self.register_reset(reset_btn, enable, latent, bri, con, sat, early, r, g, b, doHR, method, scaling) self.register_reset(reset_btn, enable, latent, bri, con, sat, r, g, b, doHR, method, scaling)
random_btn = gr.Button(value="Randomize") random_btn = gr.Button(value="Randomize")
self.register_random(random_btn, bri, con, sat, r, g, b) self.register_random(random_btn, bri, con, sat, r, g, b)
@ -96,7 +95,6 @@ class VectorscopeCC(scripts.Script):
self.infotext_fields = [ self.infotext_fields = [
(enable, lambda d: enable.update(value=("Vec CC Enabled" in d))), (enable, lambda d: enable.update(value=("Vec CC Enabled" in d))),
(latent, "Vec CC Alt"), (latent, "Vec CC Alt"),
(early, "Vec CC Skip"),
(bri, "Vec CC Brightness"), (bri, "Vec CC Brightness"),
(con, "Vec CC Contrast"), (con, "Vec CC Contrast"),
(sat, "Vec CC Saturation"), (sat, "Vec CC Saturation"),
@ -111,12 +109,12 @@ class VectorscopeCC(scripts.Script):
for _, name in self.infotext_fields: for _, name in self.infotext_fields:
self.paste_field_names.append(name) self.paste_field_names.append(name)
return [enable, latent, bri, con, sat, early, r, g, b, doHR, method, scaling] return [enable, latent, bri, con, sat, r, g, b, doHR, method, scaling]
def register_reset(self, reset_btn, enable, latent, bri, con, sat, early, r, g, b, doHR, method, scaling): def register_reset(self, reset_btn, enable, latent, bri, con, sat, r, g, b, doHR, method, scaling):
for component in [enable, latent, doHR]: for component in [enable, latent, doHR]:
reset_btn.click(fn=lambda _: gr.update(value=False), outputs=component) reset_btn.click(fn=lambda _: gr.update(value=False), outputs=component)
for component in [early, bri, con, r, g, b]: for component in [bri, con, r, g, b]:
reset_btn.click(fn=lambda _: gr.update(value=0.0), outputs=component) reset_btn.click(fn=lambda _: gr.update(value=0.0), outputs=component)
for component in [sat]: for component in [sat]:
reset_btn.click(fn=lambda _: gr.update(value=1.0), outputs=component) reset_btn.click(fn=lambda _: gr.update(value=1.0), outputs=component)
@ -138,7 +136,7 @@ class VectorscopeCC(scripts.Script):
raise ValueError(f"Invalid Value: {string}") raise ValueError(f"Invalid Value: {string}")
def process(self, p, enable:bool, latent:bool, bri:float, con:float, sat:float, early:float, r:float, g:float, b:float, doHR:bool, method:str, scaling:str): def process(self, p, enable:bool, latent:bool, bri:float, con:float, sat:float, r:float, g:float, b:float, doHR:bool, method:str, scaling:str):
if 'Enable' in self.xyzCache.keys(): if 'Enable' in self.xyzCache.keys():
enable = self.parse_bool(self.xyzCache['Enable']) enable = self.parse_bool(self.xyzCache['Enable'])
@ -169,8 +167,6 @@ class VectorscopeCC(scripts.Script):
con = v con = v
case 'Saturation': case 'Saturation':
sat = v sat = v
case 'Skip':
early = v
case 'R': case 'R':
r = v r = v
case 'G': case 'G':
@ -196,8 +192,6 @@ class VectorscopeCC(scripts.Script):
if not hasattr(p, 'enable_hr') and hasattr(p, 'denoising_strength') and not shared.opts.img2img_fix_steps: if not hasattr(p, 'enable_hr') and hasattr(p, 'denoising_strength') and not shared.opts.img2img_fix_steps:
steps = int(steps * p.denoising_strength) steps = int(steps * p.denoising_strength)
stop = steps * (1.0 - early)
if cc_seed is not None: if cc_seed is not None:
random.seed(cc_seed) random.seed(cc_seed)
@ -217,13 +211,9 @@ class VectorscopeCC(scripts.Script):
print(f'G:\t\t{g}') print(f'G:\t\t{g}')
print(f'B:\t\t{b}\n') print(f'B:\t\t{b}\n')
if stop < 1:
return p
if hasattr(shared.opts, 'cc_metadata') and shared.opts.cc_metadata is True: if hasattr(shared.opts, 'cc_metadata') and shared.opts.cc_metadata is True:
p.extra_generation_params['Vec CC Enabled'] = enable p.extra_generation_params['Vec CC Enabled'] = enable
p.extra_generation_params['Vec CC Alt'] = latent p.extra_generation_params['Vec CC Alt'] = latent
p.extra_generation_params['Vec CC Skip'] = early
p.extra_generation_params['Vec CC Brightness'] = bri p.extra_generation_params['Vec CC Brightness'] = bri
p.extra_generation_params['Vec CC Contrast'] = con p.extra_generation_params['Vec CC Contrast'] = con
p.extra_generation_params['Vec CC Saturation'] = sat p.extra_generation_params['Vec CC Saturation'] = sat
@ -266,9 +256,6 @@ class VectorscopeCC(scripts.Script):
if p.hr_pass == 2: if p.hr_pass == 2:
return og_callback(self, d) return og_callback(self, d)
if d["i"] > stop:
return og_callback(self, d)
source = d[mode] source = d[mode]
# "Straight", "Straight Abs.", "Cross", "Cross Abs.", "Ones", "N.Random", "U.Random", "Multi-Res", "Multi-Res Abs." # "Straight", "Straight Abs.", "Cross", "Cross Abs.", "Ones", "N.Random", "U.Random", "Multi-Res", "Multi-Res Abs."

View File

@ -65,7 +65,6 @@ class VectorHDR(scripts.Script):
p.scripts.script('vectorscope cc').xyzCache.update({ p.scripts.script('vectorscope cc').xyzCache.update({
'Enable':'True', 'Enable':'True',
'Alt':'True', 'Alt':'True',
'Skip': 0,
'Brightness': 0, 'Brightness': 0,
'DoHR': 'False', 'DoHR': 'False',
'Method': 'Ones', 'Method': 'Ones',
@ -87,7 +86,6 @@ class VectorHDR(scripts.Script):
pc.scripts.script('vectorscope cc').xyzCache.update({ pc.scripts.script('vectorscope cc').xyzCache.update({
'Enable':'True', 'Enable':'True',
'Alt':'True', 'Alt':'True',
'Skip': 0,
'Brightness': brackets[it], 'Brightness': brackets[it],
'DoHR': 'False', 'DoHR': 'False',
'Method': 'Ones', 'Method': 'Ones',

View File

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

View File

@ -25,7 +25,6 @@ def xyz_support(cache):
extra_axis_options = [ extra_axis_options = [
xyz_grid.AxisOption("[Vec.CC] Enable", str, apply_field("Enable"), choices=choices_bool), xyz_grid.AxisOption("[Vec.CC] Enable", str, apply_field("Enable"), choices=choices_bool),
xyz_grid.AxisOption("[Vec.CC] Alt.", str, apply_field("Alt"), choices=choices_bool), xyz_grid.AxisOption("[Vec.CC] Alt.", str, apply_field("Alt"), choices=choices_bool),
xyz_grid.AxisOption("[Vec.CC] Skip", float, apply_field("Skip")),
xyz_grid.AxisOption("[Vec.CC] Brightness", float, apply_field("Brightness")), xyz_grid.AxisOption("[Vec.CC] Brightness", float, apply_field("Brightness")),
xyz_grid.AxisOption("[Vec.CC] Contrast", float, apply_field("Contrast")), xyz_grid.AxisOption("[Vec.CC] Contrast", float, apply_field("Contrast")),
xyz_grid.AxisOption("[Vec.CC] Saturation", float, apply_field("Saturation")), xyz_grid.AxisOption("[Vec.CC] Saturation", float, apply_field("Saturation")),