DeepFace Based Batch Face Similarity Sorting Gradio APP For Windows, RunPod and Massed Compute - 1-Click to Install - Uses TensorFlow GPU - Very Fast
🕑 Added 2025-06-23 16:03:00 +0000 UTCA batch face similarity sorting Gradio APP that utilizes DeepFace library - Extremely useful to sort AI generated images according to their
Patreon exclusive posts index to find our scripts easily, Patreon scripts updates history to see which updates arrived to which scripts and amazing Patreon special generative scripts list that you can use in any of your task.
Join discord to get help, chat, discuss and also tell me your discord username to get your special rank : SECourses Discord
Please also Star, Watch and Fork our Stable Diffusion & Generative AI GitHub repository and join our Reddit subreddit and follow me on LinkedIn (my real profile)
=======
Latest zip file : sort_by_similarity_v9.zip
22 July 2025 Update v9
Installer updated and errors fixed
23 June 2025 Update v8
New option Use Best Match (Minimum Distance) added
Printed messages on CMD significantly improved
Multi-threading logic improved
GPU usage logic improved
16 June 2025 Update
Now supports RTX 5000 series GPUs too
Now you can sort sub folders too
This APP is based on DeepFace
It is fully multi-threaded and higher batch size increase your processing speed
Make sure to have accurately installed CUDA and cuDNN for TensorFlow library to use your GPU or else it will be ultra slow
It uses minimal amount of VRAM so should work on every GPU pretty much
What this APP does is that, it takes source images folder, target images folder and optionally extracted faces folder
Then it calculates every target image similarity / distance to the source images individually (if multiple source images used it averages them) and at the end sort all target images according to their similarity / distance
When you use more than 1 image in source images folder, it will sort according to the average of the source images but be careful it will increase processing time linearly since each image compared with each target image
If few images gives error at first run, you can run again and it usually fixes error occurred images - i am still not sure why this happens - probably related to DeepFace library
This app can be extremely useful to sort AI generated images according to the original training images to get the best ones comparatively
The images in target folder will be renamed as the followings
Image_Similarity_Rank - Image_Similarity_Score - Older File Name
e.g. image_rock.png will become 33 - 0.55 - image_rock.png
33 is similarity rank, 0.55 is its distance (lesser is more similar)
Following DeepFace models supported but I didn't test them except Facenet512 which is best

Windows Requirements
Python 3.10, FFmpeg, CUDA 12.4, cuDNN 8.9 and 9.4+ (I am using 9.7 atm), C++ tools and Git
If it doesn't work make sure to below tutorial and install everything exactly as shown in this below tutorial
It should work with above version of CUDA 12.4 and cuDNN 8.9 but haven't tested
How To Install and Use:
Windows:
First watch above requirements tutorial and follow every step
Extract zip archive into a drive like c:/face_sort
Longer directory path causes issues
Double click and install with Windows_Install.bat and that is it
Then run with Windows_Start_App.bat to start Similarity Sorter SECourses APP
And follow above and below attached screenshot
Massed Compute (Recommend Cloud) :
Please register via this link : https://vm.massedcompute.com/signup?linkId=lp_034338&sourceId=secourses&tenantId=massed-compute
We have a special coupon for all GPUs : SECourses
If you want to learn more about GPUs and prices read this link : https://www.patreon.com/posts/126671823
Select RTX A6000 or Better GPU - like L40S or A6000 ADA or A100 or H100
Then select our image SECourses from Creator dropdown
Then follow Massed_Compute_Instructions_READ.txt
Same as my any other Massed Compute installer script
Example tutorial for learn how to install and use Massed Compute
(Starts at 12:58) : https://youtu.be/KW-MHmoNcqo?si=G1WbG-Qw4ujWvOtG&t=778
RunPod (Cloud):
Please register via this link : https://get.runpod.io/955rkuppqv4h
Then follow Runpod_Instructions_READ.txt
Same as my any other RunPod installer script
Use the template written in Runpod_Instructions_READ.txt file
Example tutorial for learn how to install and use RunPod
(starts at 22:03) : https://youtu.be/KW-MHmoNcqo?si=QN8X8Sjn13ZYu-EU&t=1323



Comments
Hockey
I managed to type in the model name for most of them. However there are two models that won't work that way. Dlib and Human-beings. Dlib I managed to install into your environment, however Human-beings I can't get to work... Since they are up there with Facenet in accuracy, it would be great if we could use them. There also seem to be a new version out since it has a model not available in v9. https://github.com/serengil/deepface/blob/master/deepface/models/facial_recognition/Buffalo_L.py Would be great if we could use that one too. I'm testing all the models extensively. Also have you heard about kbyAI? https://github.com/kby-ai/FaceRecognition-Windows/tree/main/lib
Hockey
Is it possible to add the other models as well? Human-beings Facenet Dlib VGG-Face ArcFace GhostFaceNet SFace OpenFace DeepFace DeepID
Hockey
Thank you, works with v9. =)
Hockey
Furkan Gözükara
good idea let me add that as optional
Hockey
Is there a way to not get the average values but the best match value to a source image? Some of the source images are from a view where the face is hardly visible and that will bring down the average value. Here's an example from another software I use: Compared with IMG_20190306_183635.png: 45.90% Compared with IMG_20191011_171158.png: 56.40% Compared with IMG_20191011_171202.png: 0.00% Compared with IMG_20191011_171205.png: 36.24% Best match: DSC_0536.png with 62.42% It checks against each of the source images and presents a value, at the end it also says the average match value and the best individual match value.
Furkan Gözükara
did you try to run? i think it should work . but tensorflow is just a very bad library sadly
Hockey
Got Windows 11 and use Nvidia RTX 3080 16 Gb on a laptop. I get this error when starting the software: 2025-06-18 13:59:37.877925: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2025-06-18 13:59:37.878240: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. During install I got these errors: WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages) Requirement already satisfied: pip in c:\python310\lib\site-packages (25.1.1) WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages) WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages) ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow-gpu 2.10.0 requires keras<2.11,>=2.10.0, but you have keras 3.10.0 which is incompatible. tensorflow-gpu 2.10.0 requires protobuf<3.20,>=3.9.2, but you have protobuf 5.29.5 which is incompatible. tensorflow-gpu 2.10.0 requires tensorboard<2.11,>=2.10, but you have tensorboard 2.19.0 which is incompatible. I have Cuda 12.8 and 12.4 installed, tried to move Cuda 12.4 up in the path list ahead of 12.8 but did not help. Got Cuddn 8.9.7 and 9.7 installed. I don't have any issues with your other softwares. The software starts and start working but after fixing the images nothing happens.
Furkan Gözükara
this can be used to sort images based on similarity to certain given images
Markus
For what do we use that?
Furkan Gözükara
added that feature with v6
Lou
Will this also include sub folders if needed?