JingyunLiang / SwinIR

SwinIR: Image Restoration Using Swin Transformer (official repository)

Home Page:https://arxiv.org/abs/2108.10257

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About test part in training

timerobin opened this issue · comments

Thanks for your code first!
I run the super-resolution lightweight part of the code, and there is an error in the testing part of training:

Traceback (most recent call last): File "main_train_psnr.py", line 291, in <module> main() File "main_train_psnr.py", line 190, in main current_psnr = util.calculate_psnr(E_img, H_img, border=border) File "/home/ET/huiyuxiang/KAIR/utils/utils_image.py", line 632, in calculate_psnr raise ValueError('Input images must have the same dimensions.') ValueError: Input images must have the same dimensions.

So that I print the shape and find it is padding the LR image to be multiple of 8 without HR image.

Thank you for reporting the bug. It is because I pad the image at the start of the model, but forget to unpad it correspondly. We have fixed it.

I'm still seeing this after the fixes from cszn/KAIR@e60d24e

21-10-29 09:52:06.238 : Saving the model.
Traceback (most recent call last):
  File "main_train_psnr.py", line 248, in <module>
    main()
  File "main_train_psnr.py", line 236, in main
    current_psnr = util.calculate_psnr(E_img, H_img, border=border)
  File "/usr/WS2/anthony/super-resolution/KAIR/utils/utils_image.py", line 631, in calculate_psnr
    raise ValueError('Input images must have the same dimensions.')
ValueError: Input images must have the same dimensions.

This is with the DIV2K training set and the Set5 test set from KAIR.

Printing the shapes just before this ValueError gives:

img1 shape:  (504, 504, 3)  img2 shape:  (512, 512, 3)

Looks like my issue is related to the google drive Set5 dataset: cszn/KAIR#95 (comment)

Using this repo's Set5 dataset works fine.

ezoic increase your site revenue