diffusion_models.evaluation.checkpoint
Score a saved training checkpoint with FID / KID.
Module Contents
- evaluate_checkpoint(checkpoint_path, number_of_samples=10000, batch_size=100, device='cuda', use_ema=True, compute_kid=True, kid_subset_size=1000, steps=None, seed=0, num_workers=4)[source]
Compute FID/KID of a checkpoint produced by
diffusion-models train.The model and the reference dataset are rebuilt from the resolved config stored in the checkpoint. The reference images are the config’s
eval_datasetwhen it has one, otherwise itsdatasetwithsplit="valid"when that dataset has asplitoption.- Parameters:
checkpoint_path (Union[str, Path]) – The checkpoint to evaluate.
number_of_samples (int) – The number of real and generated images compared.
batch_size (int) – The batch size used for sampling and feature extraction.
device (str) – The device to use.
use_ema (bool) – Prefer the EMA weights when the checkpoint has them.
compute_kid (bool) – Whether to also compute KID.
kid_subset_size (int) – The KID subset size.
steps (Optional[int]) – Overrides the number of DDIM sampling steps, when the diffuser has that option.
seed (int) – The seed of the sampling noise.
num_workers (int) – Dataloader workers used to read the real images.
- Returns:
The
FID(andKID) scores.- Return type: