MCPcopy Index your code
hub / github.com/eriklindernoren/Keras-GAN

github.com/eriklindernoren/Keras-GAN @main sqlite

repository ↗ · DeepWiki ↗
198 symbols 835 edges 27 files 30 documented · 15%
README
<img src="https://github.com/eriklindernoren/Keras-GAN/raw/main/assets/keras_gan.png" width="480"\>

This repository has gone stale as I unfortunately do not have the time to maintain it anymore. If you would like to continue the development of it as a collaborator send me an email at eriklindernoren@gmail.com.

Keras-GAN

Collection of Keras implementations of Generative Adversarial Networks (GANs) suggested in research papers. These models are in some cases simplified versions of the ones ultimately described in the papers, but I have chosen to focus on getting the core ideas covered instead of getting every layer configuration right. Contributions and suggestions of GAN varieties to implement are very welcomed.

See also: PyTorch-GAN

Table of Contents

Installation

$ git clone https://github.com/eriklindernoren/Keras-GAN
$ cd Keras-GAN/
$ sudo pip3 install -r requirements.txt

Implementations

AC-GAN

Implementation of Auxiliary Classifier Generative Adversarial Network.

Code

Paper: https://arxiv.org/abs/1610.09585

Example

$ cd acgan/
$ python3 acgan.py
<img src="http://eriklindernoren.se/images/acgan.gif" width="640"\>

Adversarial Autoencoder

Implementation of Adversarial Autoencoder.

Code

Paper: https://arxiv.org/abs/1511.05644

Example

$ cd aae/
$ python3 aae.py
<img src="http://eriklindernoren.se/images/aae.png" width="640"\>

BiGAN

Implementation of Bidirectional Generative Adversarial Network.

Code

Paper: https://arxiv.org/abs/1605.09782

Example

$ cd bigan/
$ python3 bigan.py

BGAN

Implementation of Boundary-Seeking Generative Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1702.08431

Example

$ cd bgan/
$ python3 bgan.py

CC-GAN

Implementation of Semi-Supervised Learning with Context-Conditional Generative Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1611.06430

Example

$ cd ccgan/
$ python3 ccgan.py
<img src="http://eriklindernoren.se/images/ccgan.png" width="640"\>

CGAN

Implementation of Conditional Generative Adversarial Nets.

Code

Paper:https://arxiv.org/abs/1411.1784

Example

$ cd cgan/
$ python3 cgan.py
<img src="http://eriklindernoren.se/images/cgan.gif" width="640"\>

Context Encoder

Implementation of Context Encoders: Feature Learning by Inpainting.

Code

Paper: https://arxiv.org/abs/1604.07379

Example

$ cd context_encoder/
$ python3 context_encoder.py
<img src="http://eriklindernoren.se/images/context_encoder.png" width="640"\>

CoGAN

Implementation of Coupled generative adversarial networks.

Code

Paper: https://arxiv.org/abs/1606.07536

Example

$ cd cogan/
$ python3 cogan.py

CycleGAN

Implementation of Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1703.10593

<img src="http://eriklindernoren.se/images/cyclegan.png" width="640"\>

Example

$ cd cyclegan/
$ bash download_dataset.sh apple2orange
$ python3 cyclegan.py
<img src="http://eriklindernoren.se/images/cyclegan_gif.gif" width="640"\>

DCGAN

Implementation of Deep Convolutional Generative Adversarial Network.

Code

Paper: https://arxiv.org/abs/1511.06434

Example

$ cd dcgan/
$ python3 dcgan.py
<img src="http://eriklindernoren.se/images/dcgan2.png" width="640"\>

DiscoGAN

Implementation of Learning to Discover Cross-Domain Relations with Generative Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1703.05192

<img src="http://eriklindernoren.se/images/discogan_architecture.png" width="640"\>

Example

$ cd discogan/
$ bash download_dataset.sh edges2shoes
$ python3 discogan.py
<img src="http://eriklindernoren.se/images/discogan.png" width="640"\>

DualGAN

Implementation of DualGAN: Unsupervised Dual Learning for Image-to-Image Translation.

Code

