sd-webui-segment-anything icon indicating copy to clipboard operation
sd-webui-segment-anything copied to clipboard

[Bug]: ValueError: An event handler (run_annotator) didn't receive enough output values (needed: 4, received: 3).

Open Defeng11 opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits of both this extension and the webui

Have you updated WebUI and this extension to the latest version?

  • [X] I have updated WebUI and this extension to the latest version

Do you understand that you should read the 1st item of https://github.com/continue-revolution/sd-webui-segment-anything#faq if you cannot install GroundingDINO?

  • [X] My problem is not about installing GroundingDINO

Do you understand that you should use the latest ControlNet extension and enable external control if you want SAM extension to control ControlNet?

  • [X] I have updated ControlNet extension and enabled "Allow other script to control this extension"

Do you understand that you should read the 2nd item of https://github.com/continue-revolution/sd-webui-segment-anything#faq if you observe problems like AttributeError bool object has no attribute enabled and TypeError bool object is not subscriptable?

  • [X] My problem is not about such issue, otherwise I have tried changing the extension directory name from sd-webui-segment-anything to a1111-sd-webui-segment-anything

What happened?

微信截图_20230620125017

Steps to reproduce the problem

1.image for Segment Anything 2.Enable GroundingDINO 3.check the box “GroundingDINO_SwinB (938MB)” 4.GroundingDINO Detection Prompt“hair" 5.tick "I want to preview GroundingDINO detection result and select the boxes I want." 6.Generate bounding box 7.tick ”Copy to Inpaint Upload & img2img ControlNet Inpainting“ 8.Switch to Inpaint Upload

ControlNet V.1.1.224 1.Unit 0 2.Enable 3.Preprocessor: "inpaint_global_harmonious" 4.Model: "control_v11p_sd15_inpaint [ebff9138]" 5.Preview error

After skipping the wrong step, continue img2img, and there will be”ValueError: controlnet is enabled but no input image is given“ and ”AttributeError: 'NoneType' object has no attribute 'mode'“(already added A1111-)

What should have happened?

NA

Commit where the problem happens

webui: https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/baf6946e06249c5af9851c60171692c44ef633e0 extension:

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--xformers

call webui.bat

Console logs

