Nodes/ComfyUI CV/CV Quality BRISQUE (no-reference)
ComfyUI Node

CV Quality BRISQUE (no-reference)

Grade an image with nothing to compare it to

By bmad4ever·Created 3 months ago·Updated 14 days ago· 1
CV Quality BRISQUE (no-reference)
  • images
  • worst_score
  • worst_index
  • scores
◄model_file►
◄range_file►

Every other quality metric needs an original. PSNR and SSIM compare an output against a reference; MSE needs the same. In a real capture - a phone photo, a scanned frame, a video decode - there is no ground truth, which is the whole reason BRISQUE exists. It grades an image on its own.

How it works

BRISQUE is a no-reference metric built on natural-scene statistics. It extracts 36 features describing how "natural" an image's statistics look - the mean, variance and shape of locally normalised luminance at two scales, plus pairwise products of those in four directions - normalises them against a known feature range, and runs them through an SVM trained on the LIVE image-quality database. The output is a single number, and the direction is the opposite of what you'd expect if you're used to SSIM: 0 is best, 100 is worst.

In practice, on the LIVE-trained model, clean photographs sit roughly under 30 and heavy degradation runs over 60. Treat that as a rough scale for setting a threshold, not a calibrated standard - it's a statistical opinion about naturalness, and it will disagree with your eye on stylised, heavily graded, or synthetic content.

The honest use case: rejecting bad frames at volume. Blurry, noisy, over-compressed, or mis-exposed frames in a batch of thousands, where you cannot look at them all and have no reference to compare against. Gate on the score, keep the good ones, and move on.

Inputs and outputs

images takes a batch - an NPARRAY, IMAGE or MASK, and every frame gets scored, with frames allowed to differ in size. That matters: it's not one score per batch, it's one per frame.

model_file and range_file point at the two data files the metric needs: the trained SVM (brisque_model_live.yml) and the feature-range file (brisque_range_live.yml). They must be a matched pair - mismatching them gives you scores that look like scores and mean nothing.

Out comes worst_score (the highest, i.e. worst, score in the batch), worst_index (which frame that was), and scores, an (N,) float32 array with one value per frame in batch order. The first two are for gating: worst_score against your threshold tells you whether to keep the batch at all, worst_index tells you which frame to look at when it fails. scores is the one to chart - CV Chart Series will plot a quality curve across a clip, and the shape of that curve is far more informative than any single number.

The data files

OpenCV does not ship them with the wheel. You need two YAML files from opencv_contrib, specifically modules/quality/samples/brisque_model_live.yml and brisque_range_live.yml (Apache-2.0), placed in:

ComfyUI/models/quality/

That folder is what the node's dropdowns read. If both fields are empty, that's the reason - nothing was found to select.

Installing

ComfyUI Manager → search "ComfyUI CV", or:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
# restart ComfyUI

Python ≥ 3.12, a recent ComfyUI on the V3 node API, and opencv-contrib-python-headless~=5.0.0.93 (numpy, torch come along). BRISQUE lives in cv2.quality, so a non-contrib OpenCV build means this node simply doesn't work. The pack's checker tells you if the contrib submodules have been emptied:

python tools/repair_opencv_contrib.py --check

Gotchas

The scale is not linear and not absolute. A 40 is not "twice as bad" as 20, and a heavily stylised image can score badly while being exactly what you wanted. Use it to sort and reject, never as a final judgement.

Don't score images that have been resized to thumbnail size. The locally normalised statistics the metric reads are scale-sensitive; a 128-pixel preview has different statistics from the full-resolution frame. Score at the resolution you care about.

It is not a sharpness metric either. BRISQUE responds to noise, blur, blocking and compression as a joint notion of degradation. If you specifically want sharpness, GMSD in CV Quality Compare Batch (cv2.quality) correlates better - but that one needs a reference, which is the whole reason you're here.

Categoryimage/CV/quality

Inputs (3)

NameTypeDefaultDescription
imagesNPARRAY,IMAGE,MASKImage(s) to grade. Every frame of a batch is scored; frames may differ in size. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
model_fileCOMBOThe trained SVM (brisque_model_live.yml) from ComfyUI/models/quality.
range_fileCOMBOThe feature-range file (brisque_range_live.yml) that normalizes the features before the SVM. It MUST be the pair of the model file above.

Outputs (3)

NameTypeDescription
worst_scoreFLOATThe highest (= WORST) BRISQUE score in the batch. Compare it against a threshold to gate a pipeline: LIVE-trained BRISQUE puts clean photos roughly under 30 and heavy degradation over 60.
worst_indexINTIndex of the worst-scoring frame in the batch.
scoresNPARRAYfloat32 array of shape (N,) - one score per frame, in batch order. Chart it with 'CV Chart Series'.