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

Some questions about the pairwise distributions in W space #3

Closed
twinplant opened this issue May 9, 2022 · 3 comments
Closed

Some questions about the pairwise distributions in W space #3

twinplant opened this issue May 9, 2022 · 3 comments

Comments

@twinplant
Copy link

I'm curious how to get Fig1 in the article. After using tsne for visualization, I find that the pairwise distributions of different latent spaces are circular and.

@zhanjiahui
Copy link

Same question. 😭

@zhanjiahui
Copy link

zhanjiahui commented Oct 29, 2022

Oh, I found the answer. It is not necessary to use t-sne. Here's my code, seaborn is a convenient way to draw probability distributions.

import seaborn as sns

z = torch.randn(10000, 512)
G_ffhq = Generator(1024, 512, 8, channel_multiplier=2)
G_ffhq.load_state_dict(torch.load('pretrained_models/stylegan2-ffhq-config-f.pt', map_location='cpu')['g_ema'],
                       strict=True)
w = G_ffhq.get_latent(z)
w1 = w[:, 10]
w2 = w[:, 500]
w1 = w1.detach().numpy()
w2 = w2.detach().numpy()
sns.jointplot(x=w1, y=w2, kind="scatter", color="#4CB391")
plt.show()

@jfemiani
Copy link
Collaborator

Thanks for your answer, and sorry we missed this issue. Yes, I think tSNE shows you how samples cluster etc. but it does not preserve the shape of the distribution.

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

3 participants