Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

img2img -> Inpaint -> dont work #184

Open
kalle07 opened this issue Mar 11, 2024 · 9 comments
Open

img2img -> Inpaint -> dont work #184

kalle07 opened this issue Mar 11, 2024 · 9 comments

Comments

@kalle07
Copy link

kalle07 commented Mar 11, 2024

OK in
TAB img2img
SUB TAB img2img
it worked

but

TAB img2img
SUB TAB inpaint
draw a mask on face
(dont work)

...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:10<00:00, 3.43it/s]
2024-03-11 09:29:10,060 - FaceSwapLab - INFO - Try to use model : D:\stable-diffusion\webui\models\faceswaplab\inswapper_128.onnx██████████████████████████████| 35/35 [00:09<00:00, 3.47it/s]
d:\stable-diffusion\system\python\lib\site-packages\insightface\utils\transform.py:68: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1.
P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
2024-03-11 09:29:11,333 - FaceSwapLab - INFO - blend all faces together
2024-03-11 09:29:11,516 - FaceSwapLab - INFO - Int Gender : 0
2024-03-11 09:29:11,516 - FaceSwapLab - INFO - Process face 0
2024-03-11 09:29:11,516 - FaceSwapLab - INFO - Source Gender 0
2024-03-11 09:29:11,516 - FaceSwapLab - INFO - Target faces count : 1
2024-03-11 09:29:11,516 - FaceSwapLab - INFO - swap face 0
2024-03-11 09:29:12,201 - FaceSwapLab - INFO - ********************************************************************************
2024-03-11 09:29:12,201 - FaceSwapLab - INFO - Inswapper
2024-03-11 09:29:12,209 - FaceSwapLab - INFO - ********************************************************************************
2024-03-11 09:29:12,241 - FaceSwapLab - INFO - Finished processing image, return 1 images
2024-03-11 09:29:12,241 - FaceSwapLab - INFO - 1 images swapped
2024-03-11 09:29:12,251 - FaceSwapLab - INFO - Add swp image to processed
2024-03-11 09:29:12,251 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : 'tuple' object has no attribute 'height'
Traceback (most recent call last):
File "D:\stable-diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 216, in postprocess
save_image(
File "D:\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: 'tuple' object has no attribute 'height'
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:12<00:00, 2.72it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:12<00:00, 3.47it/s]

@jaesimio
Copy link

jaesimio commented Mar 19, 2024

@kalle07,
Plaese check this

@kalle07
Copy link
Author

kalle07 commented Mar 23, 2024

newest faceswap

Automatic1111 (1.8.0)
tab img2img -> tab inpaint
with or without mask

error:
2024-03-23 14:40:19,818 - FaceSwapLab - INFO - Try to use model : D:\stable-diffusion\webui\models\faceswaplab\inswapper_128.onnx████████████████████████████████████████████████████████████████████████████████| 31/31 [00:10<00:00, 2.96it/s]
d:\stable-diffusion\system\python\lib\site-packages\insightface\utils\transform.py:68: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1.
P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
2024-03-23 14:40:21,199 - FaceSwapLab - INFO - Finished processing image, return 1 images
2024-03-23 14:40:21,199 - FaceSwapLab - INFO - 1 images swapped
2024-03-23 14:40:21,207 - FaceSwapLab - INFO - Add swp image to processed
2024-03-23 14:40:21,207 - FaceSwapLab - ERROR - Failed to swap face in postprocess method : 'tuple' object has no attribute 'height'
Traceback (most recent call last):
File "D:\stable-diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab.py", line 216, in postprocess
save_image(
File "D:\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: 'tuple' object has no attribute 'height'
Total progress: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 31/31 [00:12<00:00, 2.46it/s]
Total progress: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 31/31 [00:12<00:00, 2.96it/s]

btw:
in img2img it worked fine but i will change the face and dont calculate a whole image

@kalle07
Copy link
Author

kalle07 commented Mar 23, 2024

what iv made wrong ?

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 image, original_denoised_image
      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

@BigZampano
Copy link

BigZampano commented Mar 23, 2024

Had this problem a few days ago, made the proposed changes to the imgutils.py and it worked again...
(@kalle07: the indentation of the lines is important, maybe re-check..)

Now today the same error came back...!
I checked the imgutils.py file and the changes I made are still there...

Yesterday I updated the Nvidia driver for my 3060, it's now at version 551.86... could that be the issue...?

The problem is only when inpainting, img2img works fine...


Edit: I downgraded the Nvidia driver and it's working again...!!

@jaesimio
Copy link

@kalle07,

You need to check the indentation and apply_mask() function's return value.

    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 image, original_denoised_image
#               ^
#               I think this point is wrong
        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

to:

        return img

@kalle07
Copy link
Author

kalle07 commented Mar 24, 2024

really it depends on nvidia driver (my is 546.17)

ok .. to be shure

thats my original

    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

what exact i should change (i have v 1.8.0)

@jaesimio
Copy link

jaesimio commented Mar 24, 2024

@kalle07

Try this code and if that doesn't work, it's probably a nvidia driver issue.

    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)
#     ^
#     change this only
    else:
      return img
#     ^
#     do not change
      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

@kalle07
Copy link
Author

kalle07 commented Mar 28, 2024

not work :(

...

    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, original_denoised_image
        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

...

img, _ = (also not working same error)
delete "original_denoised_image" also not working

Total progress: 100%|██████████████████████████████████████████████████████████████████| 31/31 [00:22<00:00, 1.38it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 31/31 [00:19<00:00, 1.58it/s]
2024-03-28 10:46:00,732 - FaceSwapLab - INFO - Try to use model : D:\stable-diffusion\webui\models\faceswaplab\inswapper_128.onnx
d:\stable-diffusion\system\python\lib\site-packages\insightface\utils\transform.py:68: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1.
P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - blend all faces together
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - loading face Vero_face.safetensors
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - Int Gender : 0
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - Process face 0
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - Source Gender 0
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - Target faces count : 1
2024-03-28 10:46:02,004 - FaceSwapLab - INFO - swap face 0
2024-03-28 10:46:02,659 - FaceSwapLab - INFO - ********************************************************************************
2024-03-28 10:46:02,659 - FaceSwapLab - INFO - Inswapper
2024-03-28 10:46:02,667 - FaceSwapLab - INFO - ********************************************************************************
2024-03-28 10:46:02,770 - FaceSwapLab - INFO - Finished processing image, return 1 images
2024-03-28 10:46:02,778 - FaceSwapLab - INFO - 1 images swapped
2024-03-28 10:46:02,778 - 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 "D:\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 "D:\stable-diffusion\webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_utils\imgutils.py", line 226, in apply_mask
img = processing.apply_color_correction(
TypeError: apply_overlay() takes 3 positional arguments but 4 were given
Total progress: 100%|██████████████████████████████████████████████████████████████████| 31/31 [00:22<00:00, 1.36it/s]
2024-03-28 10:49:14,600 - ControlNet - INFO - Preview Resolution = -1██████████████████| 31/31 [00:22<00:00, 1.59it/s]

which nvidia driver is working ? and why should this important ?

@kalle07
Copy link
Author

kalle07 commented Apr 9, 2024

hello , any idea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants