tegg89 / SRCNN-Tensorflow

Image Super-Resolution Using Deep Convolutional Networks in Tensorflow https://arxiv.org/abs/1501.00092v3
MIT License
595 stars 279 forks source link

Padding #27

Closed EricS-TW closed 6 years ago

EricS-TW commented 6 years ago

I have discovered something about testing. You have to pad your left and top of your label image to be 6 and you can calculate the rest part. The result psnr will be better and closer to the paper. The setting is like:

height_padding = {} ; width_padding = {}
height_padding['top'] = 6 height_padding['buttom'] = int(abs(result.shape[0] - label.shape[0]) - height_padding['top'])
width_padding['left'] = 6 width_padding['right'] = int(abs(result.shape[1] - label.shape[1]) - width_padding['left'])

MBCmbc commented 6 years ago

Where to add the setting you've given?

MBCmbc commented 6 years ago

Can you tell me please?

EricS-TW commented 6 years ago

Hello, I wrote some testing code myself. In this repo, the psnr result is not calculated. You have to do some coding. I can only give you some pseudo code:

(1) Read the original image (label) (2) Predict the HR image (HR will be smaller than the label, due to non-zero padding convolution) (3) Crop label like: label = label[height_padding['top']:-height_padding['buttom'], width_padding['left']:-width_padding['right']] (4) Calculate PSNR

chensteven commented 4 years ago

This actually saved my life. PSNR was around 11 for me before padding. Using @EricS-TW 's solution, now my PSNR Is around 21.