Giter VIP home page Giter VIP logo

prashnani / perceptualimageerror Goto Github PK

View Code? Open in Web Editor NEW
186.0 3.0 24.0 19.7 MB

A metric for Perceptual Image-Error Assessment through Pairwise Preference (PieAPP at CVPR 2018).

License: Other

Python 98.56% Shell 1.44%
perceptual-error perceptual-similarity image-quality-assessment deep-learning deep-neural-networks perception visual-perception perceptual-metric perceptual-quality perceptual

perceptualimageerror's Introduction

Perceptual Image Error Metric (PieAPP v0.1)

This is the repository for the "PieAPP" metric which measures the perceptual error of a distorted image with respect to a reference and the associated dataset.

Technical details about the metric can be found in our paper "PieAPP: Perceptual Image-Error Assessment through Pairwise Preference", published at CVPR 2018, and also on the project webpage. The directions to use the metric can be found in this repository.

Using PieAPP

In this repo, we provide the Tensorflow and PyTorch implementations of our evaluation code for PieAPP v0.1 along with the trained models. We also provide a Win64 command-line executable.

UPDATE: The default patch sampling is changed to "dense" in the demo scripts test_PieAPP_TF.py and test_PieAPP_PT.py, (see "Expected input and output" for details). This is the recommended setting for evaluating PieAPP for its accuracy as compared to other image error evaluation methods since the release of PieAPP.

Dependencies

The code uses Python 2.7, numpy, opencv and PyTorch 0.3.1 (tested with cuda 9.0; wheel can be found here) (files ending with PT) or Tensorflow 1.4 (files ending with TF).

Expected input and output

The input to PieAPPv0.1 are two images: a reference image, R, and a distorted image, A and the output is the PieAPP value of A with respect to R. PieAPPv0.1 outputs a number that quantifies the perceptual error of A with respect to R.

Since PieAPPv0.1 is computed based on a weighted combination of the patchwise errors, the number of patches extracted affects the speed and accuracy of the computed error. We have two modes of operation:

  • "Dense" sampling (default) : Selects 64x64 patches with a stride of 6 pixels for PieAPP computation; this mode is recommended for performance evaluation of PieAPP for its accuracy as compared to other image error evaluation methods.
  • "Sparse" sampling: Selects 64x64 patches with a stride of 27 pixels for PieAPP computation (recommended for high-speed processing, for example when used in a pipeline that requires fast execution time)

For large images, to avoid holding all sampled patches in memory, we recommend fetching patchwise errors and weights for sub-images followed by a weighted averaging of the patchwise errors to get the overall image error (see demo scripts test_PieAPP_TF.py and test_PieAPP_PT.py).

PieAPPv0.1 with Tensorflow:

Script test_PieAPP_TF.py demonstrates the inference using Tensorflow.

Download trained model:

bash scripts/download_PieAPPv0.1_TF_weights.sh

Run the demo script:

python test_PieAPP_TF.py --ref_path <path to reference image> --A_path <path to distorted image> --sampling_mode <dense or sparse> --gpu_id <specify which GPU to use - don't specify this argument if using CPU only>

For example:

python test_PieAPP_TF.py --ref_path imgs/ref.png --A_path imgs/A.png --sampling_mode sparse --gpu_id 0

PieAPPv0.1 with PyTorch:

Script test_PieAPP_PT.py demonstrates the inference using PyTorch.

Download trained model:

bash scripts/download_PieAPPv0.1_PT_weights.sh

Run the demo script:

python test_PieAPP_PT.py --ref_path <path to reference image> --A_path <path to distorted image> --sampling_mode <dense or sparse> --gpu_id <specify which GPU to use>

For example:

python test_PieAPP_PT.py --ref_path imgs/ref.png --A_path imgs/A.png --sampling_mode sparse --gpu_id 0

PieAPPv0.1 Win64 command-line executable:

We also provide a Win64 command-line executable for PieAPPv0.1. To use it, download the executable, open a Windows command prompt and run the following command:

PieAPPv0.1 --ref_path <path to reference image> --A_path <path to distorted image> --sampling_mode <sampling mode>

