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

What is the usage of geocross loss? #89

Open
yvoonne06 opened this issue Feb 7, 2023 · 1 comment
Open

What is the usage of geocross loss? #89

yvoonne06 opened this issue Feb 7, 2023 · 1 comment

Comments

@yvoonne06
Copy link

yvoonne06 commented Feb 7, 2023

I wonder how the geocross loss works to find the direction of updating the latent vector.

def _loss_geocross(self, latent, **kwargs):
    if(latent.shape[1] == 1):
        return 0
    else:
        X = latent.view(-1, 1, 18, 512)
        Y = latent.view(-1, 18, 1, 512)
        A = ((X-Y).pow(2).sum(-1)+1e-9).sqrt()
        B = ((X+Y).pow(2).sum(-1)+1e-9).sqrt()
        D = 2*torch.atan2(A, B)
        D = ((D.pow(2)*512).mean((1, 2))/8.).sum()
        return D
@MikeLasz
Copy link

You can check out Appendix B of the paper to learn more about the Cross Loss.

In short: StyleGAN uses a style vector $w \in \mathbb{R}^{512}$, which is then tiled, i.e. copied 18 times. This is used as the input of the synthesis network.
PULSE's optimization problem is seeking vectors $v_1, \dots, v_{18}\in \mathbb{R}^{512}$ that minimizes the loss given in eq (9). To enforce $v_1, \dots , v_{18}$ to be more similar, they add the Cross Loss to regularize towards that similarity condition. Since they optimize $v_1, \dots, v_{18}$ on the unit sphere (see the discussion in Section 3.2.), they define that loss as the geodesic distance, which is why they coin it Geo Cross Loss.

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

2 participants