Using Taggers with ComfyUI  「タガーを使う」

27/08/2024

AI ComfyUI Workflow

in English

Let's take a look at using ComfyUI with "Tagger", which allows us to analyze and tag images.

There are various types of Tagger available, but for this example, we'll be using the most well-known WD14.

pythongosssss/ComfyUI-WD14-Tagger: A ComfyUI extension allowing for the interrogation of booru tags from images.

pythongosssss/ComfyUI-WD14-Tagger: A ComfyUI extension allowing for the interrogation of booru tags from images.

A ComfyUI extension allowing for the interrogation of booru tags from images. - pythongosssss/ComfyUI-WD14-Tagger

Please search and install "ComfyUI-WD14-Tagger" via ComfyUI Manager.


Firstly, let me show you how to use it simply. Please download this workflow and drag-and-drop it onto Comfy UI's screen.


As part of this workflow, I've introduced a custom node "ComfyUI-Custom-Scripts" to display text. If you already have a node set up to display text, feel free to connect it instead. However, if you're missing this node, please click on "Install Missing Custom Nodes" within the ComfyUI Manager and install ComfyUI-Custom-Scripts.

pythongosssss/ComfyUI-Custom-Scripts: Enhancements & experiments for ComfyUI, mostly focusing on UI features

pythongosssss/ComfyUI-Custom-Scripts: Enhancements & experiments for ComfyUI, mostly focusing on UI features

Enhancements & experiments for ComfyUI, mostly focusing on UI features - pythongosssss/ComfyUI-Custom-Scripts

As I load an image into the Load Image Node, and run the queue, the tags are displayed.

With this, you can easily generate images with similar features by connecting it to a Positive Prompt. To get started, download the workflow and drag-and-drop it onto the ComfyUI screen.



Now, let's move on to processing multiple images at once. This workflow can be used for creating caption files when making LoRAs. Please download this workflow and drag-and-drop it onto the ComfyUI interface.


To run batch processing, you need a new custom node "Image-Captioning-in-ComfyUI". If it's not installed, you'll see a red area indicating missing nodes in ComfyUI Manager. Please select Install Missing Custom Nodes from there and install Image-Captioning-in-ComfyUI.

LarryJane491/Image-Captioning-in-ComfyUI: Custom nodes for ComfyUI that let the user load a bunch of images and save them with captions (ideal to prepare a database for LORA training)

LarryJane491/Image-Captioning-in-ComfyUI: Custom nodes for ComfyUI that let the user load a bunch of images and save them with captions (ideal to prepare a database for LORA training)

Custom nodes for ComfyUI that let the user load a bunch of images and save them with captions (ideal to prepare a database for LORA training) - LarryJane491/Image-Captioning-in-ComfyUI


I recommend creating a folder beforehand containing the images you'd like to caption. Enter the full path of this folder into the "LoRA Caption Load" node's Path field. Upon execution, each image will be analyzed with tags and corresponding captions will be saved as .txt files within the same folder.

If you'd like to add a prefix, enter to the "LoRA Caption Save" node's prefix field.

Note: Currently only PNG files are supported. For details, please check out the GitHub page mentioned above.



日本語解説 (in Japanese)

画像を解析してタグ付けができる「タガー」をComfyUIで使ってみましょう。

タガーには何種類かありますが、今回は一番有名なWD14を使用します。

pythongosssss/ComfyUI-WD14-Tagger: A ComfyUI extension allowing for the interrogation of booru tags from images.

pythongosssss/ComfyUI-WD14-Tagger: A ComfyUI extension allowing for the interrogation of booru tags from images.

A ComfyUI extension allowing for the interrogation of booru tags from images. - pythongosssss/ComfyUI-WD14-Tagger

ComfyUI Manager で ComfyUI-WD14-Tagger を検索して導入してください。


まずシンプルな使い方です。こちらのワークフローをダウンロードして、ComfyUIの画面上にドラッグ&ドロップしてください。


このワークフローではテキストを表示させるため、カスタムノード ComfyUI-Custom-Scripts を導入しています。すでにテキストを表示させるノードを導入済みの場合はそちらを接続してください。未導入の場合は ComfyUI Manager から Install Missing Custom Nodes をクリックし、ComfyUI-Custom-Scripts をインストールしてください。

pythongosssss/ComfyUI-Custom-Scripts: Enhancements & experiments for ComfyUI, mostly focusing on UI features

pythongosssss/ComfyUI-Custom-Scripts: Enhancements & experiments for ComfyUI, mostly focusing on UI features

Enhancements & experiments for ComfyUI, mostly focusing on UI features - pythongosssss/ComfyUI-Custom-Scripts


Load Image ノードに解析したい画像をロードし、キューを実行するとタグが表示されます。

これを利用すると、ポジティブプロンプトに接続することで似た特徴をもつ画像を簡単に生成できます。こちらのワークフローをダウンロードして、ComfyUIの画面上にドラッグ&ドロップしてください。


さて、次は複数の画像をまとめて処理する方法です。こちらはLoRA作成時のキャプションファイル作りに使えます。こちらのワークフローをダウンロードして、ComfyUIの画面上にドラッグ&ドロップしてください。


バッチ処理をするため、新たにカスタムノード Image-Captioning-in-ComfyUI が必要になります。未導入の場合はノードが赤くなっている箇所があるので、ComfyUI Manager から Install Missing Custom Nodes を選択し、Image-Captioning-in-ComfyUI をインストールしてください。

LarryJane491/Image-Captioning-in-ComfyUI: Custom nodes for ComfyUI that let the user load a bunch of images and save them with captions (ideal to prepare a database for LORA training)

LarryJane491/Image-Captioning-in-ComfyUI: Custom nodes for ComfyUI that let the user load a bunch of images and save them with captions (ideal to prepare a database for LORA training)

Custom nodes for ComfyUI that let the user load a bunch of images and save them with captions (ideal to prepare a database for LORA training) - LarryJane491/Image-Captioning-in-ComfyUI


あらかじめキャプションファイルを作りたい画像群を一つのフォルダに入れておきます。LoRA Caption Load ノードの Path にフォルダのフルパスを入力します。実行すると各画像がタガーで解析され、同じフォルダ内にキャプションファイルが txt 形式で保存されます。

プレフィックスを付け足したい場合は、LoRA Caption Save ノードの prefix に必要な文言を入力してください。

注意点として、現在はPNGファイルのみ対応ということです。詳しくは前述のgithubページでご確認ください。


Ko-fi

Major Contents

Contact us

名前

メール *

メッセージ *

QooQ