parent
8da191acb5
commit
6baa27b97c
16
README.md
16
README.md
|
|
@ -49,6 +49,10 @@ refer to the parameters and sample images below and play around with the values.
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
#### Buttons
|
||||
- **Reset:** Revert all settings to the default values
|
||||
- **Randomize:** Randomize `Brightness`, `Contrast`, `Saturation`, `R`, `G`, `B`
|
||||
|
||||
#### 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.
|
||||
|
|
@ -72,13 +76,12 @@ refer to the parameters and sample images below and play around with the values.
|
|||
- `x += rand() * y`
|
||||
- **Multi-Res:** All operations are calculated on a Tensor generated with multi-res noise algorithm
|
||||
- `x += multires() * y`
|
||||
- **Abs.:** Calculate using the absolute values of the chosen Tensors instead
|
||||
- **Abs:** Calculate using the absolute values of the chosen Tensors instead
|
||||
- `x += abs(F) * y`
|
||||
|
||||
<p align="center"><img src="samples/Bright.jpg" width=768></p>
|
||||
<p align="center"><img src="samples/Dark.jpg" width=768></p>
|
||||
|
||||
|
||||
## Sample Images
|
||||
- **Checkpoint:** [UHD-23](https://civitai.com/models/22371/uhd-23)
|
||||
- **Pos. Prompt:** `(masterpiece, best quality), 1girl, solo, night, street, city, neon_lights`
|
||||
|
|
@ -124,16 +127,21 @@ refer to the parameters and sample images below and play around with the values.
|
|||
- [X] Extension Released
|
||||
- [X] Add Support for **X/Y/Z Plot**
|
||||
- [X] Implement different Noise functions
|
||||
- [ ] Add Randomize functions
|
||||
- [X] Add Randomize functions
|
||||
- [ ] Implement a better scaling algorithm
|
||||
- [ ] Fix the Brightness issues
|
||||
- [ ] Add Support for **Inpaint**
|
||||
- [ ] Add Gradient feature
|
||||
- [ ] Append Parameters onto Metadata
|
||||
- [ ] Implement Color Picker / Color Wheel
|
||||
- [ ] Add Support for **Inpaint**
|
||||
|
||||
<p align="center"><img src="samples/XYZ.jpg" width=768></p>
|
||||
<p align="center"><code>X/Y/Z Plot Support</code></p>
|
||||
|
||||
<p align="center"><img src="samples/Random.jpg" width=768></p>
|
||||
<p align="center">For <b>Randomize</b> in <code>X/Y/Z Plot</code>, the value is used as the random seed<br>
|
||||
You can refer to the console to see the randomized values</p>
|
||||
|
||||
## Known Issues
|
||||
- Does not work with `DDIM` sampler
|
||||
- Has little effect when used with certain **LoRA**s
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -94,7 +94,8 @@ class VectorscopeCC(scripts.Script):
|
|||
xyz_grid.AxisOption("[Vec.CC] G", float, apply_field("G")),
|
||||
xyz_grid.AxisOption("[Vec.CC] B", float, apply_field("B")),
|
||||
xyz_grid.AxisOption("[Adv.CC] Proc. H.Fix", str, apply_field("DoHR"), choices=choices_bool),
|
||||
xyz_grid.AxisOption("[Adv.CC] Method", str, apply_field("Method"), choices=choices_method)
|
||||
xyz_grid.AxisOption("[Adv.CC] Method", str, apply_field("Method"), choices=choices_method),
|
||||
xyz_grid.AxisOption("[Adv.CC] Randomize", int, apply_field("Random"))
|
||||
]
|
||||
|
||||
xyz_grid.axis_options.extend(extra_axis_options)
|
||||
|
|
@ -127,8 +128,31 @@ class VectorscopeCC(scripts.Script):
|
|||
doHR = gr.Checkbox(label="Process Hires. fix")
|
||||
method = gr.Radio(["Straight", "Straight Abs.", "Cross", "Cross Abs.", "Ones", "N.Random", "U.Random", "Multi-Res", "Multi-Res Abs."], label="Noise Settings", value="Straight Abs.")
|
||||
|
||||
with gr.Row():
|
||||
reset_btn = gr.Button(value="Reset")
|
||||
self.register_reset(reset_btn, enable, latent, bri, con, sat, early, r, g, b, doHR, method)
|
||||
|
||||
random_btn = gr.Button(value="Randomize")
|
||||
self.register_random(random_btn, bri, con, sat, r, g, b)
|
||||
|
||||
return [enable, latent, bri, con, sat, early, r, g, b, doHR, method]
|
||||
|
||||
def register_reset(self, reset_btn, enable, latent, bri, con, sat, early, r, g, b, doHR, method):
|
||||
for component in [enable, latent, doHR]:
|
||||
reset_btn.click(fn=lambda x: gr.update(value=False), outputs=component)
|
||||
for component in [early, bri, r, g, b]:
|
||||
reset_btn.click(fn=lambda x: gr.update(value=0.0), outputs=component)
|
||||
for component in [con, sat]:
|
||||
reset_btn.click(fn=lambda x: gr.update(value=1.0), outputs=component)
|
||||
|
||||
reset_btn.click(fn=lambda x: gr.update(value='Straight Abs.'), outputs=method)
|
||||
|
||||
def register_random(self, random_btn, bri, con, sat, r, g, b):
|
||||
for component in [bri, r, g, b]:
|
||||
random_btn.click(fn=lambda x: gr.update(value=round(random.uniform(-2.5, 2.5), 2)), outputs=component)
|
||||
for component in [con, sat]:
|
||||
random_btn.click(fn=lambda x: gr.update(value=round(random.uniform(0.5, 1.5), 2)), outputs=component)
|
||||
|
||||
def parse_bool(self, string:str):
|
||||
if string.lower() == "true":
|
||||
return True
|
||||
|
|
@ -150,6 +174,13 @@ class VectorscopeCC(scripts.Script):
|
|||
KDiffusionSampler.callback_state = og_callback
|
||||
return p
|
||||
|
||||
if 'Random' in self.xyzCache.keys():
|
||||
print('\n\n[X/Y/Z Plot] x [Vec.CC] Randomize is Enabled!')
|
||||
if len(self.xyzCache) > 1:
|
||||
print('Some settings will not apply!')
|
||||
|
||||
cc_seed = None
|
||||
|
||||
for k, v in self.xyzCache.items():
|
||||
match k:
|
||||
case 'Alt':
|
||||
|
|
@ -172,6 +203,8 @@ class VectorscopeCC(scripts.Script):
|
|||
doHR = self.parse_bool(v)
|
||||
case 'Method':
|
||||
method = v
|
||||
case 'Random':
|
||||
cc_seed = v
|
||||
|
||||
self.xyzCache.clear()
|
||||
|
||||
|
|
@ -185,6 +218,25 @@ class VectorscopeCC(scripts.Script):
|
|||
|
||||
stop = steps * (1.0 - early)
|
||||
|
||||
if not cc_seed == None:
|
||||
random.seed(cc_seed)
|
||||
|
||||
bri = round(random.uniform(-2.5, 2.5), 2)
|
||||
r = round(random.uniform(-2.5, 2.5), 2)
|
||||
g = round(random.uniform(-2.5, 2.5), 2)
|
||||
b = round(random.uniform(-2.5, 2.5), 2)
|
||||
|
||||
con = round(random.uniform(0.5, 1.5), 2)
|
||||
sat = round(random.uniform(0.5, 1.5), 2)
|
||||
|
||||
print(f'-> Seed: {cc_seed}')
|
||||
print(f'Brightness:\t{bri}')
|
||||
print(f'Contrast:\t{con}')
|
||||
print(f'Saturation:\t{sat}')
|
||||
print(f'R:\t\t{r}')
|
||||
print(f'G:\t\t{g}')
|
||||
print(f'B:\t\t{b}\n')
|
||||
|
||||
if stop < 1:
|
||||
return p
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue