Nodes/ComfyUI-Concept-Diffusion/Concept Saliency Map
ComfyUI Node

Concept Saliency Map

Concept Saliency Map in Two Fields

By Junst·Created 12 months ago·Updated 11 months ago· 3
Concept Saliency Map
  • concept_maps
  • mask
  • saliency_image
concept_namewoman
threshold0.50

What it is

Half of this pack is about producing concept maps; this node is about spending them. Concept Saliency Map takes the CONCEPT_MAPS bundle from ConceptAttentionNode and turns a single concept into a hard binary mask you can actually wire into the rest of your graph. The main node gives you a fuzzy "how much does the model care about this here" map; this node makes the yes/no call.

The inputs that matter

Three inputs, and you'll touch two of them:

  • concept_maps (CONCEPT_MAPS) - pass through from ConceptAttentionNode.
  • concept_name (STRING, default woman) - which concept to extract. Must match the concept_list entry you typed upstream, exactly, including case. "Woman" won't find "woman".
  • threshold (FLOAT, 0–1, default 0.5) - how strict the cut is. Lower the threshold and more of the fuzzy attention counts as "in the mask"; raise it and you keep only the confident core.

That's the whole knobs list. Set concept_name, tune threshold, done.

Outputs

  • mask (MASK) - a binary mask you can feed into inpainting, conditioning regions, masking utilities, or any of the compositing tools that eat MASK inputs.
  • saliency_image (IMAGE) - the thresholded map as a visual, straight to a SaveImage or PreviewImage.

The mask is the product. The image output is mostly there so you can see what the threshold did before you commit to it.

Rough edges (read this before wiring it in)

The shipped code has a sharp edge worth knowing about before you build a workflow on it. Reading the source, the threshold step operates on the numpy maps the main node hands over, and that code path can come back empty - a None instead of a mask - when the concept name doesn't match or the map shape isn't what it expects. The classic failure is a typo or a trailing space: "woman " will not match "woman", and the node quietly returns nothing rather than a helpful error. First run, watch the ComfyUI console.

Honestly? If you only care about the mask, this is the node you'll reach for in this pack - but it's also the one sitting closest to a blank output, so verify the first result before you chain it into anything important.

How to install

Same pack as the rest of ComfyUI-Concept-Diffusion. In ComfyUI Manager, search "Concept-Diffusion" and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Junst/ComfyUI-Concept-Diffusion
cd ComfyUI-Concept-Diffusion
pip install -r requirements.txt

Restart ComfyUI afterwards. No separate model download - it runs entirely off the concept maps already in your graph, which is the appeal: the expensive attention work happened once, upstream, and this node just slices it.

When you'd reach for it

Selective editing. Mask out one concept from the image, send the mask to an inpainting pass, and you've got a targeted edit driven entirely by the diffusion model's own understanding of the scene - no boxes drawn, no SAM download. Just mind the exact-match rule and give the threshold a quick test drive first.

CategoryConcept Attention

Inputs (3)

NameTypeDefaultDescription
concept_mapsCONCEPT_MAPS
concept_nameSTRINGwoman
thresholdFLOAT0.500–1

Outputs (2)

NameTypeDescription
maskMASK
saliency_imageIMAGE