Home Creators Posts Import Register Favorites Logout

Downloads

Content

DeepFace face similarity sorter ranks folders of AI-generated images by how close each face is to your source photos and renames files by rank and score.

A batch Gradio app based on DeepFace with Facenet512, fully multi-threaded and very fast because it uses TensorFlow GPU, with sub-folder sorting and RTX 5000 support. 1-click to install on Windows, RunPod and Massed Compute.

A batch face similarity sorting Gradio APP that utilizes DeepFace library - Extremely useful to sort AI generated images according to their

Please visit Patreon exclusive posts index to find all of our Patreon scripts, posts, apps and more.

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_v12.zip

22 July 2025 Update v12

  • All Windows, RunPod and Massed Compute installers updated

  • Now RunPod uses below template so be careful

    • Runpod Pytorch 2.1

      • runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel-ubuntu22.04

  • For Windows, now the app will auto download and use Cuda 11.8 runtime, cudnn 8.9 runtime and tensorrt runtime so it should work with just Python 3.10.11 you have installed

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

  • This zip file has example code of how to auto download and use CUDA 11.8, cuDNN 8.9 and TensorRT on Windows without system wide installing.

  • It also has example code of installing CUDA 11.8 on Linux without breaking installed NVIDIA driver.

  • Moreover, this app has example code and install for TensorFlow GPU for all GPUs including RTX 5090.

Windows Requirements

  • Python 3.10, FFmpeg

  • If it doesn't work make sure to below tutorial and install everything exactly as shown in this below tutorial

  • https://youtu.be/DrhUHnYfwC0

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) :

RunPod (Cloud):

Related posts

All posts in this topic: Captioning, Dataset and Image Processing Tools · New to SECourses? Start Here: Best and Most Popular SECourses Posts

Files

Comments

Lou

Will this also include sub folders if needed?

Markus

For what do we use that?

SECourses

this can be used to sort images based on similarity to certain given images

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.

SECourses

did you try to run? i think it should work . but tensorflow is just a very bad library sadly

SECourses

ok maybe you need to install TensorRT as well. let me update installer after that let me know

SECourses

Can you try v7 zip? i added TensorRT libs. run installer again

Hockey

I deleted everything and installed from scratch. Got this error 2 times when installing: 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 2.19.0 requires keras>=3.5.0, but you have keras 2.10.0 which is incompatible. tensorflow 2.19.0 requires protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.3, but you have protobuf 3.19.6 which is incompatible. tensorflow 2.19.0 requires tensorboard~=2.19.0, but you have tensorboard 2.10.1 which is incompatible. Also got 6x: WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages) When starting software: 2025-06-18 14:28:24.995285: 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 14:28:24.995503: 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. It started, I deleted everything and installed from scratch. Got this error 2 times when installing: 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 2.19.0 requires keras>=3.5.0, but you have keras 2.10.0 which is incompatible. tensorflow 2.19.0 requires protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.3, but you have protobuf 3.19.6 which is incompatible. tensorflow 2.19.0 requires tensorboard~=2.19.0, but you have tensorboard 2.10.1 which is incompatible. Also got 6x: WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages) When starting software: 2025-06-18 14:28:24.995285: 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 14:28:24.995503: 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. ETA 11,505 secs and increasing. My CPU is working at 100%, 0 VRAM used. My CPU is working at 100%, 0 VRAM used. Intel UHD Graphics working on 3D.

SECourses

cudart64_110.dll is CUDA dll. did you add your cuda paths to both system and user paths? both of them?

Hockey

No I just had it in system, not user paths, however I added all Nvidia including Python paths to the user environment variables. Did I fresh install, got the same errors. I downloaded the cudart file and now I don't get the error when starting the software. However, it still doesn't use the graphics card, still CPU at 100% and Intel GPU working on 3D.

SECourses

add to use path to everything. so everything every path make it both in user and system path and restart pc and try again

Hockey

User and System Paths are identical now, entirely new installation. Same errors as before during installation. CPU 100%, Intel GPU working on 3D, no activity on Nvidia card. I have a file called cudart64_12.dll, I made a copy of it and renamed it to cudart64_110.dll and that error message disappeared, but nothing has changed performance wise. =/ Anyone else with these issues? Thanks for your support.

SECourses

can you delete venv, run installer, send me entire cmd : monstermmorpg@gmail.com also send me logs of running and screenshots of system and user path

Hockey

Just wanted to let you know that I sent you a mail with the files, might need to check your spam box.

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.

SECourses

good idea let me add that as optional

SECourses

added with v8 test and let me know

Hockey

New function is awesome. =D Thank you so much!

ApathyJones

Was there ever a resolution to this? I am getting the same error

Hockey

Unfortunately not, it's the only AI software that acts this way for me. I just use it anyway, I also don't agree with the results of the software. I feel some images that looks supposedly most like the subject is in fact not. So I use it for reference but ultimately I decide myself. I have used Dlib in another software and I felt the same way about it.

SECourses

this was useful back in SDXL days since quality was way lower than FLUX

Hockey

Thank you, works with v9. =)

Hockey

Is it possible to add the other models as well? Human-beings Facenet Dlib VGG-Face ArcFace GhostFaceNet SFace OpenFace DeepFace DeepID

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

Taiga

so, I can dump a bunch of pictures of my students and it will sort them?