Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 1.55 KB

README.md

File metadata and controls

21 lines (17 loc) · 1.55 KB

Fréchet Inception Distance

A new Tensorflow implementation of the "Fréchet Inception Distance" (FID) between two image distributions, along with a numpy interface. The FID can be used to evaluate generative models by calculating the FID between real and fake data distributions (lower is better).

Dependencies

  • numpy and tensorflow-gpu

Features

  • Fast, easy-to-use and memory-efficient
  • No prior knowledge about Tensorflow is necessary to use this code
  • Makes use of TFGAN
  • Downloads InceptionV1 automatically
  • Compatible with both Python 2 and Python 3

Usage

  • Call get_fid(images1, images2), where images1, images2 are numpy arrays with values ranging from 0 to 255 and shape in the form [N, 3, HEIGHT, WIDTH] where N, HEIGHT and WIDTH can be arbitrary. dtype of the images is recommended to be np.uint8 to save CPU memory.
  • A smaller BATCH_SIZE reduces GPU memory usage, but at the cost of a slight slowdown.
  • If you want to compute a general "Fréchet Classifier Distance" with activations (e.g., outputs of the last pooling layer) act1 and act2 from another classifier, call activations2distance(act1, act2). act1 and act2 can be numpy arrays of a same arbitrary shape [N, d].

Links