atlinter.metrics.fid module

Implementation of the Fréchet Inception Distance (FID) metric.

class atlinter.metrics.fid.FID(resize_input=False, device=None)[source]

Bases: object

Class for computing the Fréchet Inception Distance (FID) metric score.

It is implemented as a class in order to hold the inception model instance in its state.

Parameters:
  • resize_input (bool (optional)) – Whether or not to resize the input images to the image size (299, 299) on which the inception model was trained. Since the model is fully convolutional, the score also works without resizing. In literature and when working with GANs people tend to set this value to True, however, for internal evaluation this is not necessary.

  • device (str or torch.device) – The device on which to run the inception model.

score(images_1, images_2)[source]

Compute the FID score.

The input batches should have the shape (n_images, width, height).

Parameters:
  • images_1 (np.ndarray) – First batch of images.

  • images_2 (np.ndarray) – Section batch of images.

Returns:

score – The FID score.

Return type:

float