Skip to main content

A simple tagger for anime-style images using SmilingWolf models

Project description

WaifuTagger

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

Features

  • Support for multiple SmilingWolf 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.1.tar.gz (7.1 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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: waifutagger-0.1.1.tar.gz
  • Upload date:
  • Size: 7.1 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.1.tar.gz
Algorithm Hash digest
SHA256 3f8c059a693133b88becbe143fc61d337082dff07ab4476a6714a82422cd2ffc
MD5 62f0268f5e21ac4a8f8cbc26b869db7c
BLAKE2b-256 0eb62b3a66287c02e7768b079ebc734e2d47bd59aab767546ce3bebbe58cd5da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: waifutagger-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e7e549aa5e2458bc06f3b96d57c25de17c75a6d0248ff2f965882c312323ed8
MD5 9c8030732048c75288ef4139ace7c86d
BLAKE2b-256 8a4485bfc05d4423d2cb83466d850e47de4718ffff090ff5a5e7a48b419ae5a5

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