Image sorting tool

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.

Post Reply
User avatar
jode
Posts: 24
Joined: Thu Apr 20, 2023 1:16 pm
Has thanked: 1 time
Been thanked: 5 times

Image sorting tool

Post by jode »

Does anybody know if there's some tool that can sort images by how many objects them have? For example if mask preview picture contains only face in white background, that's 1 object. But if there's hair over cheek and it cuts face in to two parts, then it's two objects. I think this could be done somehow with imagemagick but I don't know how :lol: Even better if there's possibility to adjust treshold how big objects counts as second and so on...

User avatar
MaxHunter
Posts: 194
Joined: Thu May 26, 2022 6:02 am
Has thanked: 177 times
Been thanked: 13 times

Re: Image sorting tool

Post by MaxHunter »

Doesn't sort have a multiple face setting,? I've never used it but I'm assuming that is what you're looking for.

Edit: oops. Sorry. I meant the alignment tool.

Last edited by MaxHunter on Thu Nov 23, 2023 2:35 am, edited 2 times in total.
User avatar
torzdf
Posts: 2687
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 135 times
Been thanked: 628 times

Re: Image sorting tool

Post by torzdf »

I'm not sure such a tool exists.

It could most likely be done with some kind of scripting using OpenCV.

The issue is, and why I doubt such a tool exists, the search domain would be different for any particular use case.

To use your example, how does the tool know that the "face" is an object, and not the hair, or something in the background, or the whole head, or the eyes/ears etc.

Then expand that out over all search domains, what if you were looking for cars, how would it know you were looking for cars rather than faces? Does someone standing in front of the car make the car 2 objects? Should the person in front of the car be an object? Should the driver of the car be an object, etc. etc.

Last edited by torzdf on Thu Nov 23, 2023 2:31 am, edited 1 time in total.

My word is final

User avatar
jode
Posts: 24
Joined: Thu Apr 20, 2023 1:16 pm
Has thanked: 1 time
Been thanked: 5 times

Re: Image sorting tool

Post by jode »

I maybe wrote badly (sorry my english) but if you extract images and then use mask tool to make mask preview images of extracted images, there's only one face in the image. But if there's hair over cheek, it cut's face in two parts. The main face is the biggest object and then there's backgroundcolor between cheek which is the second object. I want to sort out these files and keep only faces where hair doesn't exist and cheek is connected to face. So the thing that separates objects is the background color and theshold is needed that it doesn't sort out images where are some single pixels outside of the main face.

User avatar
jode
Posts: 24
Joined: Thu Apr 20, 2023 1:16 pm
Has thanked: 1 time
Been thanked: 5 times

Re: Image sorting tool

Post by jode »

I found out how to do it with imagemagick but it's little bit clumsy. First you have to convert image to 2 color image and then use connected-components to make txt file where all objects are listed. Then read the list to define if there's two or more objects (two because background is one and face another). But hey at least it's working until there's better way :D

User avatar
jode
Posts: 24
Joined: Thu Apr 20, 2023 1:16 pm
Has thanked: 1 time
Been thanked: 5 times

Re: Image sorting tool

Post by jode »

I found one new way to find bad images from extracted B face dataset. My own presorting tool I'm making uses mask preview files to see what faces is worth to keep. I use Dupeguru to delete too similar faces. But before that, I use Dupeguru to find all 80% duplicates and when results windows opens I save it to .csv file. Then I use my own script to remove all mask preview files that are NOT included to the result list. That removes all too unigue files: most of the images with the crap outside of the main face and also some obstructed faces where hand wipes in front of face, blurry faces and so on. After that I use Dupeguru again with 90% similarity to mask files that's left and delete all duplicate images. Too bad Dupeguru can't be used from command line so this is something to do manually.

Post Reply