Caption Image (WD14, TAGGER)
Auto-tag your images the way anime models were trained
- tagger
- image
- ui_widget
- string
- string_list
- json
- json_list
- chart_dataset
- chip_dataset
If you're captioning images for an anime-base model - Illustrious, Pony, NoobAI, anything in that family - you don't want a language model describing the scene. You want tags, the exact comma-separated booru vocabulary the model was trained on. LF_CaptionImageWD14 is the piece of the LF Nodes suite that runs the WD14 tagger over an image and hands you back that tag list as strings you can feed straight into a training set or a prompt.
This is the tag path of captioning, as opposed to the natural-language path. The Danbooru-trained lineage understands 1girl, long hair, looking at viewer precisely because those are atomic tokens from its training vocabulary - a sentence gets muddier fast. A tag is hard to mis-bind, which is exactly why people still reach for WD14 even in the era of flashier VLMs.
How it works
The node is a consumer: it takes a ready tagger object plus an image, and does the inference. The tagger comes from one of two loader nodes in the same pack:
- LF_LoadWD14Model - the HF/timm backend (transformers + timm), higher quality, heavier.
- LF_LoadWD14Onnx - the onnxruntime backend, lighter and friendlier on CPU.
You wire one of those into the tagger input, feed an image tensor in, and the caption pops out. The three options worth touching are show_probabilities (appends each tag's confidence to the caption), and prefix / suffix, which let you stamp every caption with e.g. masterpiece, best quality or a character token without retagging. The ui_widget input is a count-bar-chart preview that shows you the tag distribution across a batch - handy when you're auditing a LoRA dataset for overused or missing tags.
Outputs
string/string_list- the caption, as a single string or a list for batch processing. This is what you save to.txtfiles next to your training images.json/json_list- the same data structured, for workflows that post-process tags.chart_datasetandchip_dataset- JSON datasets feeding the visualization widgets (ignorable unless you're building the frontend side).
Installing it
lf-nodes installs as one pack:
cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/lf-nodes
then restart ComfyUI (or search "LF Nodes" in ComfyUI Manager). Note the requirements: this trio drags in transformers, timm, and onnxruntime, and the WD14 vit-large model itself is a ~1.3GB download on first load. Budget the disk and the first-run wait.
Common issues
- "No tagger" errors - you must load a tagger node first and wire it in; this node never downloads a model itself.
- Wrong tags for your base - WD14 emits the Danbooru vocabulary. That's correct for Illustrious/NoobAI/Pony-style bases, wrong for natural-language models like Flux, which want prose. Run a describer alongside it if you need both.
- Probability floor - the ONNX loader defaults to 0.4 and the HF loader to 0.25; raise it if your captions come out noisy, lower it if tags you want keep getting dropped.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| tagger | TAGGER | WD14 TAGGER object (ONNX or HF/timm). | |
| image | IMAGE | Image tensor to caption. | |
| show_probabilitiesopt | BOOLEAN | false | If true, include probabilities next to tags in the console-style caption. |
| prefixopt | STRING | Prefix to add to each caption. | |
| suffixopt | STRING | Suffix to add to each caption. | |
| ui_widgetopt | LF_COUNT_BAR_CHART | [object Object] | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| string | STRING | Caption string or list of caption strings. |
| string_list | STRING | List of caption strings. |
| json | JSON | JSON object with additional metadata. |
| json_list | JSON | List of JSON objects with additional metadata. |
| chart_dataset | JSON | Chart dataset for visualization. |
| chip_dataset | JSON | Chip dataset for visualization. |