Imgutils Tags
The tag-string janitor for training captions
- tags
Tagger nodes are great at making a mess. They hand you 80 comma-separated tags - half of them redundant, a chunk of them quality-tag filler like "masterpiece" and "best quality," and a few that are the character name you specifically want out of the training caption. Imgutils Tags is the cleanup step: it's a string-processing node that filters, sorts, and reformats tag lists so your training captions look the way the textbooks say they should. It's part of the xiaden/comfyui-imgutils pack, wrapping the tag utilities from the deepghs/imgutils library.
The input is a single multiline tags string - comma- or newline-separated works. Optionally each tag can carry a score in tag: 0.95 form, which the node parses and preserves. The mode dropdown picks one of nine operations:
- Drop Blacklisted (default) - removes quality/rating filler tags from the known Danbooru blacklist.
- Drop Basic Character - strips generic character tags (the "1girl", "solo" style basics you don't want baked into a character LoRA).
- Drop Overlap - removes redundant tags where one implies another.
- Sort Original / Sort by Score / Shuffle - ordering modes; sort-by-score is the one you want when your tags came with confidence values.
- Spaces to Underscores / Underscores to Spaces - Danbooru-style format conversion, which matters because taggers and training bases disagree on which they expect.
- Format Text - renders the set as a training-ready caption string.
The single output is the processed tags string.
What you'd actually use it for
Straight into the captioning story from the lora-training essay: for Illustrious/Pony/NoobAI you caption with Danbooru tags, and the standing advice is to leave changeable things tagged and fixed things untagged. In practice that means your WD14 output needs the quality tags dropped (they're a training crutch, not content), character basics removed, and the order cleaned up. Imgutils Tags is the node you chain right after the tagger to get from raw output to a defensible caption. And since it accepts scored input, you can run Sort by Score, then drop anything below a bar, then Format Text - one pipeline from raw tags to dataset-ready.
Install & gotchas
cd ComfyUI/custom_nodes/
git clone https://github.com/xiaden/comfyui-imgutils.git
cd comfyui-imgutils
pip install -r requirements.txt
Restart ComfyUI. Requires ComfyUI 0.25.0+ (V3 node API pack). No model downloads - this is pure text processing, instant and offline-safe, so it's the one node in the tagging section that works before any weights finish downloading. Two practical notes: it processes one operation at a time (a single dropdown, not a chain), so a full cleanup is usually several of these nodes in series; and the blacklist it drops is the imgutils one, which is a known-good default but not your project's list - for a custom blocklist you'll still want to do that filtering yourself.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| tags | STRING | Tags to process. Comma-separated or newline-separated. Optionally include scores as 'tag: 0.95'. | |
| mode | COMBO | Drop Blacklisted | Processing operation — filtering, sorting, format conversion, or text formatting. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| tags | STRING | — |