Subject Cropper and Face Focused Image Resizer Scripts for Training (Patreon)
Downloads
Content
Subject cropper and face focused image resizer scripts that prepare better training images with YOLO v10 cropping and GPU resizing; replaced by a newer app.
Note: this is an older post kept for reference. The current, maintained version is Ultimate Image Processing App: 1-Click Batch Cropping, SAM 3.1 Masking.
SOTA scripts for better training: run the auto subject cropper first and then the resizer to get perfect images, saved as PNG. The post is no longer maintained; a newer batch image pre-processing Gradio app replaces it.
16 September 2024
NOW WE HAVE A MUCH BETTER NEW APP PLEASE USE IT
https://www.patreon.com/posts/112126955
NEW APP : https://www.patreon.com/posts/112126955
THIS POST WONT BE MAINTAINED ANYMORE
USE NEW APP https://www.patreon.com/posts/112126955
16 September 2024
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)
10 September 2024 Update
Auto subject cropper scripts updated to Yolo v10
Working amazing posted here example : https://www.reddit.com/r/SECourses/comments/1fdrv17/upgraded_my_auto_subject_cropper_zoomin_script_to/
Download the latest zip file from here : Subject_Cropper_v1.zip
The zip file includes latest best official Yolov10 model file as well
Also I have added Yolo_10_Class_List.txt which shows the classes that Yolov10 supports
Hopefully I will make a Gradio APP that has both auto cropper and the auto resizer scripts
Hopefully i will make RunPod and Massed Compute installers later
First run auto cropper then resizer to get perfect images
Cropped files will be saved as PNG to not lose any quality
Full tutorial video > https://youtu.be/Fbuyu35TkE4
3 August 2024 Update
Resizer scripts updated to Resizer_v3.zip file
find_dups_hashes.py file finds duplicates or similar images with threshold
change cutoff=2 to find similar images
Explanation : https://poe.com/s/GNVIQpjRgOfGIm6TZoJP
16 November 2023 Update:
Face resizer will extract only faces.
Resize is optional
13 November 2023 Huge Update:
Re-download resize_images_v4 .zip file
Do a fresh install into a new folder - so GPU support will be enabled
Now supports GPU as well. GPU is like 3x faster than 13900K CPU
Save as PNG option added as a boolean parameter. Default set to False
30 October 2023 Huge Update:
Please also upvote this Reddit Thread if possible
Yolo v7 based cropper script updated and now works much better.
The improvement of cropping quality is huge.
All of the shared classification / regularization datasets will be also hopefully updated
Windows Requirements
Make sure that you followed below video and installed below exactly as in video
Python 3.10.11 works with all of the AI apps I used so far
Python 3.10.11, FFmpeg, Cuda 11.8, C++ tools and Git
If it doesn't work make sure to below tutorial and install everything exactly as shown in this below tutorial
Who has fbgemm.dll error on Windows 11 the solutions posted below topic
Quick solution is as below (verified DLL)
Download this dll and copy it to your /windows/system32 folder. https://www.dllme.com/dll/files/libomp140_x86_64/00637fe34a6043031c9ae4c6cf0a891d/download
Who has C++ tools related errors : Solving CUDA and C++ Tools Compiling Errors Once and For All for Python AI Applications > https://www.patreon.com/posts/111553210
Let me know if you encounter any problem and hopefully I will fix it ASAP. Please read very carefully.
I have updated my previous subject cropper script to Yolo V7 with improved logic. I had explained that script in this video : https://youtu.be/QTYX0tgA5ho
Also I was using Automatic1111 image preprocessing script to resize images into the desired resolution with face focus. However it is broken and not working correctly. Therefore I have written my State Of The Art (SOTA) image resizer script as well.
I used these scripts to process all of the images shared in this amazing regularazation / classification images dataset > https://www.patreon.com/posts/massive-4k-woman-87700469
Hopefully I will make a video to how to use these 2 new scripts. They are pretty easy actually.
How To Use Subject Cropper
Click here to download latest zip file.
It includes install and run . bat files. Install . bat file will make new venv and install everything for you. This won't affect your other installations like Automatic1111.
Then edit cropper_v8 . py and change INPUT_FOLDER & OUTPUT_FOLDER and set your desired ASPECT_RATIOS. This script will crop the subject with maximum resolution while trying to keep desired aspect ratio. It won't crop the parts of the subject. So aspect ratio may not be 100% correct. We will use resizer script to make them perfect size and aspect ratio.
Yolo V10 supports different classes as well. So you can change person into different classes you wish.
How To Use SOTA Image Resizer - Downscaler
Download attached Resizer_v3.zip . It includes install and run . bat files. Install . bat file will make new venv and install everything for you. This won't affect your other installations like Automatic1111.
Edit resizer_v4. py file and change folder paths and resolutions that you are looking for. This script will crop the image with focus of a person face if that exists. This is an amazing script to prepare different resolution training images datasets.
This script also uses best downscaling algorithm and save images with best quality. Also the script supports fully multi-threading. It is set to 2 threads. If your CPU is better increase it to like 10.
Related posts
Ultimate Image Processing App: 1-Click Batch Cropping, SAM 3.1 Masking
All JoyCaption Apps: 1-Click Installers With Batch Captioning
Ultimate Image Processing App Released: Batch Crop, Resize & SAM 3.1
All posts in this topic: Captioning, Dataset and Image Processing Tools · New to SECourses? Start Here: Best and Most Popular SECourses Posts
Files