Extracting multiple sources to one folder breaks remove-faces and rename

Want to know about the Faceswap's Face Extraction process? Got tips, ideas or just want to learn about how it all works? Then this is the place for you


Forum rules

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

This forum is for discussing tips and understanding the process involved for Extracting and preparing face sets for training a model in Faceswap.

If you have found a bug are having issues with the Extraction process not working, then you should post in the Extract Support forum.

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

Locked
User avatar
Surrogator
Posts: 13
Joined: Sun Jul 14, 2019 11:39 pm
Has thanked: 2 times
Been thanked: 2 times

Extracting multiple sources to one folder breaks remove-faces and rename

Post by Surrogator »

  1. Create a faces destination directory, let's call it "faces".

  2. Extract source_1.mp4.

  3. Extract source_2.mp4.

  4. Sort "faces" directory by Face.

  5. Remove all unwanted faces.

  6. Update source_1_alignments.fsa with Alignments > remove-faces tool.

  7. Faces which were deleted from the "faces" directory are removed from the alignments file correctly.

  8. Renaming fails, because Faceswap encounters faces from source_2.mp4 in the "faces" directory.

remove-faces and rename used to skip over those faces from other sources perfectly fine.

  1. Clean up source_1_alignments.fsa with remove-faces.

  2. Clean up source_2_alignments.fsa with remove-faces.

  3. Merge alignments files into single faces_alignments.fsa file for the "faces" directory.

This workflow is no longer possible. My face files can no longer be renamed to their original name, and to remedy the situation I've had to:

  1. Re-extract faces from the cleaned-up alignments files into separate directories, adding another 30 minutes per source.

  2. Manually merge the resulting directories into a directory usable for training, like a centralised "faces" directory.

  3. Finally merge the cleaned-up alignment files so I can start training.

Can you please make the rename step not fail catastrophically on the presence of other-sourced faces in the folder like before? Was there a reason this was changed? I might have to change my workflow from the beginning if I understand why this separation is necessary.

If this is a limitation to the rename step, can Faceswap please throw an error when you attempt to extract faces into a non-empty directory? This would prevent us from losing time...

User avatar
torzdf
Posts: 2681
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 133 times
Been thanked: 625 times

Re: Extracting multiple sources to one folder breaks remove-faces and rename

Post by torzdf »

Nothing has actively changed in this part of the code for quite some time. In fact I don't think I've made any changes to the alignment tool code for at least a year....

I will admit that your use case is not a use case that I ever envisaged, or used it for, but I will look into this when I get a chance.

My word is final

User avatar
bryanlyon
Site Admin
Posts: 793
Joined: Fri Jul 12, 2019 12:49 am
Answers: 44
Location: San Francisco
Has thanked: 4 times
Been thanked: 218 times
Contact:

Re: Extracting multiple sources to one folder breaks remove-faces and rename

Post by bryanlyon »

You also might try re-ordering the process. If you try merging the fsa files before doing remove-faces it will be working with both files.

User avatar
Surrogator
Posts: 13
Joined: Sun Jul 14, 2019 11:39 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Extracting multiple sources to one folder breaks remove-faces and rename

Post by Surrogator »

Thanks for the workaround suggestion. I prefer extracting multiple sources to a single folder and sorting everything in one go because it saves a LOT of time.

That said, I think this reveals the process of working with Faceswap can be a bit too brittle. One misstep and you lose quite a lot of time fixing it, or worse, starting over. Just because Faceswap seems to fatally error on something as seemingly trivial as "there are files in here that don't exist in your alignments file". Ok... so!? Just skip those faces...

User avatar
torzdf
Posts: 2681
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 133 times
Been thanked: 625 times

Re: Extracting multiple sources to one folder breaks remove-faces and rename

Post by torzdf »

That's fair enough. Like I say, I'll take another look. I can't see how this would have changed though, as the functionality hasn't been amended.

Incidentally, I believe (and it's a long time since I wrote it) that the logic behind it was to avoid people accidentally pointing at the wrong faces folder and removing all the faces from the alignments file.

My word is final

User avatar
Surrogator
Posts: 13
Joined: Sun Jul 14, 2019 11:39 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Extracting multiple sources to one folder breaks remove-faces and rename

Post by Surrogator »

torzdf wrote: Wed Jul 08, 2020 9:42 am

to avoid people accidentally pointing at the wrong faces folder and removing all the faces from the alignments file.

That's a nice precaution. I'd say the fact the alignments tool makes a backup of your files every time you run one through the tool, it's safe to remove the directory pre-check. Instead, perhaps at the end of running the alignment file through the tool, calculate how many faces are left in the file. If there are zero faces left in the file, something has probably gone wrong. Maybe show a warning for that instead, hinting they should probably drop the new alignments file and grab the backup that the tool made just a moment ago.

Locked