pyiqa.archs.stlpips_arch ======================== .. py:module:: pyiqa.archs.stlpips_arch .. autoapi-nested-parse:: ST-LPIPS Model github repo link: https://github.com/abhijay9/ShiftTolerant-LPIPS Cite as: @inproceedings{ghildyal2022stlpips, title={Shift-tolerant Perceptual Similarity Metric}, author={Abhijay Ghildyal and Feng Liu}, booktitle={European Conference on Computer Vision}, year={2022} } Module Contents --------------- .. py:data:: default_model_urls .. py:function:: spatial_average(in_tens, keepdim=True) .. py:function:: upsample(in_tens, out_HW=(64, 64)) .. py:function:: normalize_tensor(in_feat, eps=1e-10) .. py:class:: STLPIPS(pretrained=True, net='alex', variant='shift_tolerant', lpips=True, spatial=False, pnet_tune=False, use_dropout=True, pretrained_model_path=None, eval_mode=True, blur_filter_size=3) Bases: :py:obj:`torch.nn.Module` ST-LPIPS model. :param lpips: Whether to use linear layers on top of base/trunk network. :type lpips: Boolean :param pretrained: Whether means linear layers are calibrated with human perceptual judgments. :type pretrained: Boolean :param net: ['alex','vgg','squeeze'] are the base/trunk networks available. :type net: String :param pretrained_model_path: Petrained model path. :type pretrained_model_path: String :param The following parameters should only be changed if training the network: :param eval_mode: choose the mode; True is for test mode (default). :type eval_mode: Boolean :param pnet_tune: Whether to tune the base/trunk network. :type pnet_tune: Boolean :param use_dropout: Whether to use dropout when training linear layers. :type use_dropout: Boolean .. py:method:: forward(in0, in1, retPerLayer=False, normalize=True) Computation IQA using LPIPS. :param in1: An input tensor. Shape :math:`(N, C, H, W)`. :param in0: A reference tensor. Shape :math:`(N, C, H, W)`. :param retPerLayer: return result contains result of each layer or not. Default: False. :type retPerLayer: Boolean :param normalize: Whether to normalize image data range in [0,1] to [-1,1]. Default: True. :type normalize: Boolean :returns: Quality score. .. py:class:: ScalingLayer Bases: :py:obj:`torch.nn.Module` .. py:method:: forward(inp) .. py:class:: NetLinLayer(chn_in, chn_out=1, use_dropout=False) Bases: :py:obj:`torch.nn.Module` A single linear layer which does a 1x1 conv .. py:method:: forward(x) .. py:class:: alexnet(requires_grad=False, variant='shift_tolerant', filter_size=3) Bases: :py:obj:`torch.nn.Module` .. py:method:: forward(X) .. py:class:: vggnet(requires_grad=False, variant='shift_tolerant', filter_size=3) Bases: :py:obj:`torch.nn.Module` .. py:method:: forward(X) .. py:class:: Downsample(pad_type='reflect', filt_size=3, stride=2, channels=None, pad_off=0, pad_size='', pad_more=False) Bases: :py:obj:`torch.nn.Module` .. py:method:: forward(inp) .. py:function:: get_pad_layer(pad_type) .. py:class:: VGG(features, num_classes=1000, init_weights=True) Bases: :py:obj:`torch.nn.Module` .. py:method:: forward(x) .. py:function:: make_layers(cfg, batch_norm=False, filter_size=1, pad_more=False, fconv=False) .. py:data:: cfg .. py:function:: vgg16(pretrained=False, filter_size=1, pad_more=False, fconv=False, **kwargs) VGG 16-layer model (configuration "D") :param pretrained: If True, returns a model pre-trained on ImageNet :type pretrained: bool