Not converting multiple faces in one frame

Getting errors or found a bug when converting faces from a trained model? Post about them here


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for reporting errors with the Convert process. If you want to get tips, or better understand the Convert process, then you should look in the Convert Discussion forum.

Please mark any answers that fixed your problems so others can find the solutions.

Locked
User avatar
Toxic
Posts: 1
Joined: Thu Jun 16, 2022 8:03 pm
Has thanked: 1 time

Not converting multiple faces in one frame

Post 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...
User avatar
shammiehands
Posts: 1
Joined: Fri Jun 17, 2022 8:55 pm

Change in Convert behaviour after update

Post 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?

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Not converting multiple faces in one frame

Post by torzdf »

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

My word is final

User avatar
svenbl80
Posts: 1
Joined: Tue Apr 05, 2022 9:56 am

Re: Not converting multiple faces in one frame

Post 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!

User avatar
redson
Posts: 6
Joined: Wed Jun 22, 2022 2:56 am

Re: Not converting multiple faces in one frame

Post by redson »

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

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Not converting multiple faces in one frame

Post 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.

My word is final

User avatar
redson
Posts: 6
Joined: Wed Jun 22, 2022 2:56 am

Re: Not converting multiple faces in one frame

Post 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.

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Not converting multiple faces in one frame

Post by torzdf »

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

My word is final

User avatar
redson
Posts: 6
Joined: Wed Jun 22, 2022 2:56 am

Re: Not converting multiple faces in one frame

Post 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.

User avatar
torzdf
Posts: 2649
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 128 times
Been thanked: 623 times

Re: Not converting multiple faces in one frame

Post 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.

My word is final

Locked