PyTorch Image Quality - Paxoo/PyTorch-Best_Practices GitHub Wiki
Collection of measures and metrics for image quality assessment: Pytorch Image Quality (PIQ)
Fast (GPU computations available) and reliable.
Supports python 3.6-3.8.
SSIM
import torch
from piq import ssim
x = torch.rand(4, 3, 256, 256, requires_grad=True)
y = torch.rand(4, 3, 256, 256)
# Starting with Python 3.6, you can declare types of variables and funtions, like this :
# explicit_number: type
# name: str = 'test'
# data_range: Maximum value range of images (usually 1.0 or 255).
# To match performance with skimage and tensorflow set `downsample` = True.
ssim_index: torch.Tensor = ssim(x, y, data_range=1.)
PSNR
import torch
from piq import psnr
x = torch.rand(4, 3, 256, 256, requires_grad=True)
y = torch.rand(4, 3, 256, 256)
# Starting with Python 3.6, you can declare types of variables and funtions, like this :
# explicit_number: type
# name: str = 'test'
# data_range: Maximum value range of images (usually 1.0 or 255).
psnr_index: torch.Tensor = psnr(x, y, data_range=1.)