Giter VIP home page Giter VIP logo

psnr_metric's Introduction

PSNR_metric

Calculating PSNR is a very important task in super-resolution research because PSNR is one of the most commonly used metrics. But early researchs were all on matlab, also including the code to calculate PSNR and preprocess(bicubic downsample and upsample). As most of the current mainstream deep learning frameworks are based of python, I need to re-write the calculating PSNR and preprocess code in python.

Thanks to the work in https://github.com/fatheral/matlab_imresize, it successfully reproduces the function imresize() in Matlab. This code is used to downsample and upsample the picture. And I found out that, the reproduction code is very successful when dealing with double type, but there are some problems when dealing with uint8 type(I only test the part of bicubic). The reason is still unknown yet.

My code for calculating PSNR is based on the code of matlab version in http://mmlab.ie.cuhk.edu.hk/projects/SRCNN.html.

Later I will draw a flowchart about calculating PSNR and put it on github.

How to use

Set5 has been prepared for test.

Briefly, you need to use the picture generate by the code in ./matlab_code and ./matlab_imresize-master, and put them into ./PSNR to calculate PSNR. You can read the readme.md in each code filter, which I write down how to use the code in detail.

Result

Method Language PSNR
test without saving Matlab 33.6614
save the double bicubic image and test Matlab 33.6529
save the uint8 bicubic image and test Matlab 33.6396
save the double bicubic image and test python 33.6529
save the uint8 bicubic image and test python 33.6404
use PIL to resize python 33.6088
use Opencv to resize python 30.9556

Method 1 calculates PSNR without saving the pictures, while method 2 and 3 generate the pictures and then read the pictures to calculate PSNR.

Method 4 and 5 use the imresize() in https://github.com/fatheral/matlab_imresize.

Method 6 and 7 are an simple attempt to resize image with existing libraries, and get unsatisfied result.

I have tested the PSNR calculated by the pictures generated by Method 2 and 3 in both python and Matlab, and get the same result. So the code of calculating PSNR in python version is quite the same as the Matlab version.

Flowchart

Coming soon...

psnr_metric's People

Contributors

cyfwry avatar

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.