torcheval.metrics.FrechetInceptionDistance¶
-
class
torcheval.metrics.
FrechetInceptionDistance
(model: Optional[Module] = None, feature_dim: int = 2048, device: Optional[device] = None)[source]¶ -
__init__
(model: Optional[Module] = None, feature_dim: int = 2048, device: Optional[device] = None) None [source]¶ Computes the Frechet Inception Distance (FID) between two distributions of images (real and generated).
The original paper: https://arxiv.org/pdf/1706.08500.pdf
Parameters: - model (nn.Module) – Module used to compute feature activations. If None, a default InceptionV3 model will be used.
- feature_dim (int) – The number of features in the model’s output, the default number is 2048 for default InceptionV3.
- device (torch.device) – The device where the computations will be performed. If None, the default device will be used.
Methods
__init__
([model, feature_dim, device])Computes the Frechet Inception Distance (FID) between two distributions of images (real and generated). compute
()Compute the FID. load_state_dict
(state_dict[, strict])Loads metric state variables from state_dict. merge_state
(metrics)Merge the state of another FID instance into this instance. reset
()Reset the metric state variables to their default value. state_dict
()Save metric state variables in state_dict. to
(device, *args, **kwargs)Move tensors in metric state variables to device. update
(images, is_real)Update the states with a batch of real and fake images. Attributes
device
The last input device of Metric.to()
.-