Booru tags

How to choose a confidence threshold for auto-tagging

The short answer

A WD14 tagger gives every tag in its vocabulary its own score between 0 and 1. The threshold is the minimum score a tag needs to be written. A lower threshold catches more of what is in the image but adds more wrong tags. A higher one is more accurate but misses things. ImgTagger's default of 0.35 is a sound starting point for training captions. Try about 0.5 when you need tags you can trust for search, and around 0.85 when the goal is identifying characters.

The Confidence Threshold slider in the ImgTagger auto-tagger runs from 0 to 1 in steps of 0.01 and starts at 0.35. It is the single setting with the biggest effect on what ends up in your captions. Set it well and you spend minutes pruning a dataset instead of hours.

This guide explains what the number actually measures, what you gain and lose by moving it, and how ImgTagger's built-in exceptions, blacklist and score cache fit around it.

What the confidence score means

The WD14 models end in a sigmoid layer. A sigmoid squeezes each raw output into a value between 0 and 1, and it is applied to every tag separately. The ConvNeXt V2 and SwinV2 models produce 9,083 scores per image, one for each tag in their vocabulary. Each score is the model's estimate of how likely that one tag is to apply.

Because the scores are independent, they don't add up to 1 and they don't compete. An image can score 0.97 for 1girl, 0.95 for solo and 0.91 for long_hair all at once. That is how a tagger returns thirty tags instead of picking one label, the way a single-answer classifier does. It has three practical consequences:

  • Contradictions can pass. Nothing forces brown_hair and black_hair to cancel out. If both clear the threshold, both are written.
  • Ratings are scored the same way. ImgTagger checks each of the four rating tags against the threshold separately, so an image can occasionally get two ratings, such as general and sensitive. SmilingWolf's own demo keeps ratings out of the tag list and shows all four scores in a separate box instead.
  • Read scores as a ranking. A 0.9 tag is far more likely to be right than a 0.4 tag. A 0.6, though, doesn't mean exactly a 60% chance.

Precision and recall in plain English

Two measures describe what a threshold does:

  • Precision: of the tags written, how many are correct?
  • Recall: of the things actually in the image, how many got a tag?

Raising the threshold improves precision and lowers recall. Lowering it does the opposite. No setting maximizes both, so the right value depends on which mistake costs you more. In a training caption, a wrong tag teaches the model a false link. A missing tag leaves that feature unlabeled, and it tends to get absorbed into whatever else the caption says. Our guide to captioning a LoRA dataset covers why that matters.

The published model cards give a useful reference point. For ConvNeXt V2 and SwinV2, precision and recall come out equal at thresholds of 0.3710 and 0.3771 on their validation sets, with an F1 score of about 0.686. ImgTagger's 0.35 sits just below that balance point, so it leans slightly toward catching more tags. SmilingWolf's WD tagger demo and the WD14 script in kohya-ss sd-scripts also default to 0.35 for general tags.

A worked example at four thresholds

Hypothetical example

The scores below are invented to illustrate the trade-off. They are not real model output, but the pattern is typical of what you will see.

Picture an image of one girl with long brown hair. She wears a blazer school uniform and smiles at the viewer under cherry trees on a sunny day, with petals blowing in the wind. Here is what a tagger might score:

