Nodes/Image Quality Evaluator/图像质量评估器 (FID/IS/CLIP/LPIPS)
ComfyUI Node

图像质量评估器 (FID/IS/CLIP/LPIPS)

The only node that hands you a real FID/IS/CLIP/LPIPS report without leaving ComfyUI

By zx725tt·Created 4 months ago·Updated 4 months ago· 0
图像质量评估器 (FID/IS/CLIP/LPIPS)
    • evaluation_result
    ◄real_images_dir►
    ◄generated_images_dir►
    ◄device▾►
    ◄batch_size32►
    ◄compare_images_dir►
    ◄prompts►
    ◄save_path►
    ◄enable_fidtrue►
    ◄enable_istrue►
    ◄enable_cliptrue►
    ◄enable_lpipstrue►

    Let's be honest about what this node is before we get to how it works. ImageQualityEvaluator (the UI shows it as 图像质量评估器) is not a "is my image good" filter - there's no such thing, and your eyeballs are still the best judge of a single render. It's a batch-evaluation terminal for the four classic academic metrics - FID, Inception Score, CLIP-Score, and LPIPS - computed on whole folders of images sitting on your disk. You reach for it when you need numbers: benchmarking a LoRA or checkpoint against a reference set, tuning a sampler, comparing two pipelines, or writing up results that someone might actually check.

    What makes it rare is the packaging. Getting these four metrics normally means leaving ComfyUI and running torch-fidelity or clean-fid scripts, wrangling pip environments, and pasting output back in. This node does all four in one shot and prints a report as a string you can save. It's small, MIT-licensed, and one author's hobby project rather than a big ecosystem pack - so set expectations accordingly, but the math underneath is the real thing.

    How it works

    The node reads image folders straight from disk (not from the ComfyUI graph - the wires here are optional), resizes everything to 299×299, and runs it through a stock torchvision Inception V3. The 2048-dim feature vectors give you FID (via scipy's matrix square root, with a touch of covariance regularization to avoid the infamous "Imaginary component" crash); the 1000-class softmax probabilities give you IS. CLIP-Score comes from LAION's clip-score package, and LPIPS from the lpips package with its AlexNet backbone. So the report is only as meaningful as its inputs: this is comparing your generated batch against a reference set, not grading individual images.

    The author deliberately skipped clean-fid and torch-fidelity and hand-rolled the Inception path - the changelog says it was to kill the "size mismatch" and imaginary-component errors those libraries are famous for. That's a real, earned fix, and the code shows it: every failure is caught per-metric and reported as a line in the output instead of killing your whole queue.

    The inputs that matter

    Only a handful of fields deserve your attention:

    • generated_images_dir - the folder of images you're evaluating. The only one that's a hard requirement; if this path is bad, the node errors out.
    • real_images_dir - your reference/real folder for FID. If it's invalid, FID is soft-skipped and the rest still runs. Don't leave it empty unless you only want IS.
    • prompts - one prompt per generated image, in filename-sorted order, one per line. Only needed for CLIP-Score; without it you get "⚠️ 未提供 prompts" rather than a crash.
    • compare_images_dir - the reference folder for LPIPS, paired positionally with your generated folder.
    • batch_size - default 32, and the first knob to turn if you hit CUDA OOM (the README's exact advice).
    • device - cuda or cpu. Bonus: if you pick cuda and have no GPU, it silently drops to CPU instead of erroring.

    The four enable_* toggles let you run just FID+IS (the common minimal setup) and skip the ones whose inputs you don't have. Output is a single evaluation_result STRING - a formatted ASCII report with per-metric verdicts - and if you fill save_path, the same text is written to that file, no SaveText node required.

    Installing it

    Easiest via ComfyUI Manager - search ComfyUI-ImageEval. Or by hand:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/zx725tt/ComfyUI-ImageQualityEvaluator.git
    pip install scipy clip-score lpips
    

    Then restart. Two gotchas the README is unusually loud about: the heavy deps (scipy, clip-score, lpips) are not auto-installed, and if you run a portable build like ComfyUI-aki you must install them with ComfyUI's own embedded Python (...\python\python.exe -m pip install ...), not your system pip - otherwise the node silently does nothing. First run also downloads Inception V3 weights and the LPIPS/CLIP weights, so expect a one-time network pull.

    Troubleshooting

    • Runs but no output / "缺少依赖" - deps landed in the wrong Python. Reinstall with ComfyUI's embedded Python and restart. There's a eval_debug.log in the node's folder that spells out exactly which import failed.
    • "Prompt has no outputs" - this node is an output node, so update the pack and restart; it's usually a stale install.
    • Wildly unstable numbers - you're under the recommended image counts (the node itself prints them: FID wants 500+, IS/CLIP 100+, LPIPS 50 pairs). FID from 20 images is a coin flip; don't report it.
    • CUDA OOM - drop batch_size to 8 or 4.

    One honest caveat to finish on: it's a young, lightly-maintained pack from a single author, so treat it as a convenience wrapper rather than a research-grade harness. But if you need defensible FID/IS/CLIP/LPIPS numbers and you already live in ComfyUI, it's the path of least resistance.

    Categoryimage_evaluation

    Inputs (11)

    NameTypeDefaultDescription
    real_images_dirSTRING—
    generated_images_dirSTRING—
    deviceCOMBO2 options: cuda, cpu
    batch_sizeINT321–128—
    compare_images_diroptSTRING—
    promptsoptSTRING—
    save_pathoptSTRING—
    enable_fidoptBOOLEANtrue—
    enable_isoptBOOLEANtrue—
    enable_clipoptBOOLEANtrue—
    enable_lpipsoptBOOLEANtrue—

    Outputs (1)

    NameTypeDescription
    evaluation_resultSTRING—