wdsort is a command-line interface (CLI) tool designed to help users sort images into folders using the WaifuDiffusion model.
This program utilizes the model from Hugging Face - SmilingWolf/wd-v1-4-swinv2-tagger-v2 to categorize images based on their content.
- Image Sorting: Automatically sort images into designated folders based on their content.
- Easy to Use: Simple CLI commands for easy access to users of any skill level.
Before using wdsort, ensure you have the following:
- Python 3.7 or higher
- The ability to manage virtual environments using
venv
-
Clone the repository:
git clone https://github.com/yourusername/wdsort.git
-
Navigate to the project directory:
cd wdsort
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\activate
-
On Unix or MacOS:
source venv/bin/activate
-
-
Install dependencies using pip:
pip install -r requirements.txt
-
Download
model.onnx
,selected_tags.csv
, andconfig.json
from Hugging Face. -
Place these files in the
model
directory.
Once the virtual environment is activated, you can:
-
To Scan by Folder
With a bias towards the first character identified. Otherwise, the first tag found.
python wdsort.py --folder "path/to/folder"
-
To Assess Tags of Single Image
Output all tags for a single image to the console.
python wdsort.py --scan "path/to/image"
-
Sort By Specific Tag
Will sort by a specified "tag" and any combination where that tag is used (e.g., "eat" and "eating").
python wdsort.py --bytag "tag"
-
Exclude tag(s)
Will exclude the tags specified in conjunction with --folder tags.
python wdsort.py --folder "path/to/folder" --exclude "tag1" "tag2"
-
Sort Files by Type and Orientation
python wdsort.py --folder "path/to/folder" --sort
To exit the virtual environment, type:
deactivate
This is not the perfect solution for organizing images. I am new to programming in general, so there is still a lot of work to do. Primary credit goes to SmilingWolf for offering the model on HuggingFace.
If this program provides any legal issues to anybody, please let me know and I will take it down promptly.
- Add more customized sorting criteria