PieAPP
A perceptual metric literally trained on human votes
- image_a
- image_b
- stride
- pieapp
Here's the most literal take on "learned perceptual metric" in this pack: PieAPP was trained on human pairwise preferences. People were shown the same image distorted two different ways and asked which looked better; thousands of those votes became the training signal for a CNN that scores how big a perceptual error one image is relative to another. Lower is better - it's an error score, so small = "close to the reference," and unlike LPIPS the scale has no neat upper bound. When people do perceptual model bake-offs, PieAPP is one of the ones that actually holds up against human judgment.
It's one of the seventeen nodes in comfyui-piq, Laurent Fainsin's wrapper around the piq library.
How it works. The image pair is tiled into patches, each patch pair goes through the CNN, and the per-patch errors are aggregated into the final score. The stride input (default 8) controls how densely the patches are sampled - smaller stride = more patches = slower but more thorough. Because the network was trained on pairs, it's calibrated to the "which of these two is closer to the reference" task, which is the exact task you have when comparing two upscale candidates against an original.
Two real gotchas. First, like the other deep nodes in this pack, it downloads PieAPPv0.1.pth from the piq project's GitHub releases on first run (torch.hub, cached in ~/.cache/torch). Second, it's RGB-only: the original PieAPP model only supports three-channel images, so if you feed it grayscale it silently copies the gray channel three times. Feed it your normal ComfyUI color IMAGE and you're fine.
Inputs a beginner actually sets:
image_a/image_b- candidate vs. reference;image_bis ground truth.reduction-mean.data_range-1.0for ComfyUI 0–1 floats.stride- default 8; drop it toward 4 only if you're being very thorough about small patches.enable_grad- leave off; it's for when you want gradients back for optimization.
The pieapp output is a FLOAT error score, lower better (0 = identical).
Installing. ComfyUI Manager, search "comfyui-piq", Install. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Laurent2916/comfyui-piq.git
pip install -r custom_nodes/comfyui-piq/requirements.txt
piq>=0.8.0 is the entire requirements file; Python 3.12+; repo archived but functional.
The honest take. PieAPP is the most research-flavored node here, and it shows: the pairwise training makes it genuinely good at "which is worse," but it's heavier than LPIPS, downloads a separate model, and the score's unbounded scale makes it awkward to compare across sessions. For most people, LPIPS covers this use case with less fuss. Reach for PieAPP when you want a second learned opinion that was trained on actual human disagreement - it's a great tiebreaker when LPIPS and your eyes are fighting.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | Input image | |
| image_b | IMAGE | Reference image | |
| reduction | COMBO | Reduction method | |
| data_range | FLOAT | 1.00 | Maximum value range of images |
| stride | INTEGER | 8 | Stride for patch extraction |
| enable_grad | BOOLEAN | false | Enable gradient calculation |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| pieapp | FLOAT | Perceptual Image-Error Assessment through Pairwise Preference |