Fréchet Wavelet Distance: A Domain-Agnostic Metric for Image Generation

FWD LOGO

Fréchet Wavelet Distance: A Domain-Agnostic Metric for Image Generation#

Lokesh Veeramacheneni1, Moritz Wolter1, Hilde Kuehne2, and Juergen Gall1

1. University of Bonn,
2. University of Tübingen, MIT-IBM Watson AI Lab.

Documentation Status License CodeStyle Workflow Arxiv Paper Downloads Project Page

Keywords: Frechet Distance, Wavelet Packet Transform, FID, Diffusion, GAN, ImageNet, FD-DINOv2,

Abstract: Modern metrics for generative learning like Fréchet Inception Distance (FID) and DINOv2-Fréchet Distance (FD-DINOv2) demonstrate impressive performance. However, they suffer from various shortcomings, like a bias towards specific generators and datasets. To address this problem, we propose the Fréchet Wavelet Distance (FWD) as a domain-agnostic metric based on the Wavelet Packet Transform (\(W_p\)). FWD provides a sight across a broad spectrum of frequencies in images with a high resolution, preserving both spatial and textural aspects. Specifically, we use (\(W_p\)) to project generated and real images to the packet coefficient space. We then compute the Fréchet distance with the resultant coefficients to evaluate the quality of a generator. This metric is general-purpose and dataset-domain agnostic, as it does not rely on any pre-trained network while being more interpretable due to its ability to compute Fréchet distance per packet, enhancing transparency. We conclude with an extensive evaluation of a wide variety of generators across various datasets that the proposed FWD can generalize and improve robustness to domain shifts and various corruptions compared to other metrics.

Alternative text

Installation#

Install via pip

pip install pytorchfwd

Usage#

python -m pytorchfwd <path to dataset> <path to generated images>

Here are the other arguments and defaults used.

python -m pytorchfwd --help

usage: pytorchfwd.py [-h] [--batch-size BATCH_SIZE] [--num-processes NUM_PROCESSES] [--save-packets] [--wavelet WAVELET] [--max_level MAX_LEVEL] [--log_scale] path path

positional arguments:
  path                  Path to the generated images or path to .npz statistics file.

options:
  -h, --help            show this help message and exit
  --batch-size          Batch size for wavelet packet transform. (default: 128)
  --num-processes       Number of multiprocess. (default: None)
  --save-packets        Save the packets as npz file. (default: False)
  --wavelet             Choice of wavelet. (default: sym5)
  --max_level           wavelet decomposition level (default: 4)
  --log_scale           Use log scaling for wavelets. (default: False)

We conduct all the experiments with Haar wavelet with transformation/decomposition level of 4 for 256x256 image. In future, we plan to release the jax-version of this code.

Citation#

If you use this work, please cite using following bibtex entry

@inproceedings{
 veeramacheneni2025fwd,
 title={Fr\'echet Wavelet Distance: A Domain-Agnostic Metric for Image Generation},
 author={Lokesh Veeramacheneni and Moritz Wolter and Hildegard Kuehne and Juergen Gall},
 booktitle={The Thirteenth International Conference on Learning Representations},
 year={2025},
 url={https://openreview.net/forum?id=QinkNNKZ3b}}

Acknowledgments#

The code is built with inspiration from Pytorch-FID. We use PyTorch Wavelet Toolbox for Wavelet Packet Transform implementation. We recommend to have a look at these repositories.

Testing#

The tests folder contains tests to conduct independent verification of FWD. Github workflow executes all these tests. To run tests on your local system install nox, as well as this package via pip install ., and run

nox -s test

Funding#

Research was supported by the Bundesministerium für Bildung und Forschung (BMBF) via its “BNTrAInee” (16DHBK1022) and “WestAI” (01IS22094A) projects. The authors gratefully acknowledge the Gauss Centre for Supercomputing e.V. (www.gauss-centre.eu) for funding this project by providing computing time through the John von Neumann Institute for Computing (NIC) on the GCS Supercomputer JUWELS at Jülich Supercomputing Centre (JSC)

Welcome to PyTorch-FWD’s documentation!#

Indices and tables#