Skip to content
Create images and texts with the First Order Generative Adversarial Networks
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
BEGAN_FID_batched fix typo Aug 25, 2017
DCGAN_FID_batched added a bash script to run the fogan Feb 9, 2018
FID_vs_Inception_Score Delete dummy.txt Oct 25, 2017
Results/figures Delete dummy.txt Oct 25, 2017
Toy_Data_Example more coherent variable names Oct 25, 2017
LICENSE Update LICENSE Oct 25, 2017 updated readme with link to paper Feb 14, 2018 Remove unbatched version Aug 21, 2017 typo and some progress prints Sep 19, 2017

First Order Divergence for training GANs

This repository contains code accompanying the paper First Order Generative Advesarial Netoworks

The majority of the code was copied from the repository

First Order Wasserstein Divergence GAN

The key added value of this code is its implementation two GANS that minimize not the KL-divergence or the WGAN-GP divergence, but the First Order Wasserstein Divergence, leading to better stability and perfomance.

Frechet Inception Distance (FID)

The FID is the performance measure used to evaluate the experiments in the paper. There, a detailed description can be found in the experiment section as well as in the the appendix in section A1.

In short: The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1) and X_2 ~ N(mu_2, C_2) is

                   d^2 = ||mu_1 - mu_2||^2 + Tr(C_1 + C_2 - 2*sqrt(C_1*C_2)).

The FID is calculated by assuming that X_1 and X_2 are the activations of the pool_3 layer of the inception model (see below) for generated samples and real world samples respectivly.

Compatibility notice

Previous versions of this repository contained two implementations to calculate the FID, a "unbatched" and a "batched" version. The "unbatched" version should not be used anymore. If you've downloaded this code previously, please update it immediately to the new version. The old version included a bug!

Provided Code

Requirements: TF 1.1, Python 3.x, for faster JSD estimation in language model, compile the language model code.

This file contains the implementation of all necessary functions to calculate the FID. It can be used either as a python module imported into your own code, or as a standalone script to calculate the FID between precalculated (training set) statistics and a directory full of images, or between two directories of images.

To compare directories with pre-calculated statistics (e.g. the ones from, use: /path/to/images /path/to/precalculated_stats.npz

To compare two directories, use /path/to/images /path/to/other_images

See --help for more details.

Example code to show the usage of in your own Python scripts.

Example code to show how to calculate and save training set statistics.


Improved WGAN (WGAN-GP) implementation forked from with added FID evaluation for the image model and switchable TTUR/orig settings. Lanuage model with JSD Tensorboard logging and switchable TTUR/orig settings.

Precalculated Statistics for FID calculation

Precalculated statistics for datasets

are provided at:

Additional Links

For FID evaluation download the Inception modelf from

The cropped CelebA dataset can be downloaded here

To download the LSUN bedroom dataset go to:

The 64x64 downsampled ImageNet training and validation datasets can be found here

You can’t perform that action at this time.