Awesome
TensorFlow-GAN (TF-GAN)
TF-GAN is a lightweight library for training and evaluating Generative Adversarial Networks (GANs).
- Can be installed with
pip
usingpip install tensorflow-gan
, and used withimport tensorflow_gan as tfgan
- Well-tested examples
- Interactive introduction to TF-GAN in
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
, orKernel 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:
- Self-Attention Generative Adversarial Networks
- Large Scale GAN Training for High Fidelity Natural Image Synthesis
- GANSynth: Adversarial Neural Audio Synthesis
- Boundless: Generative Adversarial Networks for Image Extension
- NetGAN: Generating Graphs via Random Walks
- Discriminator rejection sampling
- Generative Models for Effective ML on Private, Decentralized Datasets
- Semantic Pyramid for Image Generation
- GAN-Mediated Cell Images Batch Equalization
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:
- Are GANs Created Equal? A Large-Scale Study
- The GAN Landscape: Losses, Architectures, Regularization, and Normalization
- Assessing Generative Models via Precision and Recall
- High-Fidelity Image Generation With Fewer Labels
Training a GAN model
Training in TF-GAN typically consists of the following steps:
- Specify the input to your networks.
- Set up your generator and discriminator using a
GANModel
. - Specify your loss using a
GANLoss
. - Create your train ops using a
GANTrainOps
. - 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
- (Documentation) David Westbrook, westbrook@google.com
- Joel Shor, joelshor@google.com, github
- Aaron Sarna, sarna@google.com, github
- Yoel Drori, dyoel@google.com, github
Authors
- Joel Shor, joelshor@google.com, github