Keras-GAN | Keras implementations of Generative Adversarial Networks | Machine Learning library

 by   eriklindernoren Python Version: Current License: MIT

kandi X-RAY | Keras-GAN Summary

kandi X-RAY | Keras-GAN Summary

Keras-GAN is a Python library typically used in Institutions, Learning, Education, Artificial Intelligence, Machine Learning, Deep Learning, Keras, Generative adversarial networks applications. Keras-GAN has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub.

Keras implementations of Generative Adversarial Networks.

            kandi-support Support

              Keras-GAN has a medium active ecosystem.
              It has 8964 star(s) with 3163 fork(s). There are 279 watchers for this library.
              It had no major release in the last 6 months.
              There are 122 open issues and 101 have been closed. On average issues are closed in 167 days. There are 21 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Keras-GAN is current.

            kandi-Quality Quality

              Keras-GAN has 0 bugs and 0 code smells.

            kandi-Security Security

              Keras-GAN has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Keras-GAN code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Keras-GAN is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Keras-GAN releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed Keras-GAN and discovered the below as its top functions. This is intended to give you an instant insight into Keras-GAN implemented functionality, and help decide if they suit your requirements.
            • 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
            Get all kandi verified functions for this library.

            Keras-GAN Key Features

            No Key Features are available at this moment for Keras-GAN.

            Keras-GAN Examples and Code Snippets

            No Code Snippets are available at this moment for Keras-GAN.

            Community Discussions


            Why GAN is unable to generate samples from some distributions?
            Asked 2021-Feb-21 at 11:39

            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:



            Answered 2021-Feb-21 at 11:39

            As 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:

            1. Combine true and fake data into a single batch.
            2. Use a larger batch size (at least 256).
            3. Reduce the number of neurons at least in the generator (e.g. to 16 and 32).

            Enjoy the result:

            And one more thing: it is better to ask such questions in this community



            how to manage the code which does through the following error?
            Asked 2020-Apr-08 at 17:47

            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: (, where the running code is present in file.

            Produced Error is as follow:



            Answered 2020-Apr-08 at 17:46

            This error has been resolved when I have changed the


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install Keras-GAN

            You can download it from GitHub.
            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.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone eriklindernoren/Keras-GAN

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link