img2tags
Tag images by using ONNX Runtime. The current default model is SmilingWolf/wd-vit-large-tagger-v3. It works fine for anime images and with batch sizes greater than 1.
Setup
# For CPU
pip install -U 'img2tags[cpu]'
# For GPU
pip install -U 'img2tags[gpu]'
# If you use CUDA 12.2, the following packages may be needed
sudo apt install libcufft10 libcudart11.0
Run
# Generate .txt file
img2tags -i input_dir
# Generate .json file in another directory with CPU
# --offline: Do not fetch model files (You must have downloaded that model)
img2tags --ext json \
--cpu \
-i input_dir \
-o output_dir \
--offline
# Output to a single file (JSONL)
img2tags --ext jsonl \
--cpu \
-i input_dir \
-o output_filename.jsonl \
--offline
# You can use filelist
img2tags --ext jsonl \
--cpu \
-i target_file_list.txt \
-o output_filename.jsonl \
--offline
You can set thresholds in JSON format like --th {"0": 0.3, "4":0.2, "9":0.3}.
LICENSE
Apache 2.0
Some codes are based on codes in the following project.
References
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
img2tags-1.6.6.tar.gz
(916.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
img2tags-1.6.6-py3-none-any.whl
(12.0 kB
view details)