Paper: https://arxiv.org/abs/1704.02510

Example

$ cd dualgan/
$ python3 dualgan.py

GAN

Implementation of Generative Adversarial Network with a MLP generator and discriminator.

Code

Paper: https://arxiv.org/abs/1406.2661

Example

$ cd gan/
$ python3 gan.py
<img src="http://eriklindernoren.se/images/gan_mnist5.gif" width="640"\>

InfoGAN

Implementation of InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets.

Code

Paper: https://arxiv.org/abs/1606.03657

Example

$ cd infogan/
$ python3 infogan.py
<img src="http://eriklindernoren.se/images/infogan.png" width="640"\>

LSGAN

Implementation of Least Squares Generative Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1611.04076

Example

$ cd lsgan/
$ python3 lsgan.py

Pix2Pix

Implementation of Image-to-Image Translation with Conditional Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1611.07004

<img src="http://eriklindernoren.se/images/pix2pix_architecture.png" width="640"\>

Example

$ cd pix2pix/
$ bash download_dataset.sh facades
$ python3 pix2pix.py
<img src="http://eriklindernoren.se/images/pix2pix2.png" width="640"\>

PixelDA

Implementation of Unsupervised Pixel-Level Domain Adaptation with Generative Adversarial Networks.

Code

Paper: https://arxiv.org/abs/1612.05424

MNIST to MNIST-M Classification

Trains a classifier on MNIST images that are translated to resemble MNIST-M (by performing unsupervised image-to-image domain adaptation). This model is compared to the naive solution of training a classifier on MNIST and evaluating it on MNIST-M. The naive model manages a 55% classification accuracy on MNIST-M while the one trained during domain adaptation gets a 95% classification accuracy.

$ cd pixelda/
$ python3 pixelda.py
Method Accuracy
Naive 55%
PixelDA 95%

SGAN

Implementation of Semi-Supervised Generative Adversarial Network.

Code

Paper: https://arxiv.org/abs/1606.01583

Example

$ cd sgan/
$ python3 sgan.py
<img src="http://eriklindernoren.se/images/sgan.png" width="640"\>

SRGAN

Implementation of Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network.

Code

Paper: https://arxiv.org/abs/1609.04802

<img src="http://eriklindernoren.se/images/superresgan.png" width="640"\>

Example

$ cd srgan/
<follow steps at the top of srgan.py>
$ python3 srgan.py
<img src="http://eriklindernoren.se/images/srgan.png" width="640"\>

WGAN

Implementation of Wasserstein GAN (with DCGAN generator and discriminator).

Code

Paper: https://arxiv.org/abs/1701.07875

Example

$ cd wgan/
$ python3 wgan.py
<img src="http://eriklindernoren.se/images/wgan2.png" width="640"\>

WGAN GP

Implementation of Improved Training of Wasserstein GANs.

Code

Paper: https://arxiv.org/abs/1704.00028

Example

$ cd wgan_gp/
$ python3 wgan_gp.py
<img src="http://eriklindernoren.se/images/imp_wgan.gif" width="640"\>

Core symbols most depended-on inside this repo

load_data
called by 13
srgan/data_loader.py
load_data
called by 6
pixelda/data_loader.py
load_data
called by 6
cyclegan/data_loader.py
sample_generator_input
called by 4
dualgan/dualgan.py
save
called by 4
sgan/sgan.py
imread
called by 4
cyclegan/data_loader.py
load_data
called by 3
discogan/data_loader.py
imread
called by 3
discogan/data_loader.py

Shape

Method 171
Class 27

Languages

Python100%

Modules by API surface

ccgan/ccgan.py11 symbols
wgan_gp/wgan_gp.py10 symbols
srgan/srgan.py10 symbols
pixelda/pixelda.py10 symbols
infogan/infogan.py10 symbols
pix2pix/pix2pix.py9 symbols
discogan/discogan.py9 symbols
cyclegan/cyclegan.py9 symbols
context_encoder/context_encoder.py9 symbols
aae/aae.py9 symbols
sgan/sgan.py8 symbols
dualgan/dualgan.py8 symbols

For agents

$ claude mcp add Keras-GAN \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact