luissen / ESRT

MIT License
164 stars 42 forks source link

error of psnr/ssim #11

Open sc-56 opened 1 year ago

sc-56 commented 1 year ago

sorry for bothering,

when i run the original code, the size of 'im_pre' and 'im_label' is different, and always 'im_pre' is 6-8 pixels less than the 'im_label'. May i ask why this happened and how to solve this issue?

thanks in advance for your support and attention.

shshojaei commented 1 year ago

sorry for bothering,

when i run the original code, the size of 'im_pre' and 'im_label' is different, and always 'im_pre' is 6-8 pixels less than the 'im_label'. May i ask why this happened and how to solve this issue?

thanks in advance for your support and attention.

i have this problem too, so i resized im_pre as below:

  if opt.is_y is True:
    #print("if opt.is_y is True\n")
    im_label = quantize(sc.rgb2ycbcr(cropped_gt_img)[:, :, 0])
    im_pre = quantize(sc.rgb2ycbcr(cropped_sr_img)[:, :, 0])
    #print("y im_pre:\n" , im_pre.shape)
    #print("y im_label:\n", im_label.shape)
    if(im_label.shape != im_pre.shape):
      #print("im_label shape:\n" , im_label.shape)
      im_pre = cv2.resize((im_pre) , (int(im_label.shape[1]) , int(im_label.shape[0])))
      #print("im_pre resized shape:\n" , im_pre.shape)

you can uncomment the lines to see exactly what is happening. but I am not sure it affects the results or not.

chenxu2349 commented 1 year ago

thanks bro, your code solve this problem...