DeepFace & RetinaFace Script: Sort AI Images by Similarity (Patreon)
Downloads
Content
DeepFace and RetinaFace script that sorts AI generated images by similarity to your original photos so you can find the best ones; replaced by a newer app.
Note: this is an older post kept for reference. The current, maintained version is DeepFace Face Similarity Sorter: 1-Click Batch Image Sorting App.
The older scripts (findBestImagesV4 with RetinaFace face detection) run on Windows with CPU or GPU venvs and on RunPod, and can append model, clip skip and LoRA info to file names. The post itself says it is deprecated in favor of the DeepFace batch face similarity sorting Gradio app.
With DeepFace & RetinaFace libraries we will sort AI generated images with best accuracy to your original. Thus, you can find best ones
this post is deprecated new app is here : https://www.patreon.com/posts/121335747
https://www.patreon.com/posts/121335747
new app is here : https://www.patreon.com/posts/121335747
new app post : https://www.patreon.com/posts/121335747
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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)
=======
Super Important Windows Requirements
Python 3.10, FFmpeg, CUDA 12.4, cuDNN 8.9 or above, C++ tools and Git
If it doesn't work make sure to below tutorial and install everything exactly as shown in this below tutorial
30 January 2025 Update:
All files put into single zip file sort_by_similarity_v2.zip
Tested and verified
Ignore the confliction errors you get at the end
pip freeze info added
findBestImagesV4 .py is the latest version
run .bat file will use findBestImagesV4 by default
do not forget to change image folders before execute run .bat file
Requirements python 3.10.x - I prefer 3.10.11 version
23 November 2023 Update:
runpod_installer. sh updated to support GPU on RunPod - reinstall
Now many times faster
Don't forget to execute
apt update
yes | apt install -y libcudnn8=8.9.6.50-1+cuda11.8 libcudnn8-dev=8.9.6.50-1+cuda11.8 --allow-change-held-packages
1 October 2023 Update:
If you get zlib error put also zlibwapi.dll into the folder
findBestImagesV4 .py added to the scripts. This new version will use RetinaFace library to find faces
With this upgrade, it will find faces with much much better accuracy than before
run .bat file will run findBestImagesV4 .py by default
Also we upgraded to extract_faces method from deprecated detectFace method
30 September 2023 Update:
Auto installers for Windows added
install-cpu .bat file will compose a venv and install. This venv will use CPU
install-gpu .bat file will compose a venv and install. This venv will use GPU
Edit run. bat file to make it run findBestImagesV3. py
findBestImagesV3. py file will run as a single thread. If you use CPU you can increase number of threads
July 7 Update: RunPod installer and instructions are added.
Tutorial video : https://www.youtube.com/watch?v=343I11mhnXs
Script file and PDF file updated. Script has been improved.
If you upvote our reddit thread I would appreciate that very much : https://www.reddit.com/r/DreamBooth/comments/137zesc/novel_how_to_find_best_stable_diffusion_any_ai/
Download the attached files findBestImages .py
Follow the tutorial to use the script
Please comment and ask me any questions. I can also improve the script based on your needs.
12 May 2023
1 August 2023 - improved
Upon a request of one of your beloved supporters I have added findBestImagesV2 .py
findBestImagesV2 .py Will append model name, skip clip count (if only above 1) and used lora info to the image name. E.g. V2 file name : 1 - 0.266 - deliberate_v2, Clip skip 2 -lora-256rank-000007-1-
Auto Installer For RunPod
Each time you restart RunPod or turned it off and turned it on 1 time below command
apt update
yes | apt install -y libcudnn8=8.9.6.50-1+cuda11.8 libcudnn8-dev=8.9.6.50-1+cuda11.8 --allow-change-held-packages
Download and upload runpod_installer .sh into workspace
Then run below commands
chmod +x runpod_installer.sh
./runpod_installer.sh
For using you need to activate first. Execute below command
source deep_face_venv/bin/activate
python findBestImagesV4.py
Don't forget to edit folder paths accordingly to RunPod
Such as
org_images_folder_path = r"/workspace/org"
generated_images_folder_path = r"/workspace/generated"
detected_faces_folder_path = r"/workspace/detected"
-
-
Related posts
DeepFace Face Similarity Sorter: 1-Click Batch Image Sorting App
Ultimate Image Processing App: 1-Click Batch Cropping, SAM 3.1 Masking
All JoyCaption Apps: 1-Click Installers With Batch Captioning
All posts in this topic: Captioning, Dataset and Image Processing Tools · New to SECourses? Start Here: Best and Most Popular SECourses Posts