Source-linked AI summary
Improved Precision and Recall Metric for Assessing Generative Models
Tuomas Kynkäänniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, Timo Aila
TL;DR
Automatic evaluation must distinguish generated-sample quality from coverage of the training manifold. The paper introduces a non-parametric manifold-based precision-and-recall metric, demonstrates it on StyleGAN and BigGAN, and uses it to analyze model variants and individual samples.
Problem
Existing metrics combine sample quality and variation, while GAN manifold coverage remains difficult to assess reliably.
Method
The paper embeds real and generated images in classifier-feature space and constructs explicit non-parametric manifold estimates for binary membership queries.
Results
The metric reveals insights in StyleGAN and BigGAN experiments, identifies StyleGAN variants that improve the state-of-the-art, and supports analysis of truncation and latent interpolations.
Takeaways & Limitations
Separate precision and recall can reveal generative-model properties and help improve them further, with precision also useful for image-to-image translation.
Takeaways & Limitations
Finite training sets produce larger k-NN hyperspheres in sparsely represented regions, limiting the interpretation of individual-sample realism.
Abstract
from arXiv · showhide
The ability to automatically estimate the quality and coverage of the samples produced by a generative model is a vital requirement for driving algorithm research. We present an evaluation metric that can separately and reliably measure both of these aspects in image generation tasks by forming explicit, non-parametric representations of the manifolds of real and generated data. We demonstrate the effectiveness of our metric in StyleGAN and BigGAN by providing several illustrative examples where existing metrics yield uninformative or contradictory results. Furthermore, we analyze multiple design variants of StyleGAN to better understand the relationships between the model architecture, training methods, and the properties of the resulting sample distribution. In the process, we identify new variants that improve the state-of-the-art. We also perform the first principled analysis of truncation methods and identify an improved method. Finally, we extend our metric to estimate the perceptual quality of individual samples, and use this to study latent space interpolations.
1 Introduction
Evaluating generative models requires separating sample quality from variation and coverage. The paper improves precision and recall measurement by explicitly representing real and generated manifolds.
- Generative models aim to learn the training-data manifold while generating novel, indistinguishable samples, but automatic evaluation remains challenging.
- Quality concerns whether generated samples are faithful, while variation concerns whether their distribution matches the training data.
- FID, IS, and KID collapse these aspects into one value, making model-performance diagnosis difficult.
- GAN manifold coverage remains challenging, while existing variation metrics are subjective, domain-specific, or unreliable.
- The paper introduces an improved precision-and-recall metric that explicitly exposes the tradeoff between sample quality and variety.
- The metric is demonstrated on StyleGAN and BigGAN, used to analyze StyleGAN variants and truncation, and extended to individual-sample quality and latent interpolations.
2 Improved precision and recall metric using k-nearest neighbors
The metric estimates real and generated manifolds non-parametrically in classifier-feature space, then evaluates precision and recall through binary membership queries. It uses k-nearest-neighbor hyperspheres and adopts k = 3 with 50,000 samples in experiments.
- The method embeds equal numbers of real and generated images into a high-dimensional feature space using a pretrained classifier.
- For each feature set, it builds a manifold estimate by surrounding every vector with a hypersphere reaching its kth nearest neighbor.
- The resulting binary membership function tests whether an image appears realistic or could be reproduced by the generator.
- Precision queries generated images against the estimated real manifold, whereas recall queries real images against the estimated generated manifold.
- VGG-16 classifier features are used because their nearest neighbors correspond to semantically similar images and work better for this metric than perceptual features tested.
- k = 3 and |Φ| = 50000 are used by default because this neighborhood size generally avoids saturation while balancing manifold coverage and volume overestimation.
3 Precision and recall of state-of-the-art generative models
Experiments on StyleGAN and BigGAN show that the proposed precision–recall metric tracks image quality and variation more informatively than existing metrics. Across truncation settings and ImageNet classes, it exposes tradeoffs and coverage differences that FID or Sajjadi et al.’s method can obscure.
- StyleGAN: Our metric tracks StyleGAN’s expected quality–variation tradeoff across four setups, from high-precision, low-recall outputs to low-quality, high-variation outputs.Setup A is heavily truncated, while setups B and C increase variation with some precision loss; setup D preserves variation but produces mostly low-quality images.
- StyleGAN: Sajjadi et al.’s metric treats StyleGAN setups B, C, and D as essentially perfect and assigns setup A the lowest precision, contradicting visual quality.The method incorrectly favors several degraded or artifact-prone configurations.
- Truncation: Under increasing truncation, our method reports high precision and zero recall at ψ = 0, then decreasing precision and increasing recall as truncation is removed.The final recall approximates the fraction of the training set that the generator can reproduce, generally well below 100%; Sajjadi et al.’s method instead raises both values.
- StyleGAN: FID ranks artifact-prone setup C best and makes setups B and D appear nearly equivalent, illustrating its difficulty separating image quality from variation.The paper notes that FID places substantial weight on variation and can favor a model whose images contain obvious distortions.
- BigGAN: For BigGAN, precision is higher on easy ImageNet classes, while recall reveals severe missed variation for classes such as Lemon and Broccoli despite good FID.Low intrinsic variation can produce a low FID even when substantial class variation is absent; difficult classes show higher recall.
4 Using precision and recall to analyze and improve StyleGAN
The metric exposes precision–recall tradeoffs across StyleGAN snapshots and training configurations, revealing differences that FID alone can obscure. These analyses identify configuration changes associated with distinct quality–variation balances and a new best FID result.
- FID can hide qualitative differences and favor a precision–recall tradeoff that may not match the actual evaluation goal.Training randomness further complicates comparisons because FID can vary by up to ±14% between consecutive StyleGAN iterations.
- Network architectures and training configurations: StyleGAN training snapshots trace a Pareto frontier of precision and recall, while configurations produce markedly different tradeoffs.The analysis uses the standard FFHQ configuration with ψ = 1 and compares snapshots and configuration-level frontiers.
- Network architectures and training configurations: Removing the minibatch standard deviation layer shifts the tradeoff toward precision over recall, while reducing R1 regularization shifts it further.The R1 γ parameter is reduced by 100× in the reported comparison.
- Network architectures and training configurations: Disabling progressive growing reduces both precision and recall, whereas random discriminator translation improves precision and disabling AdaIN instance normalization improves recall.Random translation uses offsets from −16 to 16 pixels.
- Network architectures and training configurations: The best-recall configuration achieves a new state-of-the-art FID, while random translation slightly improves FID despite trading recall for precision.FID favors high-recall configurations A and F over high-precision configurations B and C.
5 Estimating the quality of individual samples
The paper extends population-level precision into a continuous realism score for ranking individual generated images and analyzing latent interpolations. It also addresses errors caused by sparse regions in finite training samples through hypersphere pruning.
- Estimating the quality of individual samples: A continuous extension of the precision classifier estimates how close an individual generated sample is to the real-data manifold.The original population metric gives only a binary individual result and therefore cannot rank image quality.
- Realism score: The realism score increases with proximity to the real manifold and satisfies f(φg, Φr) = 1 iff R(φg, Φr) ≥1.When R ≥1, the generated feature vector lies inside at least one k-NN-induced hypersphere around a real feature vector.
- Realism score: Finite-sample k-NN hyperspheres expand in sparsely represented regions, so fringe samples can receive wildly inaccurate individual realism scores.The issue is more consequential for single-image scoring than for large generated populations.
- Realism score: Discarding the half of real-data hyperspheres with the largest radii yields an overconservative realism estimate.The maximum is restricted to hyperspheres smaller than the median radius.
- Examples and interpolations: BigGAN images with high realism generally show recognizable class objects, whereas low-realism images often contain severely distorted objects.The examples cover eight classes and select the highest- and lowest-scoring images from 1,000 non-truncated samples.
- Examples and interpolations: Realism scores reveal whether StyleGAN interpolation paths remain inside the real manifold, with paths A and D entirely inside and outside, respectively.Paths B and C connect one endpoint inside the real manifold to one outside it, without truncation.
6 Conclusion
The conclusion presents separate precision and recall assessment as a source of actionable insight into generative models, while identifying open questions about training configurations and broader applications. It also positions explicit real-manifold modeling as a possible alternative for judging distribution membership.
- Separate precision and recall assessment can reveal insights about generative models and help improve them further.
- Separate precision quantification may also help evaluate image-to-image translation, where individual-image quality is important.
- The metric exposes previously unknown effects of StyleGAN training configurations and raises whether truncation is necessary when training changes can achieve similar tradeoffs.The paper leaves an in-depth study of these effects for future work.
- Explicitly modeling the real manifold may offer an alternative way to estimate whether examples belong to the training distribution.This motivation arises because density models may be incapable of making that assessment.
A Pseudocode and implementation details
The metric embeds real and generated images into a feature space, estimates each manifold with k-NN neighborhoods, and counts cross-set membership to compute precision and recall. The implementation uses pairwise distances and reports its computational cost relative to FID and image generation.
- Pseudocode: PRECISION-RECALL embeds real and generated images with feature network F, estimates both manifolds, and returns precision and recall.The inputs are Xr, Xg, F, and neighborhood size k.
- Evaluation setup: Both metrics are evaluated on 20k real and generated samples in the Figure 10 mode-coverage experiment.Generated data is expanded across five real modes and five extraneous modes for comparison with another method.
- Pseudocode: MANIFOLD-ESTIMATE approximates one feature set’s manifold using hypersphere radii defined by each point’s (k + 1)-th nearest-neighbor distance.The extra neighbor excludes the point itself from its neighborhood radius.
- Pseudocode: The algorithm counts points from the other feature set that fall within the estimated manifold and divides by that set’s size.This cross-set membership fraction supplies the precision or recall estimate depending on the argument order.
- Implementation details: A high-quality estimate with 50k images in each set takes approximately eight minutes on one Tesla V100 GPU, versus four minutes for FID.Generating 50k 1024 × 1024 StyleGAN images takes approximately 14 minutes on one GPU.
B Precision and recall with synthetic dataset
On a synthetic 10-class Gaussian mixture, the metric correctly tracks precision and recall as the generator covers different numbers of modes; truncation results are visualized separately for precision and recall.
- The experiment uses a 10-class 2D Gaussian mixture in which real data covers five modes and the generator covers 1–10 modes.
- The method yields the correct precision and recall values across the tested mode-coverage cases.
- Figure 11 separately plots precision and recall for different truncation amounts with FFHQ.
C Analysis of truncation methods
The metric provides a principled comparison of truncation strategies, showing that clamping offers the best supported tradeoff between precision and recall while density-based choices outperform distance-based rejection.
- The study evaluates truncation as a post-training quality–variation tradeoff and compares four primary strategies in StyleGAN’s intermediate latent space W.
- Strategies operating in Z produce an inferior precision–recall tradeoff, indicating that sampling density in Z poorly predicts image quality.
- Density-based rejection outperforms distance-based rejection, supporting a multivariate Gaussian as a proxy for image quality.
- Clamping outliers outperforms rejecting them because it preserves coverage around the distribution’s extremes.
- Random replacement can slightly increase recall as an artifact of the increasingly conservative k-NN manifold approximation at lower sample density.
- When probability-density differences are included through FID, clamping becomes the clear winner and minimizes the Wasserstein-2 distance to the original distribution in W.
D Quality of samples and interpolations
Realism scores distinguish recognizable, coherent generated images and interpolations from distorted ones, while high-scoring StyleGAN samples can omit difficult visual variation.
- BigGAN images with high realism scores contain clear class-consistent objects, whereas low-scoring images often lack or distort the target object.
- High-scoring StyleGAN samples lose some variation in backgrounds and accessories, while low-scoring samples often contain challenging features such as hats, microphones, and occlusions.
- High-quality interpolations combine strong perceptual quality with coherent backgrounds even when their endpoints differ substantially.
- Low-quality interpolations are typically distorted and contain incoherent background patterns.
- Figures 12–14 present high- and low-quality examples for BigGAN samples, StyleGAN samples, and interpolations, respectively.