Nodes/ComfyUI-Anima_IP-Adapter/Anima IP Attn Heatmap
ComfyUI Node

Anima IP Attn Heatmap

See where Anima's IP-Adapter is actually looking in your reference image

By LuciferTC9527·Created 3 months ago·Updated 22 days ago· 14
Anima IP Attn Heatmap
  • ip_adapter
  • ref_image
  • heatmap
modecombined
opacity0.60

Anima is Circlestone's 2B anime DiT with a genuinely great text encoder, but for a long while it had one obvious hole: no image prompting. This pack - a SigLIP2-based IP-Adapter port by LuciferTC9527 - is the reference-image path that fills it, letting you hand Anima a style or character reference instead of only words. AnimaIPAdapterVisualize is the part of that pack that tells you whether the trick is actually working. It renders a heatmap of where the adapter is attending in your reference image, so you stop guessing why your style transfer is off.

The node doesn't touch generation itself - you run it alongside your real workflow and it shows you which regions of the image the cross-attention is leaning on. That's the difference between "why is my output picking up the background?" and "oh, the adapter is keying on the whole frame, not the character."

How it works

IP-Adapter works by decoupling cross-attention: a frozen image encoder turns your reference into tokens, and per-block key/value projections inject those tokens next to the text path. This port uses SigLIP2 (siglip2-base-patch16-512) as that encoder, and this node re-runs that encoder over your reference at a fixed 512×512 (letterboxed, so aspect ratio is preserved). At patch 16 that yields 1024 tokens - a 32×32 grid over the image - and each of the four mode choices turns that grid into a different score map:

  • token_norm - the L2 magnitude of each token's embedding. Pure encoder opinion: what SigLIP2 itself found salient.
  • key_norm - the same tokens projected through every block's actual ip_k_proj weight, normed and averaged. This is the closest to what the adapter genuinely attends with, because those are the real keys.
  • key_unique - 1 minus each patch's mean cosine similarity against all the other patches. Highlights the parts of the image that have distinctive keys, the opposite of "looks like everything else."
  • combined (default) - min-max normalized average of the other three, so nothing dominates the scale.

The 32×32 map is upscaled to 512×512, normalized, colorized blue→green→red, and blended over the reference at your chosen opacity. combined is a fine starting point; if you only pick one, key_norm is the honest one - it shows what the cross-attention will actually key on.

Inputs and outputs that matter

Only four inputs, all required, and you'll mostly leave two alone:

  • ip_adapter - the ANIMA_IP_ADAPTER object from Anima IP-Adapter Loader (SigLIP2). This is the node's whole reason for existing as a separate class: it reuses the encoder and weights the loader already holds, so you never download or load them twice.
  • ref_image - the same reference image you're feeding the Apply node. Feed it the identical image, or the heatmap is meaningless.
  • mode - the enum above. Try key_norm when combined looks muddled.
  • opacity - 0.1–1.0, default 0.6. How hard the color sits on the photo; drop it if the map drowns the image.

Output is a single heatmap (IMAGE) - wire it into Save Image or Preview Image. It's a diagnostic, so there's nothing to continue a sampler from.

Installing it

Same story as every custom node: ComfyUI Manager (search "Anima IP-Adapter"), or by hand:

cd ComfyUI/custom_nodes/
git clone https://github.com/LuciferTC9527/ComfyUI-Anima_IP-Adapter.git

then restart ComfyUI. The pack's only Python dependency is transformers, which you almost certainly already have. The real setup is two model files:

  • ip_adapter.safetensorsComfyUI/models/ipadapter/ - this lives on HuggingFace (LuciferTC/Anima-IP-Adapter), not in the GitHub repo. People go looking in the repo, find nothing, and assume it's broken.
  • SigLIP2 encoder → ComfyUI/models/siglip2/ - flip auto_download in the loader to fetch it, or git clone https://huggingface.co/google/siglip2-base-patch16-512 into that folder manually.

You'll also need an Anima checkpoint loaded, naturally. One license note: the code is Apache 2.0, but Anima itself is CircleStone Labs Non-Commercial - read that before building a commercial workflow on this.

Where people get burned

  • CUDA-only. The node hardcodes torch.device("cuda"); on a CPU-only ComfyUI it just errors. Fine on the 6GB-class cards Anima needs, but not on a headless box.
  • It's tied to the 512 patch-16 encoder. The 1024-token → 32×32 reshape is hardcoded. Feed this pack a different SigLIP2 variant and the visualization breaks even if the adapter itself works.
  • It re-encodes every run. Each execution pays a SigLIP2 forward pass and shuttles the encoder to/from GPU. Cheap at this scale, but it's a diagnostic node - don't leave it in a production graph.
  • Flat maps, not red patches. The map is min-max normalized, so a reference with no dominant subject renders as an even wash. Usually a sign your reference is too busy, not that the node broke.

The output won't tell you to raise or lower strength on the Apply node - but it will tell you whether the reference you picked is worth using at all. That's usually the bigger mistake.

CategoryAnima/IP-Adapter

Inputs (4)

NameTypeDefaultDescription
ip_adapterANIMA_IP_ADAPTER
ref_imageIMAGE
modeCOMBOcombined4 options: key_norm, token_norm, key_unique, combined
opacityFLOAT0.600.1–1

Outputs (1)

NameTypeDescription
heatmapIMAGE