Visualize Feature Map
Feature maps, without a PhD
- model
- latent_image
- positive
- negative
- sampler
- sigmas
- UNet Output
- Feature Map
Before you bend a layer, wouldn't it be nice to know what that layer actually encodes? This node runs a real sampling pass, taps the layer you name, and turns its output into an image you can look at. It's the pack's X-ray: you point it at a path like middle_block.2.out_layers, and it shows you what that part of the network is "thinking" about mid-denoise.
The mechanism is straightforward once you accept that this node is a sampler. It takes your model, conditioning, latent, sampler, and sigmas - the same ingredients a KSampler needs - runs the full denoising loop via ComfyUI's sample_custom, and registers a forward hook on the layer you asked for. Every time that layer runs, its output is captured. Those captured tensors are averaged across the channel dimension into a grayscale "feature map," repeated out to four channels so it previews like a normal image. You get two outputs: UNet Output (the final sampled latent from the UNet, reordered to image-style NHWC - it's still a latent, 4 channels at latent resolution, so run it through a VAE Decode before it looks like a photo) and Feature Map (the stack of channel-averaged maps from that layer). Both are IMAGE type, so they drop straight into a PreviewImage.
What matters for a beginner is the wiring, because this is the most input-hungry node in the pack. You need:
- layer_path - the address of the layer you're curious about. Get it from the pack's
Model Inspector, or type it from the README examples. - The full sampling rig: positive, negative, sampler (from a KSamplerSelect), sigmas (from a BasicScheduler), latent_image, cfg (default 8, SD-style), and noise_seed.
That's it. Everything else on the node is part of the sampling machinery, not something you tune.
Real talk: this is expensive. Every run is a full generation plus hooking. And it's marked experimental in the source for good reason - if you give it a path that doesn't resolve, it logs a warning and returns zeros rather than dying, which can leave you staring at a black image wondering what broke. It's a debugging and exploration tool, not a daily driver. Use it to build intuition: look at a middle-block map and you'll see coarse structure and composition; look at a late output-block map and you'll see edges and texture. That's the same reason the authors built it - it's cited in the README as an implementation of a well-known PyTorch feature-map visualization approach.
Install: ComfyUI Manager → search "ComfyUI-Model-Bending" → install → restart, refresh your browser. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/abuzreq/ComfyUI-Model-Bending
The pack brings in kornia and scikit-learn. One warning that bites people: the sampler and sigmas inputs aren't optional conveniences - they're required, because the node genuinely runs the sampler. Missing them means the graph won't even validate.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| layer_path | STRING | — | |
| timestep | FLOAT | 0.00 | — |
| noise_seed | INT | 00–18446744073709550000 | — |
| latent_image | LATENT | — | |
| cfg | FLOAT | 8.000–100 | — |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| sampler | SAMPLER | — | |
| sigmas | SIGMAS | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| UNet Output | IMAGE | — |
| Feature Map | IMAGE | — |