Page 1 of 1

How can i merge converted face to the original frame?

Posted: Fri Apr 10, 2020 5:58 pm
by carolYL

Hi there,
I used faceswap to extract face images for person A and person B from two videos. I trained my own GAN models using the face images extracted and was able to use the model to get person B's face based on person A's face. Now I need to merge the converted faces to the original video frames. Can i somehow use faceswap's utilities for that purpose?

Thanks!


Re: How can i merge converted face to the original frame?

Posted: Fri Apr 10, 2020 6:08 pm
by bryanlyon

Faceswap only works with the built in models for convert. The conversion tool doesn't ever actually use the extracted face images, those are only used for training. There is no way to merge external swaps using Faceswap. You'd have to significantly modify how Faceswap handles conversion to be able to recomposite those images back.


Re: How can i merge converted face to the original frame?

Posted: Fri Apr 10, 2020 6:21 pm
by carolYL

Thank you very much for the quick reply. Is there anyway i can take advantage of faceswap's converter using my own model(my model was written in PyTorch)?


Re: How can i merge converted face to the original frame?

Posted: Fri Apr 10, 2020 6:31 pm
by bryanlyon

You'd have to do some serious modifications to the convert process. If you have knowledge and experience with Python, you should be able to pull it off. Feel free to see how it works, start with scripts/convert and follow the process.


Re: How can i merge converted face to the original frame?

Posted: Wed Apr 15, 2020 3:50 pm
by carolYL

I have a question about _queue_out_frames function in class Predict(). This function seems to be putting the swapped faces back to the original frames, and it seems to be using item["swapped_faces"] = swapped_faces[pointer:pointer + num_faces] to do that, but i do not know where/what function does the actual merging. Could you please elaborate how the swapped faces are put back to the frame? (like how the alignment file is being used and which function is used to do the merging(where the color adjustment option, mask type option, scaling option are used))Thanks!


Re: How can i merge converted face to the original frame?

Posted: Thu Apr 16, 2020 9:49 am
by torzdf