Nodes/cgem156-ComfyUI๐ŸŒ/Grad Cam Auto ๐ŸŒ
ComfyUI Node

Grad Cam Auto ๐ŸŒ

Heatmap every tag above a confidence threshold, no target needed

By laksjdjfยทCreated 2 years agoยทUpdated about a month agoยท 93
Grad Cam Auto ๐ŸŒ
  • tagger
  • features
  • IMAGE
โ—„threshold0.30โ–บ
โ—„heat_map_alpha0.30โ–บ
โ—„intepolatebilinearโ–บ

Grad Cam Auto is the hands-off sibling of Grad Cam: instead of you naming a specific tag to explain, it sweeps every tag the WD-tagger predicted above a confidence threshold and combines their attention regions into a single heatmap. Where Grad Cam answers "why did the tagger call this blue_hair?", this one answers the broader question: "across everything the tagger is confident about in this image, where is it actually looking?"

Why the automatic version is useful

Naming a target tag ahead of time assumes you already have a specific question. Grad Cam Auto is for when you don't - you just want a fast visual sanity check across a whole batch of dataset images before you commit to a LoRA training run. Run it over your image set and you get an immediate feel for whether the tagger is generally attending to the subject (faces, clothing, distinguishing features) or getting distracted by something structural across many images (a recurring watermark, a border, a background pattern). That's the kind of systemic dataset problem that's easy to miss scrolling through captions as text, and much easier to spot as a heatmap.

Inputs and outputs

Required:

  • tagger - a WD_TAGGER from Load Tagger.
  • features - a WD-TAGGER-FEATURES value, produced upstream by the pack's feature-extraction node in the same wd-tagger category (not covered in this batch, but it lives in the same section of the node menu).
  • threshold - the confidence cutoff, 0-1, default 0.3. Only tags the tagger scored above this get folded into the combined heatmap.
  • heat_map_alpha - overlay strength on the source image, 0-1, default 0.3.
  • intepolate - the interpolation mode used when scaling the heatmap up to your image's resolution, default bilinear.

Output is a single IMAGE - the source image with the combined heatmap composited on top.

Installing it

ComfyUI Manager, search "cgem156-ComfyUI". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/laksjdjf/cgem156-ComfyUI

Restart ComfyUI afterward. No separate download for this node - the tagger weights load back at Load Tagger the first time you run that.

Common issues

threshold is the dial that determines whether this node tells you anything useful at all. Set it too low and nearly every tag the model has any opinion on gets folded in, which tends to wash the heatmap out into a blurry "everywhere" that isn't diagnostic of much. Set it too high and you might get nothing at all if the tagger wasn't especially confident about anything in a given image - worth checking the tagger's raw output for that image first if the heatmap comes back suspiciously blank, so you know whether that's a real "the tagger had no strong opinions here" result or a threshold set wrong for your use case.

As with the rest of this pack's wd-tagger tools, there's essentially no community troubleshooting trail to lean on - this is the author's own diagnostic tooling, useful if you're doing serious dataset auditing but not something with a wide install base to compare notes against. Treat surprising results as genuine findings about your tagger and dataset rather than assuming the node itself is misbehaving.

Categorycgem156 ๐ŸŒ/wd-tagger

Inputs (5)

NameTypeDefaultDescription
taggerWD_TAGGERโ€”
featuresWD-TAGGER-FEATURESโ€”
thresholdFLOAT0.300โ€“1โ€”
heat_map_alphaFLOAT0.300โ€“1โ€”
intepolateCOMBObilinear7 options: nearest, linear, bilinear, bicubic, trilinear, area, +1

Outputs (1)

NameTypeDescription
IMAGEIMAGEโ€”