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.57k stars 281 forks source link

Face restoration gets applied to faces that were not swapped. #467

Open FinboySlick opened 5 months ago

FinboySlick commented 5 months ago

First, confirm

What happened?

In the case of images with multiple faces, CodeFormer restores/alters faces that I did not want to swap. Here's an example in 'extras' with 0.9 CodeFormer strength. Original orig Result: result

As you can see, the Haley Joel's ears, mouth and eyes are messed up in the result. If I set 'Restore Face' to 'None', no noticeable effect occurs on the kid's face and only Bruce's face gets swapped.

Steps to reproduce the problem

Have image with multiple detected faces, use CodeFormers as face restoration, swap only one of the faces. The unswapped face gets 'restored'.

Sysinfo

A1111 on Linux

Relevant console log

14:18:31 - ReActor - STATUS - Working: source face index [0], target face index [1]
14:18:31 - ReActor - STATUS - Using Hashed Source Face(s) Model...
14:18:31 - ReActor - STATUS - Using Hashed Target Face(s) Model...
14:18:31 - ReActor - STATUS - Detecting Source Face, Index = 0
14:18:31 - ReActor - STATUS - Detected: -55- y.o. Male
14:18:31 - ReActor - STATUS - Detecting Target Face, Index = 1
14:18:31 - ReActor - STATUS - Detected: -35- y.o. Male
14:18:31 - ReActor - STATUS - Swapping Source into Target
14:18:31 - ReActor - STATUS - ---Done!---

Additional information

I wasn't sure if this should be filed as a bug or a feature request as it seems to me like face restoration should only apply to the face being swapped. That said, I do not know if it is possible for CodeFormer to limit itself to a single face.

Gourieff commented 1 month ago

You can use it via inpaint