Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orthogonal weight init #1

Open
Kaixhin opened this issue Jul 19, 2017 · 7 comments
Open

Orthogonal weight init #1

Kaixhin opened this issue Jul 19, 2017 · 7 comments

Comments

@Kaixhin
Copy link

Kaixhin commented Jul 19, 2017

Shouldn't the repo be called pytorch-SRGAN instead of pytorch-SRResNet?

Anyway, the same group mention using orthogonal weight initialisation in the ESPCN paper released roughly at the same time period - even if they haven't specified it for SRGAN, it's definitely worth trying. The text is as follows:

Biases are initialised to 0 and weights use orthogonal initialisation with gain √2 following recommendations in [30].

So for all convolutional layers you'll want:

nn.init.orthogonal(layer.weight, math.sqrt(2))
nn.init.constant(layer.bias, 0)

Also there is a v5 of the paper with I think more training details, so worth checking carefully to see if there's anything you missed.

@twtygqyy
Copy link
Owner

@Kaixhin Thanks for the suggestions, I will take a look and have a try.

@vimalthilak
Copy link

You may also want to check out the pytorch superresolution example for info on weight init, if need be.

@Kaixhin
Copy link
Author

Kaixhin commented Jul 19, 2017

They use orthogonal init there (but it was written before nn.init) so indeed you should do that. Make note that the √2 is for layers preceding ReLUs, and therefore the final (output) layer does not have a gain (or uses the default of 1).

@ZhangDY827
Copy link

Hi, I have a question, why not implement the VGG loss in the original paper.

@twtygqyy
Copy link
Owner

@CasdDesnDR I updated the code for content loss support.

@HPL123
Copy link

HPL123 commented Dec 10, 2018

@Kaixhin Hi,I don't know why it needs so much memory when test and the train is normal. Have you ever had this problem?
::
RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1501969512886/work/pytorch-0.1.12/torch/lib/THC/generic/THCStorage.cu:66

@Kaixhin
Copy link
Author

Kaixhin commented Dec 10, 2018

@HPL123 There's not enough detail in your comment to determine what the issue is, but if you are talking about running out of GPU memory because of the orthogonal weight initialisation (if not, wrong issue) then you should initialise on CPU and then transfer the model to GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants