piqa

PyTorch Image Quality Assessement package

https://github.com/francois-rozet/piqa

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org, ieee.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

fid image image-quality image-quality-assessment lpips metrics psnr pytorch pytorch-image-quality quality ssim
Last synced: 6 months ago · JSON representation ·

Repository

PyTorch Image Quality Assessement package

Basic Info
  • Host: GitHub
  • Owner: francois-rozet
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage: https://piqa.readthedocs.io
  • Size: 208 KB
Statistics
  • Stars: 423
  • Watchers: 6
  • Forks: 18
  • Open Issues: 0
  • Releases: 9
Topics
fid image image-quality image-quality-assessment lpips metrics psnr pytorch pytorch-image-quality quality ssim
Created over 5 years ago · Last pushed over 2 years ago
Metadata Files
Readme Contributing License Citation

README.md

PyTorch Image Quality Assessment

PIQA is a collection of PyTorch metrics for image quality assessment in various image processing tasks such as generation, denoising, super-resolution, interpolation, etc. It focuses on the efficiency, conciseness and understandability of its (sub-)modules, such that anyone can easily reuse and/or adapt them to its needs.

PIQA should be pronounced pika (like Pikachu ⚡️)

Installation

The piqa package is available on PyPI, which means it is installable via pip.

pip install piqa

Alternatively, if you need the latest features, you can install it from the repository.

pip install git+https://github.com/francois-rozet/piqa

Getting started

In piqa, each metric is associated to a class, child of torch.nn.Module, which has to be instantiated to evaluate the metric. All metrics are differentiable and support CPU and GPU (CUDA).

```python import torch import piqa

PSNR

x = torch.rand(5, 3, 256, 256) y = torch.rand(5, 3, 256, 256)

psnr = piqa.PSNR() l = psnr(x, y)

SSIM

x = torch.rand(5, 3, 256, 256, requires_grad=True).cuda() y = torch.rand(5, 3, 256, 256).cuda()

ssim = piqa.SSIM().cuda() l = 1 - ssim(x, y) l.backward() ```

Like torch.nn built-in components, these classes are based on functional definitions of the metrics, which are less user-friendly, but more versatile.

```python from piqa.ssim import ssim from piqa.utils.functional import gaussian_kernel

kernel = gaussian_kernel(11, sigma=1.5).repeat(3, 1, 1) ss, cs = ssim(x, y, kernel=kernel) ```

For more information, check out the documentation at piqa.readthedocs.io.

Available metrics

| Class | Range | Objective | Year | Metric | |:---------:|:------:|:---------:|:----:|------------------------------------------------------------------------------------------------------| | TV | [0, ∞] | / | 1937 | Total Variation | | PSNR | [0, ∞] | max | / | Peak Signal-to-Noise Ratio | | SSIM | [0, 1] | max | 2004 | Structural Similarity | | MS_SSIM | [0, 1] | max | 2004 | Multi-Scale Structural Similarity | | LPIPS | [0, ∞] | min | 2018 | Learned Perceptual Image Patch Similarity | | GMSD | [0, ∞] | min | 2013 | Gradient Magnitude Similarity Deviation | | MS_GMSD | [0, ∞] | min | 2017 | Multi-Scale Gradient Magnitude Similarity Deviation | | MDSI | [0, ∞] | min | 2016 | Mean Deviation Similarity Index | | HaarPSI | [0, 1] | max | 2018 | Haar Perceptual Similarity Index | | VSI | [0, 1] | max | 2014 | Visual Saliency-based Index | | FSIM | [0, 1] | max | 2011 | Feature Similarity | | FID | [0, ∞] | min | 2017 | Fréchet Inception Distance |

Tracing

All metrics of piqa support PyTorch's tracing, which optimizes their execution, especially on GPU.

```python ssim = piqa.SSIM().cuda() ssim_traced = torch.jit.trace(ssim, (x, y))

l = 1 - ssimtraced(x, y) # should be faster ¯_(ツ)/¯ ```

Assert

PIQA uses type assertions to raise meaningful messages when a metric doesn't receive an input of the expected type. This feature eases a lot early prototyping and debugging, but it might hurt a little the performances. If you need the absolute best performances, the assertions can be disabled with the Python flag -O. For example,

python -O your_awesome_code_using_piqa.py

Alternatively, you can disable PIQA's type assertions within your code with

python piqa.utils.set_debug(False)

Contributing

If you have a question, an issue or would like to contribute, please read our contributing guidelines.

Owner

  • Name: François Rozet
  • Login: francois-rozet
  • Kind: user
  • Location: Liège, Belgium
  • Company: University of Liège

PhD student in deep learning applied to simulation-based inference and physics-informed learning under the supervision of Prof. @glouppe.

Citation (CITATION.cff)

cff-version: 1.2.0
type: software
title: "PIQA: PyTorch Image Quality Assessement"
authors:
  - given-names: François
    family-names: Rozet
    email: francois.rozet@outlook.com
    affiliation: University of Liège
    orcid: https://orcid.org/0000-0002-8846-8761
url: https://pypi.org/project/piqa
doi: 10.5281/zenodo.7821598
date-released: 2020-12-05
license: MIT

GitHub Events

Total
  • Issues event: 1
  • Watch event: 24
Last Year
  • Issues event: 1
  • Watch event: 24

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 90
  • Total Committers: 2
  • Avg Commits per committer: 45.0
  • Development Distribution Score (DDS): 0.011
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
François Rozet f****t@o****m 89
Ilya Polishchuk i****k@a****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 13
  • Total pull requests: 8
  • Average time to close issues: 7 days
  • Average time to close pull requests: 7 days
  • Total issue authors: 12
  • Total pull request authors: 3
  • Average comments per issue: 2.15
  • Average comments per pull request: 0.38
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • trougnouf (2)
  • snk4tr (1)
  • torridgristle (1)
  • lxy51 (1)
  • nexplor (1)
  • francois-rozet (1)
  • ljeonjko (1)
  • pythonmobile (1)
  • kanishk-aidash (1)
  • quqixun (1)
  • prabathbr (1)
  • ldv1 (1)
Pull Request Authors
  • francois-rozet (6)
  • ilpoli (1)
  • Julien-Gustin (1)
Top Labels
Issue Labels
bug (5) enhancement (4) expected (2)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 6,926 last-month
  • Total docker downloads: 13
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 7
    (may contain duplicates)
  • Total versions: 27
  • Total maintainers: 1
proxy.golang.org: github.com/francois-rozet/piqa
  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: piqa

PyTorch Image Quality Assessment

  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 7
  • Downloads: 6,926 Last month
  • Docker Downloads: 13
Rankings
Stargazers count: 3.4%
Dependent repos count: 5.6%
Downloads: 6.7%
Average: 6.9%
Forks count: 8.9%
Dependent packages count: 10.1%
Maintainers (1)
Last synced: 7 months ago

Dependencies

requirements.txt pypi
  • torch >=1.8.0
  • torchvision >=0.9.0
docs/requirements.txt pypi
  • docutils ==0.19
  • furo ==2023.3.27
  • sphinx ==6.1.3
setup.py pypi