Skip to content

tensorflow/gan

Repository files navigation

TensorFlow-GAN (TF-GAN)

TF-GAN is a lightweight library for training and evaluating Generative Adversarial Networks (GANs).

Structure of the TF-GAN Library

TF-GAN is composed of several parts, which are designed to exist independently:

  • Core: the main infrastructure needed to train a GAN. Set up training with any combination of TF-GAN library calls, custom-code, native TF code, and other frameworks
  • Features: common GAN operations and normalization techniques, such as instance normalization and conditioning.
  • Losses: losses and penalties, such as the Wasserstein loss, gradient penalty, mutual information penalty, etc.
  • Evaluation: standard GAN evaluation metrics. Use Inception Score, Frechet Distance, or Kernel Distance with a pretrained Inception network to evaluate your unconditional generative model. You can also use your own pretrained classifier for more specific performance numbers, or use other methods for evaluating conditional generative models.
  • Examples: simple examples on how to use TF-GAN, and more complicated state-of-the-art examples

Who uses TF-GAN?

Numerous projects inside Google. The following are some published papers that use TF-GAN:

The framework Compare GAN uses TF-GAN, especially the evaluation metrics. Their papers use TF-GAN to ensure consistent and comparable evaluation metrics. Some of those papers are:

Training a GAN model

Training in TF-GAN typically consists of the following steps:

  1. Specify the input to your networks.
  2. Set up your generator and discriminator using a GANModel.
  3. Specify your loss using a GANLoss.
  4. Create your train ops using a GANTrainOps.
  5. Run your train ops.

At each stage, you can either use TF-GAN's convenience functions, or you can perform the step manually for fine-grained control.

There are various types of GAN setup. For instance, you can train a generator to sample unconditionally from a learned distribution, or you can condition on extra information such as a class label. TF-GAN is compatible with many setups, and we demonstrate in the well-tested examples directory

Maintainers

Authors