Latent Stats
What does your latent actually look like under the hood
- latent
- stats
- c0_mean
- c1_mean
- c2_mean
- c3_mean
A latent is just a tensor - you can't eyeball it the way you can an image. Latent Stats is the debug probe: feed it a latent and it reports dimensions plus per-channel mean, standard deviation, min, and max, so you actually know what's inside the thing your sampler is working on instead of guessing.
It's a utility node in the purest sense - you're not going to build a creative effect around it, you're going to use it to answer a specific question ("is this latent degenerate," "what does a normal reference image's latent baseline look like") and then move on.
What goes in, what comes out
latent(LATENT) - required, the only input.
Outputs, and this one is worth reading carefully because the README's prose description ("dimensions, and per-channel mean, std dev, min, and max") is broader than what's actually wired out as usable values: you get a stats STRING (the full printed report, dimensions and per-channel mean/std/min/max together) plus four separate FLOAT outputs - c0_mean, c1_mean, c2_mean, c3_mean - one per latent channel. The standard deviation, min, and max numbers exist in the printed stats text but aren't broken out as their own wire-able float outputs; only the four channel means are.
This node is also flagged as an output node, meaning its stats text is meant to be read directly in the UI rather than just passed downstream.
Where it's actually useful
The README calls out the pairing directly: combine this with this pack's Offset Latent Image. Run Latent Stats on the encoded latent of a reference image to see what its real per-channel means look like, then plug similar numbers into Offset Latent Image's offset_0–offset_3 to start a new generation biased toward that same tonal baseline - instead of guessing at offset values with no idea what a "normal" latent even looks like.
More generally, it's a sanity check: if a latent's stats look wildly off from what you'd expect (extreme means suggesting a heavy color shift, near-zero standard deviation suggesting a flat, degenerate latent with nothing in it), that tells you something upstream broke before you spend time debugging the visible output.
How to install it
ComfyUI Manager: search "ComfyUI-Image-Filters", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters
restart. The pack's dependency is opencv-contrib-python, needed by its image-processing nodes; this one does pure tensor math and needs nothing extra, but ships in the same package, so the same install applies. A cv2 import error blocking the whole pack on startup is typically a conflicting opencv variant from another node pack - the author's install.bat/import_error_install.bat fix it on Windows, and manually uninstalling stray opencv packages and reinstalling opencv-contrib-python alone works elsewhere.
Common issues & troubleshooting
Need std dev, min, or max as a usable number, not just text. Those three only show up inside the stats string - there's no separate float output for them the way there is for the four channel means. If you need one of them programmatically downstream, you'd have to parse it out of the string yourself; there's no shortcut node for it here.
The stats output doesn't seem to show up anywhere. It's meant to print in the node's own UI panel as an output node, not necessarily surface in your run's saved outputs - don't expect it to appear as a file unless your run setup explicitly captures node text output.
Channel numbers don't obviously map to anything you understand. That's normal - a latent's four channels aren't R/G/B or any other intuitive axis; they're the model's own internal representation. Use the numbers comparatively (this latent vs. that reference latent) rather than trying to interpret a single channel's mean in isolation.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| stats | STRING | — |
| c0_mean | FLOAT | — |
| c1_mean | FLOAT | — |
| c2_mean | FLOAT | — |
| c3_mean | FLOAT | — |