Keras-GAN icon indicating copy to clipboard operation
Keras-GAN copied to clipboard

what is the utility of latent_dim ?

Open amapic opened this issue 5 years ago • 3 comments

Hi, What is the utility of latent_dim in gan.py ? Even if I run this code several time, I don't get it. Thank you.

amapic avatar Jan 28 '19 08:01 amapic

What do you mean? "latent_dim" is the number of nodes used as input of the generator

niunno avatar Jan 29 '19 08:01 niunno

Ok, thank you. Why 100 ?

Le mar. 29 janv. 2019 à 09:10, Marco [email protected] a écrit :

What do you mean? "latent_dim" is the number of nodes used as input of the generator

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eriklindernoren/Keras-GAN/issues/115#issuecomment-458445629, or mute the thread https://github.com/notifications/unsubscribe-auth/AIn25IVeKUHlNc5KdK32vbkQfqqqq0Ueks5vIAH9gaJpZM4aVa1z .

amapic avatar Jan 29 '19 13:01 amapic

In this article I found a good explanation that I believe applies to this question:

The generator model is responsible for creating new, fake but plausible images of handwritten digits. It does this by taking a point from the latent space as input and outputting a square grayscale image. The latent space is an arbitrarily defined vector space of Gaussian-distributed values, e.g. 100 dimensions. It has no meaning, but by drawing points from this space randomly and providing them to the generator model during training, the generator model will assign meaning to the latent points and, in turn, the latent space, until, at the end of training, the latent vector space represents a compressed representation of the output space, MNIST images, that only the generator knows how to turn into plausible MNIST images. Inputs: Point in latent space, e.g. a 100 element vector of Gaussian random numbers. Outputs: Two-dimensional square grayscale image of 28×28 pixels with pixel values in [0,1]. Note: we don’t have to use a 100 element vector as input; it is a round number and widely used, but I would expect that 10, 50, or 500 would work just as well.

https://machinelearningmastery.com/how-to-develop-a-generative-adversarial-network-for-an-mnist-handwritten-digits-from-scratch-in-keras/

mneunomne avatar Dec 24 '19 00:12 mneunomne