question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Infinite values in generated images

See original GitHub issue

For generating new images, I sample z from a zero mean and 0.6 standard deviation normal distribution and feed it to the network with reverse=True argument. But in many images, there are plenty of values greater than 1, even Inf value! How can I handle this issue? What is the problem?

Thanks.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
isharificommented, Sep 26, 2020

Actually, I find the part that value explosion occurs. It happens at module.py at line 53, when it scales the input by torch.exp(logs). The Inf value often happens at layer around 80 during forward pass (reverse=True). Then the generated image with negative inf would be something like it (clamped between [0,1]): image

As a result, in backward pass, the gradient would be inf too. So the training becomes impossible.

0reactions
isharificommented, May 25, 2021

There may arise a numerical issue of division by zero in

https://github.com/chaiyujin/glow-pytorch/blob/487a6b149295f4ec4b36e408f63604c593ff2031/glow/models.py#L93

when there are zero elements in the sigmoid output. For me the following code snippet triggers the division by zero (running an unconditional generation):

torch.cuda.manual_seed_all(16)
glow = glow.to('cuda')
glow(reverse=True)

Or on cpu:

torch.manual_seed(37)
glow = glow.to('cpu')
glow(reverse=True)

I couldn’t reproduce it running conditional generation though. A possible fix would be elementwise adding a small value to the scale before division

Thanks. I will check if it solves the problem and let you know the result.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and Exploring a Large Photorealistic Virtual Space
ABSTRACT | We present a system for generating Binfinite[ images from large collections of photos by means of trans- formed image retrieval.
Read more >
Generating Infinite Beautiful Images Using Math!
Generating Infinite Beautiful Images Using Math! ... Measured and gradual increments/decrements of RGB values to form horizontal/vertical ...
Read more >
InfinityGAN: Towards Infinite-Pixel Image Synthesis
We present InfinityGAN, a method to generate arbitrary-sized images. The problem is associated with several key challenges. First, scaling existing models ...
Read more >
Infinite Image Generation
In this work, we develop a method to generate infinite high-resolution images with diverse and complex content. 1. Paper · Code ...
Read more >
Unsupervised Image Generation With Infinite ...
Unsupervised Image Generation with Infinite Generative Adversarial Networks. Hui Ying1, ... where Ng and Nd are the total numbers of generated and.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found