TagScoreCorrect?0.20.350.50.7
1girl0.97Yes✓✓✓✓
solo0.95Yes✓✓✓✓
long_hair0.91Yes✓✓✓✓
outdoors0.86Yes✓✓✓✓
cherry_blossoms0.82Yes✓✓✓✓
smile0.74Yes✓✓✓✓
school_uniform0.68Yes✓✓✓
looking_at_viewer0.61Yes✓✓✓
brown_hair0.55Yes✓✓✓
serafuku0.46No (it's a blazer)✓✓
petals0.43Yes✓✓
tree0.39Yes✓✓
holding0.36No (hands are empty)✓✓
blue_sky0.31Yes✓
day0.27Yes✓
black_hair0.24No✓
hair_ornament0.23No✓
wind0.21Yes✓
blazer0.17Yes

Fifteen of these tags are true for the image. Here is how each threshold scores against them:

ThresholdTags writtenWrongTrue tags missedPrecisionRecall
0.2184178%93%
0.35132485%73%
0.5906100%60%
0.7609100%40%

Read across the rows and the trade-off is plain. At 0.7, every tag is right, but the caption could describe almost any outdoor picture of a smiling girl. At 0.2 you catch the sky, the time of day and the wind, but you also get two hair colors and a hair ornament that isn't there. The default 0.35 lands in between: a useful caption with two errors to delete. Notice too that blazer is missed at every setting. No threshold fixes a tag the model barely saw, so you add those by hand.

ImgTagger's default and built-in exceptions

A tag is kept when its score is equal to or higher than the threshold. A few tags ignore the slider and use fixed values instead:

TagsRequired scoreWhat it means in practice
monochrome, greyscale, sketch, blurry0.9These rarely appear unless the image clearly is black and white, sketchy or blurred.
simple_background, white_background, grey_background0.5Background tags need moderate confidence.
general (rating)0.1The safe rating appears on almost every ordinary image.

The list also includes lowres at 0.9, but none of the three models can output that tag, so it has no effect. Because these values are fixed, they hold whatever the slider says. Raise the slider to 0.8 and simple_background still needs only 0.5, while general needs only 0.1. Drop it to 0.2 and monochrome still needs 0.9. To get rid of one of these tags completely, use the blacklist.

Why character tags often get a stricter threshold

Other tools usually keep a separate threshold for character tags. SmilingWolf's demo defaults to 0.35 for general tags and 0.85 for characters. The kohya-ss script has separate --general_threshold and --character_threshold options, both of which fall back to --thresh (0.35) if you don't set them. There are good reasons to be stricter with characters:

  • A wrong name is a bigger error. A wrong hair color is a small mistake. A wrong character name claims an identity and ties the whole image to it.
  • Character tags have less data behind them. In the v2 tag list, the median character tag has 1,362 posts, against 2,735 for general tags. 678 of the 2,132 characters had fewer than 1,000 posts.
  • Lookalikes are common. Characters with similar hair and outfits, fan art in unusual styles and original characters can all pull plausible but wrong names to moderate scores.

ImgTagger has one slider for every tag. If you want stricter character tags, you have three options. You can tag at a high threshold when names are the point. You can tag normally, then check each character name in the Filter panel and delete wrong ones from the whole batch with its trash button. Or you can switch to the ViT model, which has no character tags at all. Our comparison of the WD14 models covers that trade-off.

Use the blacklist for tags you never want

The threshold deals with uncertain tags. The blacklist deals with tags that are certain but unwanted. If simple_background scores 0.95 on every image, raising the threshold high enough to drop it would throw away dozens of good tags as well. Blacklisting it removes just that one.

Blacklist entries are comma-separated, and each must match a whole tag. Case doesn't matter, and underscores count as spaces, so simple_background, Simple Background and simple background all block the same tag. ImgTagger remembers the list in your browser between visits. The blacklist also beats the built-in exceptions: blacklisting general removes it even though it only needs 0.1. Typical entries are the four rating tags and tags you plan to replace with your own wording. The tag pruning guide covers how to choose them.

For anything you didn't anticipate, the summary window that appears after each run lists every tag that was added. One click removes a tag from every image that run added it to.

Re-running is cheap, but tags stack

After the first pass, ImgTagger keeps each image's raw scores in memory, separately for each model. If you change the threshold or blacklist and run again, it skips the model and simply re-filters the saved scores, which is much faster than the first pass. Switching to a different model means new inference, though switching back reuses the earlier scores. The scores live only in the open tab. Reloading the page clears them.

There is a catch. A re-run never removes tags. New results are merged with the tags each image already has, so raising the threshold after a 0.2 run won't strip the low-confidence tags from that run. To compare settings fairly:

  1. Pick 10–20 images that represent your dataset, with varied framing and lighting, and select them.
  2. Use "Clear all tags" on the selection. This also removes tags loaded from .txt files or typed by hand, so do your testing before any manual editing.
  3. Run "Auto-tag selected" at the new threshold and read the results.
  4. If you are mostly deleting wrong tags, raise the threshold by 0.05. If you are mostly adding obvious missing ones, lower it by 0.05. Repeat.

When the sample looks right, tag the rest of the batch.

These are starting points to test on your own images, not fixed rules. Your art style, model choice and goal will all move the best value.

GoalStart atThen
LoRA or fine-tune training captions0.35Prune by hand. Try 0.3 if captions miss obvious things, or 0.4 if you delete many wrong tags.
Searching and organizing a collection0.5Filtering by a tag should return images that really have it. For a one-off hunt where you will check results by eye, 0.3 finds more.
Identifying characters0.85Expect few general tags at this level. If you need both, tag at 0.35 and verify each name in the Filter panel instead.
Exploring what the model sees0.2Good for discovering tag names to search for or blacklist. Too noisy for captions.

If a tag shows up that you don't recognize, look it up in our booru tag glossary before deciding whether to keep it.

Put this into practice

Run WD14 tagger models on a whole folder, then search, filter and bulk-edit the tags before exporting .txt caption files. It runs entirely in your browser. Open the Batch WD14 Tagger & Editor.

Frequently asked questions

Why does a tag's score change when I crop the image slightly?

Every image is padded to a square and resized to 448×448 pixels before the model sees it. Cropping changes what fills that square and how many pixels each detail gets, so scores shift. Tags near your threshold can flip in or out. That is normal, and it is one more reason to check the borderline tags at the end of each list.

Can I set my own threshold for one specific tag?

Not in ImgTagger's interface. The built-in exceptions are fixed. To drop a tag, blacklist it. To be stricter with one tag, filter the batch by that tag in the Filter panel, check the matching images and remove it where it is wrong.

Should I use the same threshold for every model?

For ConvNeXt V2 and SwinV2, yes as a start. Their published balance points are close (0.371 and 0.377). The ViT model has no published figures, so test a sample of images before relying on the same value.

What happens if I set the slider to 0?

Every score is 0 or higher, so every tag in the vocabulary passes except the few with built-in exceptions. Each image would get thousands of tags. In practice, values below about 0.15 mostly add noise.