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.31k stars 247 forks source link

[Enhancement]: flipped faces - upside down #463

Open kalle07 opened 1 month ago

kalle07 commented 1 month ago

First, confirm

What happened?

dont work in upside-down positions faces much to big and distorted

all works fine wiht faces more or less in right position

Steps to reproduce the problem

-

Sysinfo

win10 latest version a1111 and latest reactor

Relevant console log

no error

Additional information

No response

Gourieff commented 4 weeks ago

Yes, this the issue The best result - when faces are in the "proper" position (have no tilt > 90)

drdancm commented 1 week ago

The only solution (unless it is a CloseUP) is to flip your image so it is in or close to Front Portrait position. Swapping works well even at about 90 degrees from the ideal position. For upside down, just rotate the image. Photos of Faces rotated in close to or away from camera in Z dimension, become problematic as the angle grows and there is no solution.

kalle07 commented 1 week ago

but what is the problem ... inswapper_128.onnx ? or is it the implementation to search for pattern in all rotations ?

drdancm commented 1 week ago

I think you've hit the nail on the head: inswapper and the like. Perhaps you have noticed that we humans also have some problems with upside down faces. It takes us longer to recognize the face. It is even more of a problem with negatives (light and dark is reversed). In fact we are terrible with negatives. This does not mean that Ai should have a problem, in our applications, because it can be solved, as you already suggested by preprocessing rotations (flipping in case of upside down faces, and so on.) Evolution has not had to make us work with negative images, but Ai could fix that easily by just reversing the shading.