Page 1 of 1

Image sorting tool

Posted: Wed Nov 22, 2023 1:54 pm
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...


Re: Image sorting tool

Posted: Wed Nov 22, 2023 11:14 pm
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.


Re: Image sorting tool

Posted: Thu Nov 23, 2023 2:31 am
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.


Re: Image sorting tool

Posted: Thu Nov 23, 2023 5:09 am
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.


Re: Image sorting tool

Posted: Thu Nov 23, 2023 1:41 pm
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


Re: Image sorting tool

Posted: Fri Dec 15, 2023 11:55 am
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.