For example:

PieAPPv0.1 --ref_path imgs/ref.png --A_path imgs/A.png --sampling_mode sparse

The PieAPP dataset

The dataset subdirectory contains information about the PieAPP dataset, terms of usage, and links to downloading the dataset.

Citing PieAPPv0.1

@InProceedings{Prashnani_2018_CVPR,
author = {Prashnani, Ekta and Cai, Hong and Mostofi, Yasamin and Sen, Pradeep},
title = {PieAPP: Perceptual Image-Error Assessment Through Pairwise Preference},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2018}
}

Acknowledgements

This project was supported in part by NSF grants IIS-1321168 and IIS-1619376, as well as a Fall 2017 AI Grant (awarded to Ekta Prashnani).

perceptualimageerror's People

Contributors

prashnani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

perceptualimageerror's Issues

question about hole-filled image

Hi,i tried to simulate the geometric transformation in distorted images,but i don't understand the method that the hole-filling is done using an open-source tool GMIC,does it means Fill Holes in G'MIC?
thanks a lot!

Available training code

Hi! Will the training code be uploaded any time soon? Am excited to try and train with this metric.

Is the proposed data set still planned for release?

This paper proposes a new dataset and the paper is published in 2018. However, today is around 2020. Is the proposed data set still planned for release? It will be a great contribution to this field and please release the dataset.

Problem with running python code

I tried to run the python code and I am getting following errors:

For Tensorflow variant:

[marian@localhost PerceptualImageError]$ python test_PieAPP_TF.py --ref_path imgs/ref.png --A_path imgs/A.png --sampling_mode sparse
  File "test_PieAPP_TF.py", line 82
    image_ref_batch: im_Ref
                  ^
SyntaxError: invalid syntax

For PyTorch variant:

[marian@localhost PerceptualImageError]$ python test_PieAPP_PT.py --ref_path imgs/ref.png --A_path imgs/A.png --sampling_mode sparse
downloading dataset
--2018-10-23 22:10:58--  https://web.ece.ucsb.edu/~ekta/projects/PieAPPv0.1//weights/PieAPPv0.1.pth
Resolving web.ece.ucsb.edu (web.ece.ucsb.edu)... 128.111.56.99
Connecting to web.ece.ucsb.edu (web.ece.ucsb.edu)|128.111.56.99|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 273509598 (261M)
Saving to: ‘PieAPPv0.1.pth’

PieAPPv0.1.pth                    100%[============================================================>] 260.84M  1.62MB/s    in 2m 3s

2018-10-23 22:13:02 (2.13 MB/s) - ‘PieAPPv0.1.pth’ saved [273509598/273509598]

PieAPPv0.1.pth not downloaded

After manually moved the file PieAPPv0.1.pth to weights folder I got following:

[marian@localhost PerceptualImageError]$ mv PieAPPv0.1.pth weights/
[marian@localhost PerceptualImageError]$ python test_PieAPP_PT.py --ref_path imgs/ref.png --A_path imgs/A.png --sampling_mode sparse
Traceback (most recent call last):
  File "test_PieAPP_PT.py", line 61, in <module>
    PieAPP_net.load_state_dict(torch.load('weights/PieAPPv0.1.pth'))
  File "/home/ok/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 719, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for PieAPP:
        size mismatch for ref_score_subtract.weight: copying a param of torch.Size([1, 1]) from checkpoint, where the shape is torch.Size([1]) in current model.

The windows executable works well.

Size mismatch when loading the pretrained pytorch model.

Below is the error message:
"size mismatch for ref_score_subtract.weight: copying a param with shape torch.Size([1]) from checkpoint, the shape in current model is torch.Size([1, 1])."

Need to manually adjust the size of 'ref_score_subtract.weight'.

teaser_PieAPPv0.1.png

Are the images of the salad labelled correctly or are human/pieAPP and existing metrics switched?

(I would not prefer the bottom right image)

Train with Custom dataset?

Sorry for my noob question, but Is possible train this network with my dataset (images from one class) and get same results???

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.