Image quality metrics that train with your model
PIQ exists because nobody wants to reimplement SSIM, FID, or BRISQUE for every PyTorch project.

What it does
PIQ is a PyTorch-native collection of image quality metrics spanning full-reference (PSNR, SSIM, LPIPS), no-reference (BRISQUE, CLIP-IQA), and distribution-based (FID, KID, Inception Score) measures. It exposes both functional interfaces for quick evaluation and class-based modules that plug directly into training loops as loss functions. The library targets generative and image-to-image tasks where you need consistent, validated scoring without framework hopping.
The interesting bit
Most metric implementations stop at evaluation; PIQ makes the majority of them fully differentiable so you can backpropagate through SSIM, FID, or MS-SSIM during model optimization. It also ships with benchmarking scripts against standard opinion-score datasets like TID2013 and KADID10k, letting you verify that its SSIM actually matches the literature’s SSIM.
Key highlights
- Pure PyTorch with minimal dependencies; runs on GPU and stays inside your existing training graph.
- Covers three metric families: full-reference, no-reference, and distribution-based.
- Most metrics implement both functional and module interfaces, so the same code handles evaluation and loss computation.
- Includes validation logic to catch bad inputs before they crash a long training run.
- Benchmarks against TID2013, KADID10k, PIPAL, KonIQ10k, and LIVE-itW with published SRCC comparisons.
Caveats
- The README notes that
compute_featsfor distribution metrics expects a data loader of “predefined format,” but does not specify what that format is. - Python support is explicitly capped at 3.7–3.10.
- Benchmark datasets are not bundled; you must download TID2013, KADID10k, and others separately.
Verdict
Worth a look if you train GANs, autoencoders, or any image-to-image models in PyTorch and are tired of copy-pasting metric implementations. Skip it if you only need a single static metric and do not care about differentiability or unified APIs.
Frequently asked
- What is photosynthesis-team/piq?
- PIQ exists because nobody wants to reimplement SSIM, FID, or BRISQUE for every PyTorch project.
- Is piq open source?
- Yes — photosynthesis-team/piq is open source, released under the Apache-2.0 license.
- What language is piq written in?
- photosynthesis-team/piq is primarily written in Python.
- How popular is piq?
- photosynthesis-team/piq has 1.6k stars on GitHub.
- Where can I find piq?
- photosynthesis-team/piq is on GitHub at https://github.com/photosynthesis-team/piq.