sanghyun-son / EDSR-PyTorch

PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)
MIT License
2.43k stars 669 forks source link

Why test results of images in jpg format is very worse than images in png format ? #81

Closed YongboLiang closed 5 years ago

YongboLiang commented 5 years ago

Hi, thanks for you sharing.

when I test the DIV2K validation dataset, the result is very good. But when I test the B100 dataset, the result is very bad and the value of psnr is 25.571 in scale 4. Both pre-trained model of the two tests are EDSR_baseline_x4.pt.

The images in B100 dataset are jpg format and I get low resolution jpg images by bicubic downsampling.Then I used these jpg images to participate in the test. Howeve, the reconstruct result is bad and psnr is very low.

Could you tell me how do you test on benchmark dataset such as B100? Thank you very much!

sanghyun-son commented 5 years ago

Hello.

If you would like to upscale the JPEG images, you need to fine-tune our model with JPEG images.

It is because EDSR even does super-resolution to JPEG artifacts, so if you use the model that is trained with clean images, it will end up with enlarged artifacts.

We found that JPEG-input / PNG-output can solve this problem.

If you have enough time, you can try it.

Otherwise, maybe I can upload a model that is trained with the strategy above after CVPR submission.

Thank you!

YongboLiang commented 5 years ago

Thanks for your reply~~

YongboLiang commented 5 years ago

@thstkdgus35 Hello, I tried to test B100 with JPEG-input / PNG-output, but I find the result is still bad. I use the model trained with png images, the input with B100 dataset, and save results as png images. I don't find this improved. Have I understand your reply correctly? if not, please correct me, thanks~~ The images below are Reconstructed images from B100/3096_X4. The first is jpg format and the second is png format. Aaron Swartz

Aaron Swartz

sanghyun-son commented 5 years ago

Hello.

Please follow the guideline below to make your model works well.

  1. Convert clean low-resolution PNG images (DIV2K works nicely) to JPEG images. Usually, Q=75 or Q=100 is recommended.

  2. Construct your training pairs as (Low-resolution JPEG, High-resolution PNG) and train the model.

  3. Test your model with real JPEG images.

If you mix various quality factors like Q=75 and Q=100 in step 1, you can get a more general model that can also handle JPEG artifacts.

Thank you!

YongboLiang commented 5 years ago

got it. thanks, I will try it~~

YongboLiang commented 5 years ago

@thstkdgus35 Hi, I have had a try, but the result is bad. I construct your training pairs (Low-resolution JPEG, High-resolution PNG) as below.

Aaron Swartz

Aaron Swartz

my option is set as below:

model: EDSR data_test: ['B100'] scale: [4] save: edsrf2_32256_x4 pre_train: epochs: 800 debug: False template: . n_threads: 6 cpu: False n_GPUs: 1 seed: 1 dir_data: ../../../dataset dir_demo: ../test data_train: ['MYDATA'] data_range: 1-800/801-810 ext: sep patch_size: 96 rgb_range: 255 n_colors: 3 chop: False no_augment: False act: relu extend: . n_resblocks: 32 n_feats: 256 res_scale: 0.1 shift_mean: True dilation: False precision: single G0: 64 RDNkSize: 3 RDNconfig: B n_resgroups: 10 reduction: 16 reset: False test_every: 1000 batch_size: 16 split_batch: 1 self_ensemble: False test_only: False gan_k: 1 lr: 0.0001 lr_decay: 200 decay_type: step gamma: 0.5 optimizer: ADAM momentum: 0.9 betas: (0.9, 0.999) epsilon: 1e-08 weight_decay: 0 gclip: 0 loss: 1*L1 skip_threshold: 100000000.0 load: resume: 0 save_models: False print_every: 100 save_results: False save_gt: False

However, after train 680 epochs, the reconstruct results of DIV2K verification set is bad. The average PSNR is 26.668. The loss and psnr on B100 are below:

Aaron Swartz Aaron Swartz.

Could you help me analyze the problem,thanks~~

YongboLiang commented 5 years ago

@thstkdgus35 , Hi, When I test the reconstruct images of DIV2K verification only on Y channel, PSNR is 28.60. 26.668 is the PSNR when I test images on RGB channels. The training pairs is set as( Low-resolution JPEG, High-resolution PNG) and testing pairs is set as( Super-resolution PNG, High-resolution PNG) .

When I test the reconstruct images of B100 only on Y channel, PSNR is 26.261. It's still worse than the value of psnr which is 27.71 in your paper. The testing pairs is set as( Super-resolution JPEG, High-resolution JPEG) .

Next I will try to construct training pairs as (Low-resolution JPEG, High-resolution JPEG) and test the result on B100.

Have I understand your reply correctly, Thanks for your guide again~~