Skip to main content

A simple tagger for anime-style images using WaifuDiffusion models

Project description

WaifuTagger

A Python package for tagging anime-style images using WaifuDiffusion models. This package provides a simple interface to detect and tag various elements in anime/manga-style illustrations.

Features

  • Support for multiple WaifuDiffusion models
  • Simple and batch image processing
  • Flexible tag output formats
  • Automatic threshold adjustment (MCut)
  • Progress tracking for batch operations

Installation

pip install waifutagger

Quick Start

from waifutagger import WaifuTagger

# Initialize tagger
tagger = WaifuTagger("eva02-large-v3")  # or any other available model

# Process single image
results = tagger.predict("image.jpg")

# Print tags
print(results['rating'])           # Image rating
print(results['general_tags'])     # General tags
print(results['character_tags'])   # Character tags

# Get formatted string
from waifutagger.formatters import format_tags
tags_string = format_tags(results)
print(tags_string)  # "rating_general, 1girl, solo, long_hair, ..."

Available Models

  • swinv2-v3: SmilingWolf/wd-swinv2-tagger-v3
  • convnext-v3: SmilingWolf/wd-convnext-tagger-v3
  • vit-v3: SmilingWolf/wd-vit-tagger-v3
  • vit-large-v3: SmilingWolf/wd-vit-large-tagger-v3
  • eva02-large-v3: SmilingWolf/wd-eva02-large-tagger-v3
  • And more...

Advanced Usage

Batch Processing

# Process multiple images
image_paths = ["img1.jpg", "img2.jpg", "img3.jpg"]
for img_path in image_paths:
    results = tagger.predict(img_path)
    # Save results
    with open(f"{img_path}_tags.txt", "w") as f:
        f.write(format_tags(results))

Custom Thresholds

# Use custom thresholds
results = tagger.predict(
    "image.jpg",
    general_threshold=0.4,    # Higher threshold for general tags
    character_threshold=0.9   # Higher threshold for character tags
)

MCut Thresholding

# Use automatic threshold adjustment
results = tagger.predict(
    "image.jpg",
    general_use_mcut=True,    # Use MCut for general tags
    character_use_mcut=True   # Use MCut for character tags
)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This package is based on the WaifuDiffusion tagger models by SmilingWolf.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waifutagger-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waifutagger-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file waifutagger-0.1.0.tar.gz.

File metadata

  • Download URL: waifutagger-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.0

File hashes

Hashes for waifutagger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfc32cfe7472f00b57ac3cd5846588b3b2a8c29d5f5f7a0ecbaf2a807880d0a9
MD5 25abc267aaff84f15c5b032566ad668c
BLAKE2b-256 55b5eafefc89093e54f2033e67b1198b66ee312b8c81068348cbf1d58107facb

See more details on using hashes here.

File details

Details for the file waifutagger-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: waifutagger-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.0

File hashes

Hashes for waifutagger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 929136d4083bb1d703fec28e9bc9954c172fd472fcf9eb2c7f355a45030b165c
MD5 89cc0585954efb0bd185eea07c6d807a
BLAKE2b-256 39151524bd2eabf9d0a2db9c42a79533496fada54a82f05da6ff3d378b7b5890

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page