Nodes/cgem156-ComfyUI๐ŸŒ/Grad Pair ๐ŸŒ
ComfyUI Node

Grad Pair ๐ŸŒ

A heatmap and its tag, matched up automatically

By laksjdjfยทCreated 2 years agoยทUpdated about a month agoยท 93
Grad Pair ๐ŸŒ
  • tagger
  • features
  • IMAGE
  • STRING
โ—„heat_map_alpha0.30โ–บ
โ—„intepolatebilinearโ–บ
โ—„negativeโ€”โ–บ

Grad Pair sits between the pack's two other Grad-CAM nodes. Grad Cam needs you to name a target tag; Grad Cam Auto skips naming a tag but blends everything above a threshold into one combined heatmap. Grad Pair, going by its inputs and outputs, does the in-between thing: it picks a tag automatically and hands you back both the heatmap and which tag it was for, as a matched pair - useful when you want per-tag detail without manually deciding what to ask about first.

Inputs and outputs

Required:

  • tagger - a WD_TAGGER from Load Tagger.
  • features - a WD-TAGGER-FEATURES value from the pack's feature-extraction node (in the same wd-tagger category, not covered in this batch).
  • heat_map_alpha - overlay strength on the source image, 0-1, default 0.3.
  • intepolate - interpolation mode for scaling the heatmap up to image resolution, default bilinear.
  • negative - a boolean; based on the same flag in Grad Cam, this likely flips the visualization to explain what's pushing against the selected tag rather than for it.

No target_tag field here - that's the whole point of this node versus its sibling. Two outputs: IMAGE (the heatmap overlay) and STRING (the tag it's explaining), delivered as a pair so you don't lose track of which heatmap belongs to which tag when you're running this across a batch of images.

Where this fits into a workflow

If you're auditing a dataset image by image, Grad Pair is the node that saves you from constantly retyping target_tag into Grad Cam. Run it and you get a representative heatmap-plus-label for each image without deciding in advance what you're looking for - then use the STRING output to keep your batch organized (feed it into a save-image filename, or just read it alongside the heatmap) rather than having to cross-reference a separate tag list.

Installing it

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

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

Restart ComfyUI. No separate download tied to this node - the tagger weights load once, back at Load Tagger.

Common issues

The same wiring trap as the rest of the wd-tagger family applies: features isn't something Load Tagger produces directly, it comes from a separate feature-extraction node run over your actual image, so a missing-input error here almost always means that step is absent from your graph rather than anything wrong with Grad Pair itself.

Beyond that, treat this like the rest of cgem156's interpretability tooling: there's no meaningful community troubleshooting history to check against, because it's a genuinely niche corner of a niche pack. If the tag it picks and the region it highlights don't match your intuition about the image, that's worth taking seriously as a real signal about the tagger's behavior rather than dismissing as a glitch - that mismatch is exactly the kind of thing this whole node family exists to surface before it quietly shapes a LoRA training run you didn't mean to bias.

Categorycgem156 ๐ŸŒ/wd-tagger

Inputs (5)

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

Outputs (2)

NameTypeDescription
IMAGEIMAGEโ€”
STRINGSTRINGโ€”