cszn / KAIR

Image Restoration Toolbox (PyTorch). Training and testing codes for DPIR, USRNet, DnCNN, FFDNet, SRMD, DPSR, BSRGAN, SwinIR
https://cszn.github.io/
MIT License
2.93k stars 629 forks source link

BSRGAN article's hyperparams differ from JSON option files; which one is right? #136

Open umbertov opened 2 years ago

umbertov commented 2 years ago

Hi, I was checking training details on the BSRGAN paper, and comparing them to options/train_bsrgan_x4_gan.json, I found a few differences which might be important for reproduction and research. I'm working with BSRGAN due to my master thesis project.

I refer to the end of section 5, at page 6, second column:

  • [...] we train the BSRGAN by minimizing a weighted combination of L1 loss, VGG perceptual loss and spectral norm-based least square PatchGAN loss [19] with weights 1, 1 and 0.1, respectively. *

Here i notice two discrepancies:

Then, the next sentence is:

In particular, the VGG perceptual loss is operated on the fourth convolution before the fourth rather than the fifth maxpooling layer of the pre-trained 19-layer VGG model as it is more stable to prevent color shift issues

But looking at the definition of F (the feature network used for perceptual loss), I would expect that F_feature_layer contains the index of a single layer. Instead I find 5 indices [2,7,16,25,34].

My question is which one's correct? The info on the paper or the one of the JSON files? It could have gone both ways: reporting correct values on the paper then uploading wrong/old version of the JSON file, or reporting old/wrong data on the paper while having uploaded the correct JSON file to this repo.

@cszn Since you're among the authors of the paper, could you shed some light on this?

cszn commented 2 years ago

There is no unique solution, the two settings can give rise to similar results.

umbertov commented 2 years ago

Ok, thanks for the reply! Just for the sake of curiosity though, did you keep a record of the exact settings you trained with to reach the scores/obtain the checkpoints you provided? I assumed they would be the train_bsrgan_x4_{psnr,gan}.json ones but i wasn't so sure after double checking with the article.