add a way to automatically select a limited subset of faces to swap
Sometimes you might want to do something like swap a particular face into a bunch of images, so the prompt gets specific about who it is. In this case, you probably don't want to face swap all the faces in the image, only the most prominent one (unless you're trying to make quintuplets or whatever).
But maybe the background faces are all clones, so you still want to face swap all the background faces as well, but with a different prompt. While you could investigate an implementation that has two prompts that it chooses between for different subsets of faces, for now a simpler approach is to just limit which faces get swapped, and you can run through the batch twice: the first time replacing the most prominent face, the second time the background faces.
To do this, I propose adding a dropdown to the UI that has these choices:
"Swap all faces",
"Swap only largest face",
"Swap all faces except largest",
"Swap only faces roughly in the foreground",
"Swap only faces not in the foreground",
- "All faces" is the current behavior.
- "Only largest face" picks whichever face has the largest area (or really, its bounding box has largest area).
- "All faces except largest" discards just the face from the previous entry
- "...in the foreground" would just do faces found by FaceMesh, at least at first, we can try to get more clever down the line
- "...not in the foreground" would do all the faces that "...in the foreground" doesn't do
"Largest face" is really a stand in for "closest face", since you don't know actual distances it's the best you can do. Also, there might be cases where the subject of the image is in the center, but there's a "background person" at the edge of the image whose face is slightly larger but they're clearly in the background, so maybe instead of "largest face" you need to pick "largest face that's towards the middle of the image" or something like that. Maybe call that "most prominent face". You can add that later though.
Sounds good, I will work on this.
Another thing to consider is #28: have an option be "Do face # n" where n is a slider. To make that a little more predictable for the user, we can order the faces largest to smallest, or left to right, rather than the arbitrary order we get now. (All of this, both this new idea and the previous idea, is conditional on the face matcher always finding the exact same faces in the exact same order every time. As far as I know, they do.)
Hey did you manage to implement this?