Merging w/ multiple faces in frame
Running into an issue when I try to convert. If there are multiple faces in the frame, Face B gets swapped onto all the faces. Face B also gets swapped onto solo faces in different shots that are not the target face. I'm coming from FakeApp, where any faces deleted from the /aligned folder are skipped during conversion. That doesn't appear to be the case here (though it does appear to skip those files during training). I tried using the filter, with the clearest front view of the target face I had. That resulted in several frames of the desired face getting skipped while several frames of the non-target faces were still swapped. Do I have to manually edit the alignments.json file or is there an easier workaround?
I raised this issue before but no changes yet. https://github.com/deepfakes/faceswap/pull/155#issuecomment-365079915 I proposed a utility function to check entries in json against data/A and delete the absent ones from the json. But until it is implemented manual work is only way
Any idea why this hasn't been addressed? Seems like an easy fix, as other versions have this functionality. It's already tedious enough deleting unwanted frames from the /aligned folder. Having to then delete parts of the .json file is a hundred times more annoying, and can cause probably even more problems if you mess up the syntax.
Because all of our programmers are on strike :) no seriously they are all missing so either we wait for them or do it ourselves. I'm c#/Java guy so don't really know python.
How difficult would it be to create a standalone script that would parse the alignments file and delete entries that don't have corresponding pictures in A/aligned? I'm no programmer but perhaps this would be a temporary fix until something can be incorporated into the main branch? I'm also in a similar spot since most of what I want to do involves two people in a scene.
Seems simple enough to do in Python, I'll try and do this today.
Great! Just mind that alignment file is not necessary to be a json file. I think there are couple supported extensions. You can see them in script
I have a fix here https://github.com/oatssss/faceswap/commit/b6be9db0ee8357f4f5a8af42e20bc77ec7bf0278 in branch update-GAN-v2-tests. Please check if it has the behaviour your looking for. I only tested to check that it still works for solo-face frames.
Note I changed the format for naming aligned images from
{filename}{frame}{faceID}
to
{filename}{frame}_{faceID}
So you'll have to run the extraction again, sorry! For conversion, you also now need to specify the folder of aligned images with option -a or --input-aligned-dir.
I didn't like how my aligned image names seemed like they just got multiplied by 10. The _ gives a clear separation between frame and faceID.
Will try this. Can you make the default path for this to "./folder_to_convert/aligned" ? Like in the original scripts? People are used to copy this folder to the folder that contains the photos that they want to convert.
Yea I'll work that in today.
It's in update-GAN-v2-tests already.
@cojosao @enniowatson can you test this? Mind that you have to run extract script again to get the alignment file. Its format has been changed.
Sorry for bad English, I use translator. It would be great if the program automatically divided similar faces into separate directories with its alignments.json file. In this case, it would be possible to replace individually any of the found faces
Don't think it would be reliable.
I thought that the mechanisms of machine learning is sometimes used to split the dataset by category. For example https://github.com/ankonzoid/artificio/tree/master/similar_images_AE
What I mean is face detector often gives wrong results. Maybe it can be used for initial results but you would have to go through each folder to remove false-positive and put wrongly recognized faces to appropriate folders.
- We can use extractor same as usual. Then we have dataset of several faces (wrong detections). A1, B1, A2, A3, A4, B4, A5, B5, A6, A7, C7
- To run similar images app with this dataset we get several sets with different faces [A1, A2, A3, A4, A5, A6, A7], [B1, B4, B5], [C7]
- Generate alignments.json for sets
- Run train or extract with any set separately
- Profit
@RunetX It is always possible to have a utility to parse extracted photos and group them by similarity, but as @Apollo122 said it won't be perfect. But please open a new issue to discuss about it, as it is a different subject from the original issue
@Clorr execuse me, I don't understand English very well.
@oatssss I checked the code. It seems default value is still none
@Apollo122 do you have this commit? https://github.com/oatssss/faceswap/commit/b4dc203e4c9f1f019666e4b447bc1be97d7df0c8