piq
Measures and metrics for image2image tasks. PyTorch.
What it is and what it does
PIQ is a library that bundles image quality metrics into a unified, easy-to-use interface. It implements full-reference metrics (SSIM, PSNR, LPIPS, etc.) that compare pairs of images, no-reference metrics (BRISQUE, CLIP-IQA) that assess single images, and distribution-based metrics (FID, IS, KID) that compare feature distributions from image sets. Most metrics can be backpropagated, making them suitable as loss functions for model training.
The library is built on pure PyTorch with minimal additional dependencies, provides extensive input validation to prevent crashes during training, and supports GPU computation. It evolved from an earlier package called PhotoSynthesis.Metrics and includes code for benchmarking metrics against standard datasets like TID2013 and KADID10k.
Use it for:
- Training image generation or enhancement models using perceptual loss functions like LPIPS or SSIM.
- Evaluating generative model quality with FID or Inception Score on image distributions.
- Comparing image restoration or super-resolution outputs against reference images.
- Assessing blind image quality using BRISQUE or CLIP-IQA on single images.
- Benchmarking image processing pipelines against standard quality metrics on common datasets.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PIQ provides a collection of image quality metrics and measures—both full-reference (comparing two images) and no-reference (assessing a single image)—implemented as PyTorch modules that can be used as loss functions or evaluated independently.
Yes, if you need image quality metrics. The library is well-established (1572 GitHub stars, 256419 monthly downloads), permissively licensed, and has low install friction. The dormant maintenance status is not a blocker for stable metric implementations, but verify that the specific metrics you need are present and that you do not require active bug fixes or new features. No known vulnerabilities.
Install
piq on PyPI
pip
pip install piquv
uv add piqpoetry
poetry add piqInstalling piq
Before you install
Low friction: pure Python wheel with a single runtime dependency (torchvision). Repository is dormant (last commit May 2024, no release since July 2023), but archived status is false, suggesting maintenance is paused rather than abandoned.
License in practice
Licensed under Apache Software License (permissive). You can use, modify, and distribute the package freely in commercial or private projects without restriction, though you must include the license notice.
Quickstart
pip install piq
from piq import ssim, SSIMLoss
ssim_index = ssim(x, y, data_range=1.)
loss = SSIMLoss(data_range=1.)
output = loss(x, y)
output.backward()
Requires torchvision as a runtime dependency; GPU acceleration is optional but available.
Verify before relying
- Whether the package works reliably with Python versions beyond 3.10 (description mentions 3.7-3.10 support).
- Current maintenance status: whether dormancy indicates the package is stable or effectively unmaintained.
- Specific metrics available and their performance on standard benchmarks.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — torchvision |
| Maintenance | dormant — 1,137 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 256,419/month — #8,465 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: piq-0.8.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
image-similarity-measuresComputes eight standard image similarity…
permissive · top 15,000 on PyPI
pyiqaPyIQA provides a PyTorch-based toolbox for…
noncommercial · top 15,000 on PyPI
pytorch-fidComputes Fréchet Inception Distance (FID), a…
permissive · top 15,000 on PyPI
pytorch-msssimComputes fast, differentiable SSIM and MS-SSIM…
permissive · top 15,000 on PyPI
lpipsComputes perceptual similarity between image…
permissive · top 5,000 on PyPI
clean-fidComputes Fréchet Inception Distance (FID) and…
permissive · top 15,000 on PyPI
torchmetricsTorchmetrics provides a collection of PyTorch…
permissive · top 5,000 on PyPI
torchsrProvides pretrained neural network models for…
permissive · top 15,000 on PyPI
pixelhogCompares PNG screenshots pixel-by-pixel and…
permissive · top 5,000 on PyPI