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

How to use the corresponding encoder to extract the latent embeddings? #18

Open
c1a1o1 opened this issue Oct 23, 2018 · 1 comment
Open

Comments

@c1a1o1
Copy link

c1a1o1 commented Oct 23, 2018

For each domain, we use the corresponding encoder to extract the latent embeddings. For each image in domain X1, we find the nearest neighbors in domain X2 by calculating the cosine distances between the flattened embeddings.

How to implement this part with code?
Thank you!

@jerryli27
Copy link
Owner

jerryli27 commented Nov 4, 2018

sorry for the late reply!

That part is a proof of concept showing that the latent space is shared among two domains. I did not release that part because the code was quite messy. What you can do is: you can modify inference/image_translation_infer.py to get the latent embedding tensor. (See the encoder output in nets/pggan.py, and try to find the name of the tensor op here: end_points['before_classification'] = net)

Replace FLAGS.output_tensor_name with the tensor name you found.

# Get input and output tensors
self.output = tf.get_default_graph().get_tensor_by_name(FLAGS.output_tensor_name)

After that, save the embedding for each image and do nearest neighbor search using scipy.

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