ototadana / sd-face-editor

Face Editor for Stable Diffusion
MIT License
1.03k stars 85 forks source link

Bug:ValueError: images do not match #174

Closed gastoncao closed 12 months ago

gastoncao commented 1 year ago

It's really a great extension, but when I use the "ebsynth utility" script, I get a "Value Error: images do not match" error. Has anyone encountered this error before, and is there a solution?

ototadana commented 1 year ago

@gastoncao Thanks for the report.

I have tested running it with the "ebsynth utility" at the same time and did not encounter any errors.

If you could send me a detailed description of the error (Traceback), I may be able to determine the cause.

Also, the "images do not match" error is generally caused by the dimensions (width and height) of the image. This error may be able to be avoided by changing the dimensions of the images (video) you are using to a value divisible by 8, such as 512, 768, 1024, etc.

gastoncao commented 1 year ago

Thanks for your answer. The dimensions of the image was 720x1280, and there will be no errors when processing single images, so I don't think it's its problem. The following is the backend error code, hoping to provide you with more accurate information

Error running postprocess: D:\stable-diffusion-webui\extensions\sd-face-editor\scripts\face_editor_extension.py Traceback (most recent call last): File "D:\stable-diffusion-webui\modules\scripts.py", line 651, in postprocess script.postprocess(p, processed, script_args) File "D:\stable-diffusion-webui\extensions\sd-face-editor\scripts\face_editor_extension.py", line 53, in postprocess ImageProcessor(WorkflowManager.get(option.workflow)).proc_images(o, res, option) File "D:\stable-diffusion-webui\extensions\sd-face-editor\scripts\use_cases\image_processor.py", line 62, in proc_images proc = self.proc_image(p, option, image, res.infotexts[i], (res.width, res.height)) File "D:\stable-diffusion-webui\extensions\sd-face-editor\scripts\use_cases\image_processor.py", line 176, in proc_image proc_image = self.workflow.process(jobs, face, p, option) File "D:\stable-diffusion-webui\extensions\sd-face-editor\scripts\use_cases\workflow_manager.py", line 162, in process image = face_processor.process(face, p, params) File "D:\stable-diffusion-webui\extensions\sd-face-editor\scripts\inferencers\img2img_face_processor.py", line 41, in process proc = process_images(p) File "D:\stable-diffusion-webui\modules\processing.py", line 732, 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 803, in process_images_inner p.init(p.all_prompts, p.all_seeds, p.all_subseeds) File "D:\stable-diffusion-webui\modules\processing.py", line 1455, in init image_masked.paste(image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(self.mask_for_overlay.convert('L'))) File "D:\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1732, in paste self.im.paste(im, box, mask.im) ValueError: images do not match



thank you very much indeed!

ototadana commented 1 year ago

Thanks for the report.

I have investigated the conditions under which the "images do not match" error occurs when using the "ebsynth utility" and found that this error occurs when the dimensions of the images in the video_mask folder differs from the dimensions of the images in the video_key folder. In this case, the same error occurs even if Face Editor is disabled. If this is the case for you, then it is not a problem with the Face Editor, but with the "ebsynth utility".

If the above does not apply to you, could you please provide more detailed information on the operating procedures and settings of ebsynth, ControlNet, and Face Editor at the time the error occurred? If I can reproduce the same error in my environment based on that information, We will have a better chance of solving this problem.

gastoncao commented 1 year ago

Hah, I think I know where the problem lies. My original video resolution was "700x1080", and after opening the ebsynth script, they converted image was "696x1080", so the problem with different sizes as you described would arise. Thank you very much,gosh~! think you bro~!