ERROR - Failed to swap face in postprocess method : apply_overlay() takes 3 positional arguments but 4 were given #178

Open
opened 2024-03-02 12:03:09 +01:00 by Fobbek · 21 comments
Fobbek commented 2024-03-02 12:03:09 +01:00 (Migrated from github.com)

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

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
sanora87 commented 2024-03-02 18:59:52 +01:00 (Migrated from github.com)

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.

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.
cMoTp10 commented 2024-03-03 10:24:41 +01:00 (Migrated from github.com)

Massive failure, everyone is waiting for a solution.

There is a malfunction in i2i. If you uncheck:

  • Swap in source image (blended face)
  • Swap in generated image

But in a separate FaceSwapLab tab on the main panel, it works fine, but it's inconvenient.

Massive failure, everyone is waiting for a solution. There is a malfunction in i2i. If you uncheck: - Swap in source image (blended face) - Swap in generated image But in a separate FaceSwapLab tab on the main panel, it works fine, but it's inconvenient.
antorio commented 2024-03-04 20:11:14 +01:00 (Migrated from github.com)

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
cMoTp10 commented 2024-03-04 22:56:28 +01:00 (Migrated from github.com)

faceswaplab

This solution did not help. It gave an error and turned off the faceswaplab module.

> faceswaplab This solution did not help. It gave an error and turned off the faceswaplab module.
sanora87 commented 2024-03-05 01:27:53 +01:00 (Migrated from github.com)

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

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 "<frozen importlib._bootstrap_external>", line 883, in exec_module > File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed > File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 10, in <module> > 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 <module> > from scripts.faceswaplab_swapping import swapper > File "C:\stable diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_swapping\swapper.py", line 21, in <module> > 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 <module> > 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
coder168 commented 2024-03-07 06:04:06 +01:00 (Migrated from github.com)

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!

> 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](https://github.com/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!
antorio commented 2024-03-07 18:32:58 +01:00 (Migrated from github.com)

@sanora87 @cMoTp10 ,
make sure you write it in the right python indentation format. Don't just paste it down.
Screen Shot 2024-03-08 at 00 31 03

@sanora87 @cMoTp10 , make sure you write it in the right python indentation format. Don't just paste it down. <img width="817" alt="Screen Shot 2024-03-08 at 00 31 03" src="https://github.com/glucauze/sd-webui-faceswaplab/assets/26195779/c0318931-8508-4ec2-ba00-74a7ebbc0b31">
cMoTp10 commented 2024-03-07 19:07:48 +01:00 (Migrated from github.com)

@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!
imgutils py - Visual Studio Code_240307210658

> @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! ![imgutils py - Visual Studio Code_240307210658](https://github.com/glucauze/sd-webui-faceswaplab/assets/161955750/a183387b-c6f3-49ed-9c68-d1eb42e7ff9e)
ali0une commented 2024-03-07 19:10:41 +01:00 (Migrated from github.com)

Many thanks @antorio!

Many thanks @antorio!
sanora87 commented 2024-03-08 02:17:11 +01:00 (Migrated from github.com)

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'

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'
ncandelier commented 2024-03-09 20:27:25 +01:00 (Migrated from github.com)

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

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
jet3004 commented 2024-03-12 08:11:49 +01:00 (Migrated from github.com)

Thank you all! Took me forever to find this fix but glad it was posted. Hope T2I is fixed soon!

Thank you all! Took me forever to find this fix but glad it was posted. Hope T2I is fixed soon!
ali0une commented 2024-03-12 18:06:03 +01:00 (Migrated from github.com)

@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
@jet3004 look this issue [171](https://github.com/glucauze/sd-webui-faceswaplab/issues/171#issuecomment-1987341342) 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 ```
NotherGithubAccount commented 2024-03-14 19:02:32 +01:00 (Migrated from github.com)

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.
antorio commented 2024-03-14 19:16:57 +01:00 (Migrated from github.com)

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.

> 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.
jaesimio commented 2024-03-19 17:48:49 +01:00 (Migrated from github.com)

@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

@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: ```python 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`: ```python return image ``` `apply_overlay()` function's return value in `v1.8.0`: ```python 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
TylerBizz commented 2024-03-26 10:21:48 +01:00 (Migrated from github.com)

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.

> 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.
qq294922436 commented 2024-04-15 11:06:51 +02:00 (Migrated from github.com)

3Q

3Q
ayahanda commented 2024-06-18 11:43:01 +02:00 (Migrated from github.com)

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 , 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
teamjla commented 2024-06-25 01:03:18 +02:00 (Migrated from github.com)

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 :)

image

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 :) ![image](https://github.com/glucauze/sd-webui-faceswaplab/assets/52358822/86025265-53c9-48a4-940e-70b9f2d0e1ce)
subtlecaffeine commented 2025-04-06 18:31:10 +02:00 (Migrated from github.com)

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 :)

image

You're missing a space around the underscore on line 227.

        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.")
> 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 :) > > ![image](https://github.com/glucauze/sd-webui-faceswaplab/assets/52358822/86025265-53c9-48a4-940e-70b9f2d0e1ce) You're missing a space around the underscore on line 227. ``` 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.") ```
Sign in to join this conversation.