Danbooru Prompt Comparison
The same prompt scorer, minus the game show
- accuracy
- precision
- recall
- f1-measure
- correct tags (TP)
- wrong tags (FP)
- missing tags (FN)
- input
- answer
If DanbooruPromptQuiz is the arcade cabinet, this is the same game played on a plain desk. No Submit button, no polling server, no JavaScript at all - DanbooruPromptComparison is the exact same scoring math applied to two ordinary text boxes. It's the version you reach for when you don't want a quiz, you want an answer.
Both input and answer here are plain multiline STRINGs. You can type both, wire either, or wire both - nothing is forceInput, and the node computes the moment it runs rather than waiting on your thumb. Because nothing blocks, this one drops cleanly into batch and eval workflows, which is where it actually earns its keep.
Why you'd reach for it
Say you're captioning anime LoRA training data - the WD14 tagger outputs Danbooru-style tags, and the KB's recommendation is exactly that workflow (Illustrious/Pony family models expect that vocabulary). Now you want to know how close two tagging runs are, or how many tags survived a post-process pass. This node answers: it compares two tag lists as sets and scores them like a classification task. Compare tagger output against a reference list, benchmark two prompting strategies against the same ground truth, or check what an upscale/refine pass dropped. The game sibling can't do any of that without a human pressing a button.
How it works
It's a subclass of DanbooruPromptQuiz, so it inherits the same _check: both strings run through comfy.sd1_clip.token_weights, get split on commas, and compared as sets. Tags in both lists are True Positives, tags only in input are False Positives, tags only in answer are False Negatives. Outputs are precision, recall, F1, and an "accuracy" that's really the Jaccard index (TP / TP+FP+FN), plus the tag breakdowns.
Inputs and outputs
input- first tag list, multiline. Typable or wireable.answer- second tag list. The name is a leftover from the quiz; there's no "correct answer" semantics here, it's just list number two.
Outputs: accuracy, precision, recall, f1-measure as FLOATs; correct tags (TP), wrong tags (FP), missing tags (FN) as comma-joined STRINGs; plus input and answer passed through. Wire the FLOATs to a display node or read them in the widget.
Installing
Same pack as the quiz - install once, both nodes appear. ComfyUI Manager: search "DanbooruPromptQuiz". Or:
cd ComfyUI/custom_nodes
git clone https://github.com/nkchocoai/ComfyUI-DanbooruPromptQuiz
Restart ComfyUI after. No model downloads, no extra Python dependencies beyond core ComfyUI.
Gotchas
The exact-match rule is the one that bites: tags are compared as literal strings, so blue_eyes won't match blue eyes, and a weighted (tag:1.2) won't match plain tag. Keep both inputs in the same tag format and the numbers will mean what you think they mean. And since this is set-based, ordering doesn't matter at all - which is usually what you want when comparing tag lists, but worth remembering if you were hoping for a similarity score that respects sequence.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input | STRING | — | |
| answer | STRING | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| accuracy | FLOAT | — |
| precision | FLOAT | — |
| recall | FLOAT | — |
| f1-measure | FLOAT | — |
| correct tags (TP) | STRING | — |
| wrong tags (FP) | STRING | — |
| missing tags (FN) | STRING | — |
| input | STRING | — |
| answer | STRING | — |