Nodes/CUI-Lumina2-TeaCache/TeaCache LPIPS Evaluator
ComfyUI Node

TeaCache LPIPS Evaluator

The node that turns 'looks about the same' into an actual score

By spawner1145·Created about a year ago·Updated 7 months ago· 20
TeaCache LPIPS Evaluator
  • test_image
  • baseline_image
  • lpips_model
  • status
run_id

Somewhere in the middle of using this pack you'll look at a TeaCache render and think "hmm, is that worse or is that my imagination?" TeaCache_LPIPS_Evaluator exists so you never have to answer that question by squinting. It compares a render against a stored reference image with LPIPS - a perceptual similarity metric that judges images the way a human would, not the way a pixel-diffing robot would - and hands you a number you can actually compare across runs.

The comparison only works if the ground truth is fixed, so it takes everything the pack's other analysis nodes produce: the test_image (your just-rendered output), the baseline_image (the BASELINE_IMG handle from Store_Baseline_Image - the reference render made with TeaCache off), the lpips_model from LPIPS_Model_Loader, and a run_id from TeaCache_Patcher so the score lands on the right record. All four are required, and the run_id is the subtle one: the evaluator looks up the live run's state, computes the distance, and stuffs the score into that run's results so TeaCache_Result_Collector can write it into teacache_analysis.json. Wire the wrong or no run_id and you just get an error status string back.

What comes out

A single status string, e.g. LPIPS距离计算完成: 0.4586 - the author's UI messages are in Chinese, so that's what "LPIPS distance computed" looks like. The score itself is the important part, but the status output has a second, sneaky role: because it's a real execution dependency, the example workflow uses it as the trigger for the Result Collector. That's how the collector knows the quality number is ready before it writes the log. If you wire the pack manually, don't skip that connection or your JSON records will come out without the LPIPS column filled in.

The math is quick to describe: both images get normalized to the [-1, 1] range the VGG-based LPIPS model expects, then compared on CPU. It's a single forward pass, so even though it runs on CPU it's not the thing slowing your sweep down.

Installing and a dose of honesty

Standard pack install - ComfyUI Manager, search CUI-Lumina2-TeaCache, install, restart - or:

cd ComfyUI/custom_nodes
git clone https://github.com/spawner1145/CUI-Lumina2-TeaCache.git

Needs the lpips package (in the pack's requirements; Manager installs it). Read the Store_Baseline_Image article before you go further, because that's where the real trap lives: if the baseline slot gets overwritten by a later render, every "distance" this node reports is comparing a run to itself and your whole sweep is fiction. Keep the baseline fixed, keep the run_id wired, and this node is a genuinely useful reality check - the thing that tells you whether cranking rel_l1_thresh from 0.3 to 0.6 saved you two seconds or quietly wrecked your image.

Categoryutils/analysis

Inputs (4)

NameTypeDefaultDescription
test_imageIMAGE
baseline_imageBASELINE_IMG
lpips_modelLPIPS_MODEL
run_idSTRING

Outputs (1)

NameTypeDescription
statusSTRING