Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get im_h_y from im_h? #3

Open
yuanshuai220 opened this issue Aug 3, 2017 · 3 comments
Open

How to get im_h_y from im_h? #3

yuanshuai220 opened this issue Aug 3, 2017 · 3 comments

Comments

@yuanshuai220
Copy link

I want to calculate PSNR on Y channel.
I have got im_gt_y and im_b_y through the mat format files.

im_gt_y = sio.loadmat("output/" + opt.image + ".mat")['im_gt']
im_b_y = sio.loadmat("output/" + opt.image + ".mat")['im_b']

im_gt_y = im_gt_y.astype(float)
im_b_y = im_b_y.astype(float)

psnr_bicubic = PSNR(im_gt_y, im_b_y, shave_border=opt.scale)

But I have some trouble in getting im_h_y from im_h

im_h_y = im_h[:,:,0].astype(float)
psnr_predicted = PSNR(im_gt_y, im_h_y, shave_border=opt.scale)

The result was not right.
I tried to transform the im_h to YCbCr by Image

im_h_ycbcr = np.array(Image.fromarray(im_h, "RGB").convert("YCbCr"))
im_h_y = im_h_ycbcr[0,:,:]
psnr_predicted = PSNR(im_gt_y, im_h_y, shave_border=opt.scale)

It still doesn't work.
Can you give me some advice here.

@twtygqyy
Copy link
Owner

twtygqyy commented Aug 7, 2017

@yuanshuai220 please also load im_h_y from mat file after converting rgb images into ycbcr images in matlab. PIL library cannot give you the best performance in calculating PSNR.

@MKFMIKU
Copy link

MKFMIKU commented Jan 7, 2018

@twtygqyy can you provide the Matlab script to test psnr? 😂

@HPL123
Copy link

HPL123 commented Dec 10, 2018

@yuanshuai220 ,Hi,I don't know why it needs so much memory when test and the train is normal. Have you ever had this problem?
::
RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1501969512886/work/pytorch-0.1.12/torch/lib/THC/generic/THCStorage.cu:66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants