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

batch image generation #30

Open
weili-git opened this issue Apr 10, 2020 · 1 comment
Open

batch image generation #30

weili-git opened this issue Apr 10, 2020 · 1 comment

Comments

@weili-git
Copy link

Thank you for sharing the code. I discovered that the 'generator' generate 64 images each time by 64 different embeddings. However, when I tried to copy embeddings :
for i in range(10):
right_embed[i] = right_embed[0]
it still work and generate normal images with the first 10 images look the same, but when most of embeddings are the same ( range 50 ), the 'generator' cant work and will generate wierd results.
SO, what I should do to generate small number of images by embeddings from 2~3 descriptions, because I cant achieve this by simply copy these embeddings 64 times .

@martinduartemore
Copy link

Hi!

I believe this problem may be caused by the Batch Normalization layers.

The predict method never calls .eval() on the generator, which means that the BN layers of the generator network are not using the estimated running mean and variance (obtained in training phase). Instead, what is being calculated is the mean and variance of the current batch.

If you set only a few instances of the batch to be the same (10 out of 64), this won't drastically affect the calculation. However, if almost all (or all) instances on the batch are the same, this skews the results of the mean and variance, which leads to problems.

Try adding self.generator.eval() before the self.generator() call. This will also allow you to test using only a few instances, such as N={1,2,3}.

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