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

Issues with SVD regularization #7

Open
black-puppydog opened this issue Mar 6, 2018 · 4 comments
Open

Issues with SVD regularization #7

black-puppydog opened this issue Mar 6, 2018 · 4 comments

Comments

@black-puppydog
Copy link

black-puppydog commented Mar 6, 2018

Hi,
first off: thanks for the concise and easy to follow implementation, and congrats for the work building on it, I really enjoyed it. :)

I util.py you write:

contentConv = torch.mm(cF,cF.t()).div(cFSize[1]-1) + torch.eye(cFSize[0]).double()

styleConv = torch.mm(sF,sF.t()).div(sFSize[1]-1)

First: why not regularize both computations? I had this fail on some occasions.

The regularization term eye() is YUGE compared to the normalized covariance matrix. I am more used to seeing eye() * 1e-6 or thelike for regularization, and changing the term to that actually does make a noticable difference in the stylization outcome.
Since we're talking about artistic style transfer here, it's hard to judge which version is better, but out of principle, the smaller the regularization, the closer to the actual whitening/coloring transform we are, no?

@sunshineatnoon
Copy link
Owner

What size of the image that you're testing on? This is only an issue when the features are small, say, if you use a mask during style transfer.

@black-puppydog
Copy link
Author

Well, I wouldn't call it an "issue" (nevermind I posted it as one here :P ) rather just a question.
I was testing on the four images you have in the repo here and getting a noticable (as in, I can notice it) difference.

Like I said, it's not dramatic, I was just wondering if there was a specific rationale behind not regularizing one of the two calls.

@Yanteng32
Copy link

how to train a model? plz tell me thx

@Pikauba
Copy link

Pikauba commented Mar 29, 2020

I actually observed the same issue @black-puppydog. I was wondering why the regularization term eye() was so big. I believe that mathematically it's a mistake to let it how it is and it should normally be multiplied by a small epsilon value. I indeed observe huge difference in the results obtained with small regularization term(with epsilon 1e-8) and big regularization term (no epsilon)!

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

4 participants