pyiqa.archs.deepdc_arch¶
DeepDC: Deep Distance Correlation as a Perceptual Image Quality Evaluator
Reference: @article{zhu2024adaptive,
title={DeepDC: Deep Distance Correlation as a Perceptual Image Quality Evaluator}, author={Zhu, Hanwei and Chen, Baoliang and Zhu, Lingyu and Wang, Shiqi and Weisi, Lin}, journal={arXiv preprint arXiv:2211.04927}, year={2024},
}
Reference url: https://github.com/h4nwei/DeepDC
Module Contents¶
- class pyiqa.archs.deepdc_arch.MultiVGGFeaturesExtractor(target_features=('conv1_2', 'conv2_2', 'conv3_4', 'conv4_4', 'conv5_4'), use_input_norm=True, requires_grad=False)[source]¶
Bases:
torch.nn.ModuleExtract multiple VGG19 feature maps for DeepDC.
- Parameters:
target_features (tuple[str, ...]) – VGG layer names to return.
use_input_norm (bool) – Whether to apply ImageNet normalization.
requires_grad (bool) – Whether backbone parameters require gradients.
- class pyiqa.archs.deepdc_arch.DeepDC(features_to_compute=('conv1_2', 'conv2_2', 'conv3_4', 'conv4_4', 'conv5_4'))[source]¶
Bases:
torch.nn.ModuleDeepDC full-reference IQA metric.
The score is derived from distance correlation between feature-space double-centered distance matrices.
- Parameters:
features_to_compute (tuple[str, ...]) – VGG feature names used in the DeepDC aggregation.
- forward(x, y)[source]¶
Compute DeepDC quality score.
- Parameters:
x (torch.Tensor) – Distorted image tensor with shape
(N, 3, H, W).y (torch.Tensor) – Reference image tensor with shape
(N, 3, H, W).
- Returns:
Quality score tensor with shape
(N, 1).- Return type:
torch.Tensor
- Distance_Correlation(matrix_A, matrix_B)[source]¶
Compute distance correlation between matrix batches.
- Parameters:
matrix_A (torch.Tensor) – First matrix batch of shape
(N, C, C).matrix_B (torch.Tensor) – Second matrix batch of shape
(N, C, C).
- Returns:
Correlation values with shape
(N,).- Return type:
torch.Tensor
- pyiqa.archs.deepdc_arch.prepare_image(image, resize=True)[source]¶
Convert a PIL image to a 4D tensor for DeepDC demos.
- Parameters:
image (PIL.Image.Image) – Input image.
resize (bool) – If
True, resize shortest side to256when both sides are larger than256.
- Returns:
Tensor with shape
(1, 3, H, W).- Return type:
torch.Tensor