图像质量丨评分
A free, local 'is this image any good?' check — no VLM required
- image
- score
- report
- pass
Ask a vision model "is this image good?" and you pay per call, wait on the network, and get a fuzzy opinion. QING_ImageQualityScore does the same job with a few lines of pixel math and zero API keys: it scores an image on sharpness, contrast, and noise, combines them into a 0–100 number, and gives you a pass/fail boolean you can gate a workflow on. For batch QC it's the difference between "eyeball 200 images" and "let the graph sort them."
How it works
The score is three heuristics on the grayscale version of your image:
- Sharpness - mean absolute gradient between neighboring pixels, scaled to 0–100. Blurry images score low.
- Contrast - standard deviation of the gray values, normalized to 0–100. Flat/washed-out images score low.
- Noise - a 3×3 average-pooled version of the image is compared to the original; the mean residual is treated as noise, and its inverse ("cleanliness") is scored.
The three weighted inputs, weights_sharpness (0.4), weights_contrast (0.4), weights_noise (0.2), blend them - they don't need to sum to 1, they're normalized internally. threshold (default 60) is the pass line. Outputs: score (FLOAT), report (STRING - a one-line breakdown of all three sub-scores), and pass (BOOLEAN - true when score ≥ threshold).
Where you'd reach for it
The classic setup is an automatic batch filter: feed the batch through QING_BatchForEach, score each frame, and use pass to route good frames to a final upscale/save and bad ones to a retry or a discard pile - the "detect → filter → act" loop from the KB's automation doc, but on quality instead of subjects. In a batch of 200, it'll reliably separate the crisp renders from the smeared ones. It's also a cheap sanity check before a slow expensive pass: why waste an upscale on something that's going to score 12?
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/GAO-SHIQING/ComfyUI-QING
cd ComfyUI-QING
python install_dependencies.py
Restart ComfyUI after. Pure torch, no new dependencies beyond the pack's standard set. Manager: search "ComfyUI-QING." (README clone URL has a GAOSHI-QING typo; repo is GAO-SHIQING/ComfyUI-QING.)
Things to know
Be honest about what this measures. It's a heuristic, not a perceptual model: a heavily stylized illustration, a film-grain aesthetic, or an intentionally moody low-contrast photo will all score worse than a crisp render - that's the math being math, not the image being bad. Tune the weights if your content is consistently noisy-but-fine: raise weights_noise's counterpart or lower sharpness's contribution, and move threshold to where your known-good images actually land (run a few through, read the report, set the line from data). And remember pass is just score >= threshold, so if every image passes you set the bar too low - which is fine if that's what you wanted.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | 输入图像 | |
| weights_sharpness | FLOAT | 0.400–1 | — |
| weights_contrast | FLOAT | 0.400–1 | — |
| weights_noise | FLOAT | 0.200–1 | — |
| threshold | FLOAT | 60.00–100 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| score | FLOAT | — |
| report | STRING | — |
| pass | BOOLEAN | — |