Start SAM Processing
Using local groundingdino.
Running GroundingDINO Inference
Initializing GroundingDINO GroundingDINO_SwinB (938MB)
final text_encoder_type: bert-base-uncased
Initializing SAM to cuda
Running SAM Inference (512, 512, 3)
SAM inference with 1 box, 0 positive prompts, 0 negative prompts
Creating output image
Using local groundingdino.
Running GroundingDINO Inference
Initializing GroundingDINO GroundingDINO_SwinB (938MB)
Start SAM Processing
Using local groundingdino.
Running GroundingDINO Inference
Initializing GroundingDINO GroundingDINO_SwinB (938MB)
Initializing SAM to cuda
Running SAM Inference (512, 512, 3)
SAM inference with 1 box, 0 positive prompts, 0 negative prompts
Creating output image
Traceback (most recent call last):
  File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
    output = await app.get_blocks().process_api(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1326, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1229, in postprocess_data
    self.validate_outputs(fn_index, predictions)  # type: ignore
  File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1204, in validate_outputs
    raise ValueError(
ValueError: An event handler (run_annotator) didn't receive enough output values (needed: 4, received: 3).
Wanted outputs:
    [image, checkbox, html, html]
Received outputs:
    [{'value': None, 'visible': True, '__type__': 'generic_update'}, {'__type__': 'generic_update'}, {'__type__': 'generic_update'}]


2023-06-20 13:05:15,791 - ControlNet - INFO - Loading model: control_v11p_sd15_inpaint [ebff9138]
2023-06-20 13:05:16,813 - ControlNet - INFO - Loaded state_dict from [D:\stable-diffusion-webui\extensions\sd-webui-controlnet\models\control_v11p_sd15_inpaint.pth]
2023-06-20 13:05:16,813 - ControlNet - INFO - Loading config: D:\stable-diffusion-webui\extensions\sd-webui-controlnet\models\control_v11p_sd15_inpaint.yaml
2023-06-20 13:05:18,985 - ControlNet - INFO - ControlNet model control_v11p_sd15_inpaint [ebff9138] loaded.
Error running process: D:\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py
Traceback (most recent call last):
  File "D:\stable-diffusion-webui\modules\scripts.py", line 451, in process
    script.process(p, *script_args)
  File "D:\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 689, in process
    input_image, resize_mode_overwrite = Script.choose_input_image(p, unit, idx)
  File "D:\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 626, in choose_input_image
    raise ValueError('controlnet is enabled but no input image is given')
ValueError: controlnet is enabled but no input image is given

Error completing request
Arguments: ('task(lzagx7zb7lvab2g)', 4, 'red hair', '', [], None, None, None, None, None, None, None, 20, 0, 4, 0, 1, False, False, 1, 1, 7, 1.5, 0.75, -1.0, -1.0, 0, 0, 0, False, 0, 512, 512, 1, 0, 0, 32, 0, '', '', '', [], 0, False, False, 0, None, [{'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmph2dhk1pk.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmph2dhk1pk.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpe2r_wjbm.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpe2r_wjbm.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmp1zrgelbu.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmp1zrgelbu.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpf_a4_qbh.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpf_a4_qbh.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpatc00fb6.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpatc00fb6.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmphjzkzzna.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmphjzkzzna.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpcgz4m1vl.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpcgz4m1vl.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpzt5g_67l.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmpzt5g_67l.png', 'is_file': True}, {'name': 'C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmp86uq1qps.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\GHG\\AppData\\Local\\Temp\\gradio\\tmp86uq1qps.png', 'is_file': True}], 0, False, [], [], False, 0, 1, False, False, 0, None, [], -2, False, [], False, 0, None, None, False, 'MultiDiffusion', False, True, 1024, 1024, 96, 96, 48, 4, 'None', 2, False, 10, 1, 1, 64, False, False, False, False, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 2048, 128, True, True, True, False, False, 7, 100, 'Constant', 0, 'Constant', 0, 4, False, False, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, None, 'Refresh models', <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001CF8F0B7700>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001CEA9ED5C00>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000001CF8F0B66B0>, 100, 0.6, 20, 0.0, 0.0, '', True, True, '', 10, 40, 'VP9 (webm)', '', True, 20, '<ul>\n<li><code>CFG Scale</code> should be 2 or lower.</li>\n</ul>\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, None, None, False, None, None, False, 50, '', 2, True, 'Wavelet', False) {}
Traceback (most recent call last):
  File "D:\stable-diffusion-webui\modules\call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "D:\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "D:\stable-diffusion-webui\modules\img2img.py", line 178, in img2img
    processed = process_images(p)
  File "D:\stable-diffusion-webui\modules\processing.py", line 610, in process_images
    res = process_images_inner(p)
  File "D:\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
    return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
  File "D:\stable-diffusion-webui\modules\processing.py", line 670, in process_images_inner
    p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
  File "D:\stable-diffusion-webui\modules\processing.py", line 1184, in init
    image = images.flatten(img, opts.img2img_background_color)
  File "D:\stable-diffusion-webui\modules\images.py", line 710, in flatten
    if img.mode == "RGBA":
AttributeError: 'NoneType' object has no attribute 'mode'

Additional information

No response

Defeng11 avatar Jun 20 '23 05:06 Defeng11

214334

Defeng11 avatar Jun 20 '23 05:06 Defeng11

https://github.com/continue-revolution/sd-webui-segment-anything#single-image

8

continue-revolution avatar Jun 20 '23 07:06 continue-revolution

I noticed the instructions for asking questions, and I have checked them before trying again

Defeng11 avatar Jun 20 '23 16:06 Defeng11