Nodes/ComfyUI-DanbooruPromptQuiz/Danbooru Prompt Quiz
ComfyUI Node

Danbooru Prompt Quiz

Turn ComfyUI into a prompt-guessing game — and get F1-scored for it

By nkchocoai·Created 2 years ago·Updated about a year ago· 0
Danbooru Prompt Quiz
  • any
  • accuracy
  • precision
  • recall
  • f1-measure
  • correct tags (TP)
  • wrong tags (FP)
  • missing tags (FN)
  • input
  • answer
input
answer

This is the only node I know that turns ComfyUI into a quiz show. You look at a generated image, try to name the Danbooru tags that produced it, hit a Submit button, and get graded like you just handed in a classification homework - precision, recall, F1, the works. It's from nkchocoai, the same author who brings you a bunch of ComfyUI toys, and it's exactly as niche as it sounds. It's also genuinely fun if you run anime models and want to train your own eye for tags.

Here's the game: something like TIPO or the WD14 Tagger writes a tag prompt, an image gets generated from it, and you have to reverse-engineer the prompt from what you see. The node then compares your guess to the ground-truth tag list. If you've spent any time on Illustrious or NoobAI you know the stakes - a correct tag beats a sentence for control, and this node is basically a drill for learning which tag means what.

How it works

The Quiz version is the interactive one, and it needs the frontend. When you press Submit, the JS posts your typed guess to ComfyUI's /dpq_submit endpoint, and the Python side blocks until that message arrives. Then both strings get run through comfy.sd1_clip.token_weights, split on commas, and compared as sets: correct tags are your True Positives, tags you guessed that aren't in the answer are False Positives, and tags you missed are False Negatives.

One detail worth knowing: the "accuracy" output is computed as TP / (TP + FP + FN) - which is the Jaccard index, a.k.a. IoU, not accuracy in the ML sense. Fine for a game, but don't quote it as a percentage you understand intuitively. Precision, recall, and F1 are the familiar formulas.

The inputs and outputs that matter

  • input - your guess. A multiline STRING you type into, comma-separated tags, same style as the prompt you'd feed the model.
  • answer - the ground truth. It's forceInput, so you can't type it: wire it to your TIPO/tagger output. This is the field that holds the original prompt that made the image.
  • any - an optional wildcard input you can ignore.

Outputs: four FLOATs (accuracy, precision, recall, f1-measure), three STRINGs for the tag breakdown (correct tags (TP), wrong tags (FP), missing tags (FN)), plus the input and answer passed through. Wire the FLOATs to a text display or just read them in the widget.

Installing

ComfyUI Manager is the easy path - search "DanbooruPromptQuiz". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/nkchocoai/ComfyUI-DanbooruPromptQuiz

Then restart ComfyUI - this one ships a JS frontend, so a restart (or Refresh button dance) matters. No model files to download and no extra Python deps; it only imports comfy.sd1_clip, which is core ComfyUI. The pack installs two nodes; you get the comparison sibling in the same shot.

Where people get burned

  • The queue blocks until you press Submit. The node polls every 0.1s waiting for your button press, so an unattended or batch run will just sit there forever. That's by design for a game - but it's why the sibling DanbooruPromptComparison exists for automation.
  • Tags are exact string matches. blue_eyes and blue eyes don't match; a weighted (tag:1.2) won't match plain tag. Keep your guesses in the same format the tagger emitted.
  • answer is forceInput - beginners double-click it expecting to type and find they can't. Wire it or the comparison is meaningless.
  • No Submit button showing up? You didn't restart after installing.

One honest caveat: this scores you against whatever TIPO or the tagger produced, not against objective truth. Taggers disagree with each other all the time. Treat a low score as "my guess didn't match this particular tagger," not "I'm bad at this."

Categorysd

Inputs (3)

NameTypeDefaultDescription
inputSTRING
answerSTRING
anyopt*

Outputs (9)

NameTypeDescription
accuracyFLOAT
precisionFLOAT
recallFLOAT
f1-measureFLOAT
correct tags (TP)STRING
wrong tags (FP)STRING
missing tags (FN)STRING
inputSTRING
answerSTRING