Gourieff / sd-webui-reactor

Fast and Simple Face Swap Extension for StableDiffusion WebUI (A1111 SD WebUI, SD WebUI Forge, SD.Next, Cagliostro)
GNU Affero General Public License v3.0
2.17k stars 235 forks source link

[BUG?]: "Cannot detect any Source" #374

Open Woisek opened 2 months ago

Woisek commented 2 months ago

First, confirm

What happened?

Out of nowhere, in the middle of a session (no restarts, no new installs), suddenly ReActor swaps only the first image when doing more than 1 image. It claims that it 'cannot detect any source' which isn't possible when generating a portrait images. I think I changed the checkpoint before that happened, but that can't be the cause, because I used this checkpoint before without issues. It's really odd and I hope someone has a solution for that.

Steps to reproduce the problem

Genereate more than 1 image ( for example, I use Run n times script for that) First image gets swapped, all following images not.

Sysinfo

sysinfo-2024-03-02-19-46.json

Relevant console log

For three images:
Total progress: 200it [02:40,  1.24it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 40/40 [00:27<00:00,  1.46it/s]
20:38:13 - ReActor - STATUS - Working: source face index [0], target face index [0]████| 40/40 [00:25<00:00,  1.57it/s]
20:38:13 - ReActor - STATUS - Using Loaded Source Face Model...
20:38:13 - ReActor - STATUS - Analyzing Target Image...
20:38:14 - ReActor - STATUS - Detecting Source Face, Index = 0
20:38:14 - ReActor - STATUS - Detected: -36- y.o. Female
20:38:14 - ReActor - STATUS - Detecting Target Face, Index = 0
20:38:14 - ReActor - STATUS - Detected: -24- y.o. Female
20:38:14 - ReActor - STATUS - Swapping Source into Target
20:38:15 - ReActor - STATUS - Correcting Face Mask
20:38:15 - ReActor - STATUS - Restoring the face with CodeFormer
20:38:17 - ReActor - ERROR - Please provide a source face
100%|██████████████████████████████████████████████████████████████████████████████████| 40/40 [00:26<00:00,  1.48it/s]
20:38:48 - ReActor - STATUS - Working: source face index [0], target face index [0]
20:38:48 - ReActor - ERROR - Cannot detect any Source
20:38:48 - ReActor - ERROR - Please provide a source face
100%|██████████████████████████████████████████████████████████████████████████████████| 40/40 [00:26<00:00,  1.49it/s]
20:39:19 - ReActor - STATUS - Working: source face index [0], target face index [0]
20:39:19 - ReActor - ERROR - Cannot detect any Source
Total progress: 120it [01:35,  1.26it/s]
Total progress: 120it [01:35,  1.58it/s]

Additional information

No response

Gourieff commented 2 months ago

Maybe you moved the face model file you were using or perhaps you accidentally selected "None" for the Face Model field?

Woisek commented 2 months ago

Maybe you moved the face model file you were using or perhaps you accidentally selected "None" for the Face Model field?

During the generating process ... ?

Gourieff commented 2 months ago

Idk, this error may occur only if there's no source selected (when you work with a single image or a face model), this is a very simple check

Woisek commented 2 months ago

Idk, this error may occur only if there's no source selected (when you work with a single image or a face model), this is a very simple check

What do you mean? The source is the generated image on that ReActor swapps a given face model. How can the source not be selected when it's generated? Also, why does it work with the first generated image, but not with the following ones? It just doesn't make any sense to me, why this happens, as it seems impossible that this could be. Even more, as it worked normally as it should before.

Gourieff commented 2 months ago

If there is no any source selected - you'll receive the error, check your workflow and settings you set There's no any other case to get this error I cannot reproduce the issue because everything works fine - check the settings or just restart A1111 Some fields could be accidentally changed simply via the mouse's scroll (e.g. if they have focus in the WebUI and you scroll with your mouse)

Woisek commented 2 months ago

If there is no any source selected - you'll receive the error, check your workflow and settings you set There's no any other case to get this error

Honestly, there is nothing much to check. I select i.e. 5 in the script (https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f#file-run_n_times-py), the first image gets swapped, all others not, throwing the error.

I cannot reproduce the issue because everything works fine - check the settings or just restart A1111

With the normal batch function of A1111 it seems to work, but that still doesn't explain why it had worked with the script but suddenly no more.

Some fields could be accidentally changed simply via the mouse's scroll (e.g. if they have focus in the WebUI and you scroll with your mouse)

Well, yes, but in this case not likely.

Gourieff commented 2 months ago

Aa... Via this script... This is where we should've started :) I've just test it and everything works pretty fine with no errors 🤷‍♂️ Btw, I modified it a little to show previews of all generated images https://gist.github.com/Gourieff/a2aabc8a992e24a5dd2875deee49c715

Woisek commented 2 months ago

Thanks for taking a look and enhancing it. With v1.8.0 it seems to work (again), have to check 1.7.0.

drdancm commented 2 months ago

I've had tons of trouble with A1111 ever since the update from 1.6 (I'm running inside Stability Matrix) even though Reactor was working fine w 1.6.

The update from 1.6 to 1.7 then to 18 gradually screwed up Reactor in various ways until it completely failed to swap. Possibly this was because I was running Stability Matrix.

Then I installed stablediffusion Forge and it solved a lot of problems, so now Reactor works as well as ever, possibly even better.

https://github.com/lllyasviel/stable-diffusion-webui-forge