Open Fobbek opened 7 months ago
I've been messing with the settings since it popped up on me yesterday.
It seems to only occur when you have "Swap in generated image" ticked in i2i.
Massive failure, everyone is waiting for a solution.
There is a malfunction in i2i. If you uncheck:
But in a separate FaceSwapLab tab on the main panel, it works fine, but it's inconvenient.
The error has to do with the updated processing.py modules in a1111.
In your faceswaplab's extension folder, find imgutils.py inside /faceswaplab_utils/ folder
go to line 224 or where it says:
img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
change it to:
if p.overlay_images and batch_index < len(p.overlay_images):
selected_overlay = p.overlay_images[batch_index]
img = processing.apply_overlay(img, p.paste_to, selected_overlay)
else:
return img
logger.debug("No overlay selected or overlay list is empty.")
See if it helps.
If anybody has another solution, please share
faceswaplab
This solution did not help. It gave an error and turned off the faceswaplab module.
Same. Get this error text
*** Error loading script: faceswaplab.py Traceback (most recent call last): File "C:\stable diffusion\webui\modules\scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "C:\stable diffusion\webui\modules\script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "
", line 883, in exec_module File " ", line 241, in _call_with_frames_removed File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 10, in from scripts.faceswaplab_api import faceswaplab_api File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_api\faceswaplab_api.py", line 12, in from scripts.faceswaplab_swapping import swapper File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_swapping\swapper.py", line 21, in from scripts.faceswaplab_swapping import upscaled_inswapper File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_swapping\upscaled_inswapper.py", line 15, in from scripts.faceswaplab_utils.imgutils import cv2_to_pil, pil_to_cv2 File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_utils\imgutils.py", line 225 selected_overlay = p.overlay_images[batch_index] ^ IndentationError: unindent does not match any outer indentation level #
Worth a shot though
The error has to do with the updated processing.py modules in a1111.
In your faceswaplab's extension folder, find imgutils.py inside /faceswaplab_utils/ folder
go to line 224 or where it says:
img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
change it to:
if p.overlay_images and batch_index < len(p.overlay_images):
selected_overlay = p.overlay_images[batch_index]
img = processing.apply_overlay(img, p.paste_to, selected_overlay)
else:
return img
logger.debug("No overlay selected or overlay list is empty.")
See if it helps.
If anybody has another solution, please share
antorio's solution works for me. I had the exactly same issue - After upgrade A1111 to v1.8.0, faecswaplab just throws the fore-mentioned error message and stop working under img2img. I have manually applied the code changes as Antorio suggested, it works fine on v1.8.0 of A1111. Antorio, THANKS!
@sanora87 @cMoTp10 , make sure you write it in the right python indentation format. Don't just paste it down.
@sanora87 @cMoTp10 , make sure you write it in the right python indentation format. Don't just paste it down.
My friend, thank you very much. My problem really was in the indent.
I brought the code back to normal and everything worked out. You really helped me out. I am grateful!
Many thanks @antorio!
i2i works now with that @antorio! Text2image is broke now but I'll survive without it. I don't think I used it much anyways.
Here's that error code if you wanted to see it regardless
2024-03-07 20:14:59,319 - FaceSwapLab - ERROR - Failed to post-process 'NoneType' object has no attribute 'copy' Traceback (most recent call last): File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_postprocessing\postprocessing.py", line 26, in enhance_image result_image = upscale_img(result_image, pp_options) File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_postprocessing\upscaling.py", line 13, in upscale_img original_image: PILImage = image.copy() AttributeError: 'NoneType' object has no attribute 'copy' 2024-03-07 20:14:59,321 - FaceSwapLab - INFO - Add swp image to processed 2024-03-07 20:14:59,321 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : 'NoneType' object has no attribute 'height' Traceback (most recent call last): File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 216, in postprocess save_image( File "C:\stable diffusion\webui\modules\images.py", line 611, in save_image if (image.height > 65535 or image.width > 65535) and extension.lower() in ("jpg", "jpeg") or (image.height > 16383 or image.width > 16383) and extension.lower() == "webp": AttributeError: 'NoneType' object has no attribute 'height'
Hello,
i2i works now with that @antorio! Text2image is broke now but I'll survive without it. I don't think I used it much anyways.
Here's that error code if you wanted to see it regardless
2024-03-07 20:14:59,319 - FaceSwapLab - ERROR - Failed to post-process 'NoneType' object has no attribute 'copy' Traceback (most recent call last): File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_postprocessing\postprocessing.py", line 26, in enhance_image result_image = upscale_img(result_image, pp_options) File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_postprocessing\upscaling.py", line 13, in upscale_img original_image: PILImage = image.copy() AttributeError: 'NoneType' object has no attribute 'copy' 2024-03-07 20:14:59,321 - FaceSwapLab - INFO - Add swp image to processed 2024-03-07 20:14:59,321 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : 'NoneType' object has no attribute 'height' Traceback (most recent call last): File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 216, in postprocess save_image( File "C:\stable diffusion\webui\modules\images.py", line 611, in save_image if (image.height > 65535 or image.width > 65535) and extension.lower() in ("jpg", "jpeg") or (image.height > 16383 or image.width > 16383) and extension.lower() == "webp": AttributeError: 'NoneType' object has no attribute 'height'
Facing this issue also in txt2img, hope there will be a fix soon.
Thanks
Thank you all! Took me forever to find this fix but glad it was posted. Hope T2I is fixed soon!
@jet3004 look this issue 171 with the code below it fixed faceswaplab in both txt2img and img2img /whatever/stable-diffusion-webui/extensions/sd-webui-faceswaplab/scripts/faceswaplab_utils/imgutils.py edited and at line 224 code is like this now :
# img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
# if p.color_corrections is not None and batch_index < len(p.color_corrections):
# img = processing.apply_color_correction(
# p.color_corrections[batch_index], img
# )
# return img
if p.overlay_images and batch_index < len(p.overlay_images):
selected_overlay = p.overlay_images[batch_index]
img = processing.apply_overlay(img, p.paste_to, selected_overlay)
else:
return img
logger.debug("No overlay selected or overlay list is empty.")
if p.color_corrections is not None and batch_index < len(p.color_corrections):
img = processing.apply_color_correction(
p.color_corrections[batch_index], img
)
return img
FWIW, I came here with the same problem - first time user. Then found Reactor does exactly what I need and works. It's available as a direct install from the A1111 extensions menu.
FWIW, I came here with the same problem - first time user. Then found Reactor does exactly what I need and works. It's available as a direct install from the A1111 extensions menu.
IMO, in context of face similarity with source images, Reactor doesn't render nearly as good as faceswaplab.
@antorio @ncandelier, @jet3004,
The return value of processing.apply_overlay()
differs between sd-webui:v1.7.0
and sd-webui:v1.8.0
.
Therefore, we need to make the following changes:
if p.overlay_images and batch_index < len(p.overlay_images):
selected_overlay = p.overlay_images[batch_index]
img, _ = processing.apply_overlay(img, p.paste_to, selected_overlay)
# ^
# this
else:
logger.debug("No overlay selected or overlay list is empty.")
return img
Now img2img(inpaint) and txt2img is work.
apply_overlay()
function's return value in v1.7.0
:
return image
apply_overlay()
function's return value in v1.8.0
:
return image, original_denoised_image
The error has to do with the updated processing.py modules in a1111.
In your faceswaplab's extension folder, find imgutils.py inside /faceswaplab_utils/ folder
go to line 224 or where it says:
img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
change it to:
if p.overlay_images and batch_index < len(p.overlay_images):
selected_overlay = p.overlay_images[batch_index]
img = processing.apply_overlay(img, p.paste_to, selected_overlay)
else:
return img
logger.debug("No overlay selected or overlay list is empty.")
See if it helps.
If anybody has another solution, please share
The error has to do with the updated processing.py modules in a1111.
In your faceswaplab's extension folder, find imgutils.py inside /faceswaplab_utils/ folder
go to line 224 or where it says:
img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images)
change it to:
if p.overlay_images and batch_index < len(p.overlay_images):
selected_overlay = p.overlay_images[batch_index]
img = processing.apply_overlay(img, p.paste_to, selected_overlay)
else:
return img
logger.debug("No overlay selected or overlay list is empty.")
See if it helps.
If anybody has another solution, please share
Thank you - this worked for me.
3Q
hi , i have this error .. using latest A1111 v1.9
i already change code from antorio . still not fix
edit : ok working now , i forget to follow python code format . cant just copy paste , have to follow code format to make it working
Hi There, I have the same problem on Sd v1.9.4. Below is what i have changed. Still having an issue. please help as I dont want to use reactor :)
Getting this error when doing a basic faceswap: Not sure if there was an update to SD or a1111 but this same action worked a couple days ago.
2024-03-02 11:56:33,232 - FaceSwapLab - INFO - blend all faces together 2024-03-02 11:56:33,267 - FaceSwapLab - INFO - loading face Max.safetensors 2024-03-02 11:56:33,267 - FaceSwapLab - INFO - Int Gender : 0 2024-03-02 11:56:33,267 - FaceSwapLab - INFO - Process face 0 2024-03-02 11:56:33,275 - FaceSwapLab - INFO - Source Gender 0 2024-03-02 11:56:33,275 - FaceSwapLab - INFO - Target faces count : 1 2024-03-02 11:56:33,275 - FaceSwapLab - INFO - swap face 0 2024-03-02 11:56:34,283 - FaceSwapLab - INFO - **** 2024-03-02 11:56:34,323 - FaceSwapLab - INFO - Inswapper 2024-03-02 11:56:34,323 - FaceSwapLab - INFO - **** 2024-03-02 11:56:34,403 - FaceSwapLab - INFO - Finished processing image, return 1 images 2024-03-02 11:56:34,403 - FaceSwapLab - INFO - 1 images swapped 2024-03-02 11:56:34,403 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : apply_overlay() takes 3 positional arguments but 4 were given Traceback (most recent call last): File "C:\a1111\stable-diffusion-webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 201, in postprocess swp_img = imgutils.apply_mask(swp_img, p, batch_index) File "C:\a1111\stable-diffusion-webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_utils\imgutils.py", line 224, in apply_mask img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images) TypeError: apply_overlay() takes 3 positional arguments but 4 were given