Git Product home page Git Product logo

Comments (3)

hermosayhl avatar hermosayhl commented on August 20, 2024

Additional, I use cv2.PSNR.

from deepupe.

wangruixing avatar wangruixing commented on August 20, 2024

Is the testing data from our link? At first, you should use adobe5k default option to process the data, and try use our matlab psnr code and SSIM code from Wang zhou's homepage.

I have managed to run the code and I test on the same test datasets, only to find disappointing result. Is there anyone encoutering the same problem.
Listed is my results:
共 500 张测试图片
平均结果 :
PSNR : 12.240499250275413 ====> 22.88365191146186
SSIM : 0.6161701658815372 ====> 0.7980569710290214
test images is the same( Adobe FiveK 4500-5000 )
My config is also:
python 2.7
tensorflow-gpu=1.1.0
cuda8.0

from deepupe.

hermosayhl avatar hermosayhl commented on August 20, 2024

I changed my code to compute psnr.

In OpenCV:
  PSNR = 10 * log10( range / mse of all 3 channels )
In your codes:
  PSNR = Mean( 10 * log10( range / mse of one channel) for 3 channels)

The result is so amazing:

共 500 张图像
1 a4844-kme_0393.jpg    25.909085943496024    29.921717892553414
2 a4726-DSC_0120.jpg    22.63510845360183    27.363339705226107
......
500 a4891-DSC_0069.jpg    24.064769515852085    29.045309176387974
opencv_psnr : 22.88365191146186
mean_psnr : 28.895108206611532

The difference between different calculations is so great!
Which is more authoritative?

Test images I use may be different with yours on resolution, therefore, 30 is possible

Snipaste_2020-03-14_22-54-51.png

Snipaste_2020-03-14_22-55-15.png

My codes is listed below:

import os
import cv2
import numpy

# generated images dir
dir_name = './DeepUPE/23/'
names = os.listdir(dir_name)
print('共  ', len(names), ' 张图像')

def compute_mean(a, b):
	mse = numpy.square(a - b)
	mse_3 = [mse[:, :, i].mean() for i in range(3)]
	psnr_3 = [10 * numpy.log10(255 * 255 / it) for it in mse_3]
	return numpy.mean(psnr_3)

opencv_psnr = 0
mean_psnr = 0
for i, it in enumerate(names):
	# l = cv2.imread('./bad/' + it)
	r = cv2.imread('./normal/' + it)
	e = cv2.imread(dir_name + it)
	a = cv2.PSNR(r, e)
	opencv_psnr += a
	b = compute_mean(r, e)
	mean_psnr += b
	print(i + 1, it, a, b)
opencv_psnr /= (i + 1)
mean_psnr /= (i + 1)
print('opencv_psnr  :  ', opencv_psnr)
print('mean_psnr  :  ', mean_psnr)

from deepupe.

Related Issues (20)

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.