add preprocessor skip

This commit is contained in:
lllyasviel 2023-11-13 14:35:23 -08:00
parent e10da9de49
commit 6c812b68db
4 changed files with 22 additions and 10 deletions

View File

@ -1 +1 @@
version = '2.1.804'
version = '2.1.805'

View File

@ -2,9 +2,9 @@ adm_scaler_positive, adm_scaler_negative, adm_scaler_end, adaptive_cfg, sampler_
scheduler_name, generate_image_grid, overwrite_step, overwrite_switch, overwrite_width, overwrite_height, \
overwrite_vary_strength, overwrite_upscale_strength, \
mixing_image_prompt_and_vary_upscale, mixing_image_prompt_and_inpaint, \
debugging_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold, inpaint_engine, \
debugging_cn_preprocessor, skipping_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold, inpaint_engine, \
refiner_swap_method, \
freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2 = [None] * 26
freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2 = [None] * 27
def set_all_advanced_parameters(*args):
@ -12,7 +12,7 @@ def set_all_advanced_parameters(*args):
scheduler_name, generate_image_grid, overwrite_step, overwrite_switch, overwrite_width, overwrite_height, \
overwrite_vary_strength, overwrite_upscale_strength, \
mixing_image_prompt_and_vary_upscale, mixing_image_prompt_and_inpaint, \
debugging_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold, inpaint_engine, \
debugging_cn_preprocessor, skipping_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold, inpaint_engine, \
refiner_swap_method, \
freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2
@ -20,7 +20,7 @@ def set_all_advanced_parameters(*args):
scheduler_name, generate_image_grid, overwrite_step, overwrite_switch, overwrite_width, overwrite_height, \
overwrite_vary_strength, overwrite_upscale_strength, \
mixing_image_prompt_and_vary_upscale, mixing_image_prompt_and_inpaint, \
debugging_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold, inpaint_engine, \
debugging_cn_preprocessor, skipping_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold, inpaint_engine, \
refiner_swap_method, \
freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2 = args

View File

@ -553,7 +553,10 @@ def worker():
for task in cn_tasks[flags.cn_canny]:
cn_img, cn_stop, cn_weight = task
cn_img = resize_image(HWC3(cn_img), width=width, height=height)
cn_img = preprocessors.canny_pyramid(cn_img)
if not advanced_parameters.skipping_cn_preprocessor:
cn_img = preprocessors.canny_pyramid(cn_img)
cn_img = HWC3(cn_img)
task[0] = core.numpy_to_pytorch(cn_img)
if advanced_parameters.debugging_cn_preprocessor:
@ -562,7 +565,10 @@ def worker():
for task in cn_tasks[flags.cn_cpds]:
cn_img, cn_stop, cn_weight = task
cn_img = resize_image(HWC3(cn_img), width=width, height=height)
cn_img = preprocessors.cpds(cn_img)
if not advanced_parameters.skipping_cn_preprocessor:
cn_img = preprocessors.cpds(cn_img)
cn_img = HWC3(cn_img)
task[0] = core.numpy_to_pytorch(cn_img)
if advanced_parameters.debugging_cn_preprocessor:
@ -581,7 +587,10 @@ def worker():
return
for task in cn_tasks[flags.cn_ip_face]:
cn_img, cn_stop, cn_weight = task
cn_img = fooocus_extras.face_crop.crop_image(HWC3(cn_img))
cn_img = HWC3(cn_img)
if not advanced_parameters.skipping_cn_preprocessor:
cn_img = fooocus_extras.face_crop.crop_image(cn_img)
# https://github.com/tencent-ailab/IP-Adapter/blob/d580c50a291566bbf9fc7ac0f760506607297e6d/README.md?plain=1#L75
cn_img = resize_image(cn_img, width=224, height=224, resize_mode=0)

View File

@ -311,7 +311,10 @@ with shared.gradio_root:
info='Version of Fooocus inpaint model')
with gr.Tab(label='Control Debug'):
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False)
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False,
info='See the results from preprocessors.')
skipping_cn_preprocessor = gr.Checkbox(label='Skip Preprocessors', value=False,
info='Do not preprocess images. (Inputs are already canny/depth/cropped-face/etc.)')
mixing_image_prompt_and_vary_upscale = gr.Checkbox(label='Mixing Image Prompt and Vary/Upscale',
value=False)
@ -340,7 +343,7 @@ with shared.gradio_root:
scheduler_name, generate_image_grid, overwrite_step, overwrite_switch, overwrite_width, overwrite_height,
overwrite_vary_strength, overwrite_upscale_strength,
mixing_image_prompt_and_vary_upscale, mixing_image_prompt_and_inpaint,
debugging_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold,
debugging_cn_preprocessor, skipping_cn_preprocessor, controlnet_softness, canny_low_threshold, canny_high_threshold,
inpaint_engine, refiner_swap_method]
adps += freeu_ctrls