Keras-GAN | Keras implementations of Generative Adversarial Networks | Machine Learning library
kandi X-RAY | Keras-GAN Summary
kandi X-RAY | Keras-GAN Summary
Keras implementations of Generative Adversarial Networks.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Train the model
- Save images for the given epoch
- Sample random images from X
- Train the discriminator
- Sample images
- Setup MNIST - M image
- Normalize image
- Load a batch of examples
- Read image file
- Loads training images
- Setup the MNIST dataset
- Load an image
Keras-GAN Key Features
Keras-GAN Examples and Code Snippets
Community Discussions
Trending Discussions on Keras-GAN
QUESTION
I'm tried to implement basic GAN in Keras, based on this implementation.
If I sample points on parabola GAN is converges and able to produce samples from this distribution, but if for example I sample points on circle it fails. I wonder why it's hard for GAN? How it can be fixed?
Here is learning process for parabola:
Here is learning process for circle:
Here is the code to reproduce:
...ANSWER
Answered 2021-Feb-21 at 11:39As you can see from the accuracy plots you have in Tensorboard, your principal problem here is with the discriminator. Because its accuracy oscillates around 50-60% and doesn't improve. And this is very bad because the generator is downstream and can't train until the discriminator achieves decent accuracy. So what is wrong with the discriminator?
First, it is the way you train it. You feed it positive and negative samples in two separate batches. This can generate gradients pushing your model coefficients randomly in opposite directions with very poor convergence. If you combine both types of samples in a single batch, convergence will improve significantly.
Second, the batch size. 32 random points around a circle is too little for the model to feel the difference against 32 random points. You need to have a batch size of at least 256.
Third, the number of neurons in hidden layers. Actually, you have too many neurons for such simple data in both generator and discriminator. Having too many of them in the discriminator doesn't seem to do much harm, but having too many neurons in the generator makes it too unstable, the discriminator each time receives different training data and this is one more reason why it fails to train properly. If you put 16 and 32 hidden neurons instead of 64 and 128 into the generator, it will be much better.
And the last point: it is not only the circular form that makes your circle difficult to learn but also its size. It has a radius of 1, and 1 is the saturation value of your generator, so it is very easy for it to produce values around 1. And this makes additional trouble for the generator: it starts receiving fake data too close to the true data before it achieves decent accuracy.
To summarize:
- Combine true and fake data into a single batch.
- Use a larger batch size (at least 256).
- Reduce the number of neurons at least in the generator (e.g. to 16 and 32).
And one more thing: it is better to ask such questions in this community https://stats.stackexchange.com/.
QUESTION
I am running the Generative Adversarial Network in my personal system and I am getting the error provided as below, it may be because of GPU accessing problem as explained in this link: (Function call stack: keras_scratch_graph Error)
Since I want to run the code in my personal system which does not consist with GPU then how to manage that the code should not access the GPU?
The python code is provided in this link: (https://github.com/eriklindernoren/Keras-GAN/tree/master/pix2pix), where the running code is present in pix2pix.py file.
Produced Error is as follow:
...ANSWER
Answered 2020-Apr-08 at 17:46This error has been resolved when I have changed the
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Keras-GAN
You can use Keras-GAN like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page