Page 1 of 1

Not converting multiple faces in one frame

Posted: Thu Jun 16, 2022 10:03 pm
by Toxic

Running in to the same problem described here:
viewtopic.php?t=1029

Expected that it would process both faces in the frame, but it's just picking the first one found in the alignments and skipping the second.

End of log:

Code: Select all

06/16/2022 16:58:29 VERBOSE  Found more than one face in an image! 'test_007039.png'
06/16/2022 16:58:29 VERBOSE  Found more than one face in an image! 'test_007043.png'
06/16/2022 16:58:29 VERBOSE  Found more than one face in an image! 'test_007044.png'
06/16/2022 16:58:29 VERBOSE  Found more than one face in an image! 'test_007045.png'
06/16/2022 16:58:30 VERBOSE  Found more than one face in an image! 'test_007047.png'
06/16/2022 16:58:30 VERBOSE  Found more than one face in an image! 'test_007048.png'
06/16/2022 16:58:30 VERBOSE  Found more than one face in an image! 'test_007050.png'
06/16/2022 16:58:40 INFO     -------------------------
06/16/2022 16:58:40 INFO     Images found:        7050
06/16/2022 16:58:40 INFO     Faces detected:      14100
06/16/2022 16:58:40 INFO     -------------------------
06/16/2022 16:58:40 INFO     Note:
06/16/2022 16:58:40 INFO     Multiple faces were detected in one or more pictures.
06/16/2022 16:58:40 INFO     Double check your results.
06/16/2022 16:58:40 INFO     -------------------------
06/16/2022 16:58:40 INFO     Process Succesfully Completed. Shutting Down...

Change in Convert behaviour after update

Posted: Fri Jun 17, 2022 9:05 pm
by shammiehands

Prior to the latest update the convert tool would swap all faces in a frame as long was they were in the alignments file. After the update the convert tool only swaps one of the faces even when all faces are shown in the manual tool. I know that you normally only want a single face swapped but occasionally there is a reflected face in a mirror or a photo of the same person in the room that you also want to swap. Is the change in behaviour intentional?


Re: Not converting multiple faces in one frame

Posted: Sat Jun 18, 2022 10:24 am
by torzdf

This looks like a regression. Will take a look when I have a sec.


Re: Not converting multiple faces in one frame

Posted: Mon Jun 20, 2022 6:46 pm
by svenbl80

I can confirm this effect of swapping only one face per frame/picture if multiple faces are in the alignment file.
I also found the root for this effect: lib/convert.py in line 248 the following change was successful:
"borderMode=cv2.BORDER_CONSTANT" -> "borderMode=cv2.BORDER_TRANSPARENT"

Hope I could help to fix this in the next update. Until then, the fix can be done locally in the faceswap folder.

Good Luck!


Re: Not converting multiple faces in one frame

Posted: Wed Jun 22, 2022 3:02 am
by redson

Yeah hopefully can be fixed soon, thank you. I would like to do more than one face as well in same frame.


Re: Not converting multiple faces in one frame

Posted: Wed Jun 22, 2022 10:41 am
by torzdf
svenbl80 wrote: Mon Jun 20, 2022 6:46 pm

I can confirm this effect of swapping only one face per frame/picture if multiple faces are in the alignment file.
I also found the root for this effect: lib/convert.py in line 248 the following change was successful:
"borderMode=cv2.BORDER_CONSTANT" -> "borderMode=cv2.BORDER_TRANSPARENT"

Hope I could help to fix this in the next update. Until then, the fix can be done locally in the faceswap folder.

Good Luck!

Thanks for this, this is useful information. It's also annoying as changing the border mode fixed a bug where a distinct line could be seen at the edge of the face box. I will look into this to see if I can find a better solution.


Re: Not converting multiple faces in one frame

Posted: Wed Jun 22, 2022 7:52 pm
by redson

Just wondering something.

Since the extraction process is outputting

FILE_0
FILE_1

The actual program you could have during the initial reading of face folder to use during swap.

You could have a multi-face found setting which appears -> drop down
Swap All / Swap 0 / Swap 1 -

Of course having both [ 0, 1 ] in there in first place would also be a valid check which apparently was doing that in past. I am like other person are replacing 3D movie frames ( LEFT / RIGHT) images so I always choose All. But I could see someone trying to have two people next to each other talking have two faces per frame want to target one or other but probably limited use compared to replacing ALL.


Re: Not converting multiple faces in one frame

Posted: Thu Jun 23, 2022 10:54 am
by torzdf

The main problem with this is that the numbering is entirely arbitrary, and interrupting the convert process for user input not straightforward


Re: Not converting multiple faces in one frame

Posted: Tue Jun 28, 2022 12:31 am
by redson

Yeah, I understand that if the algorithm examining frames doesn't start from x left to right but simply finding the face whichever one it finds first outputting first found as _0 and next _1 next _2 so forth. Hope the double face issue can be solved though to work around either I have to revert back or right now I am trying on current update, Just to rerun the MOVIE output two times which I haven't confirmed yet if it works. But the when one frame finds first Face it's getting replaced then I taking that movie rerunning it now hoping to replace it second run. Maybe it was my alignment file but I tried to run it again didn't work second time. So I am re-extracting make sure to reuse old alignment file and [x] skip existing faces [x] skip saving faces. (unless skip existing faces means skipping fames to which I assume skip existing was) See if works. If not. I guess I have to find old branch of program in meantime. Unless it's possible to flip branch version inside here looks like you have a few branch versions built inside the program.


Re: Not converting multiple faces in one frame

Posted: Tue Jun 28, 2022 9:49 am
by torzdf

I have pushed an update to revert this change. I will probably need to revisit in the future, but it should solve your issues for now.