.. image:: https://raw.githubusercontent.com/BonnBytes/PyTorch-FWD/refs/heads/master/images/fwd_logo.png
:width: 25%
:align: center
:alt: FWD LOGO
Fréchet Wavelet Distance: A Domain-Agnostic Metric for Image Generation
**************************************************************************
`Lokesh Veeramacheneni <https://lokiv.dev>`__\ :sup:`1`, `Moritz
Wolter <https://www.wolter.tech/>`__\ :sup:`1`, `Hilde
Kuehne <https://hildekuehne.github.io/>`__\ :sup:`2`, and `Juergen
Gall <https://pages.iai.uni-bonn.de/gall_juergen/>`__\ :sup:`1,3`
| 1. *University of Bonn*
| 2. *University of Tübingen, MIT-IBM Watson AI Lab*
| 3. *Lamarr Institute for Machine Learning and Artificial Intelligence*
|
|Docs| |License| |CodeStyle| |Workflow| |Arxiv| |Downloads| |Project|
**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 (:math:`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 (:math:`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.
.. image:: https://raw.githubusercontent.com/BonnBytes/PyTorch-FWD/refs/heads/master/images/fwd_computation.png
:width: 100%
:alt: Alternative text
Installation
============
Install via pip
.. code:: bash
pip install pytorchfwd
Usage
=====
.. code:: bash
python -m pytorchfwd <path to dataset> <path to generated images>
Here are the other arguments and defaults used.
.. code-block::
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: Haar)
--max_level wavelet decomposition level (default: 4)
--log_scale Use log scaling for wavelets. (default: False)
--resize Additional resizing. (deafult: None)
**We conduct all the experiments with `Haar` wavelet with transformation/decomposition level of `4` for `256x256` image.**
**The choice of max_level is dependent on the image resolution to maintain sufficient spial and frequency information. For 256 image-level 4, 128 image-level 3 and so on.**
In future, we plan to release the jax-version of this code.
Citation
========
If you use this work, please cite using following bibtex entry
.. code-block::
@inproceedings{veeramacheneni25fwd,
author={Lokesh Veeramacheneni and Moritz Wolter and Hilde Kuehne and Juergen Gall},
title={Fréchet Wavelet Distance: A Domain-Agnostic Metric for Image Generation},
year={2025},
cdate={1735689600000},
url={https://openreview.net/forum?id=QinkNNKZ3b},
booktitle={ICLR},
crossref={conf/iclr/2025}}
Acknowledgments
===============
The code is built with inspiration from
`Pytorch-FID <https://github.com/mseitzer/pytorch-fid>`__. We use
`PyTorch Wavelet
Toolbox <https://github.com/v0lta/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
.. code-block:: sh
nox -s test
.. |Workflow| image:: https://github.com/BonnBytes/PyTorch-FWD/actions/workflows/tests.yml/badge.svg
:target: https://github.com/BonnBytes/PyTorch-FWD/actions/workflows/tests.yml
.. |License| image:: https://img.shields.io/badge/License-Apache_2.0-blue.svg
:target: https://opensource.org/licenses/Apache-2.0
.. |CodeStyle| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |Docs| image:: https://readthedocs.org/projects/pytorchfwd/badge/?version=latest
:target: https://pytorchfwd.readthedocs.io/en/latest/index.html
:alt: Documentation Status
.. |Project| image:: https://img.shields.io/badge/Project-Website-blue
:target: https://lokiv.dev/frechet_wavelet_distance/
:alt: Project Page
.. |Arxiv| image:: https://img.shields.io/badge/OpenReview-Paper-blue
:target: https://openreview.net/pdf?id=QinkNNKZ3b
:alt: Paper
.. |Downloads| image:: https://static.pepy.tech/badge/pytorchfwd
:target: https://pepy.tech/projects/pytorchfwd
Funding
=======
This research was supported by the Federal Ministry of Education and Research (BMBF) under grant no.\ 01IS22094A WEST-AI and 6DHBK1022 BNTrAInee, the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) GA 1927/9-1 (KI-FOR 5351) and the ERC Consolidator Grant FORHUE (101044724). Prof. Kuehne is supported by BMBF project STCL - 01IS22067. 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). The authors heartfully thank all the volunteers who participated in the user study. The sole responsibility for the content of this publication lies with the authors.
Raw data
{
"_id": null,
"home_page": "https://github.com/BonnBytes/PyTorch-FWD",
"name": "pytorchfwd",
"maintainer": "Lokesh Veeramacheneni",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "lokeshveeramacheneni27@gmail.com",
"keywords": "Wavelets, Wavelet Transform, Fast Wavelet Transform, PyTorch, Generative Learning, FID, Frechet Inception Distance",
"author": "Lokesh Veeramacheneni",
"author_email": "lokeshveeramacheneni27@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/70/ca/5071a3a3a93de34180b27b40a58cc32ab69fb1e54070b4526707fd7f0c41/pytorchfwd-1.0.1.tar.gz",
"platform": null,
"description": ".. image:: https://raw.githubusercontent.com/BonnBytes/PyTorch-FWD/refs/heads/master/images/fwd_logo.png\n :width: 25%\n :align: center\n :alt: FWD LOGO\n\nFr\u00e9chet Wavelet Distance: A Domain-Agnostic Metric for Image Generation\n**************************************************************************\n\n`Lokesh Veeramacheneni <https://lokiv.dev>`__\\ :sup:`1`, `Moritz\nWolter <https://www.wolter.tech/>`__\\ :sup:`1`, `Hilde\nKuehne <https://hildekuehne.github.io/>`__\\ :sup:`2`, and `Juergen\nGall <https://pages.iai.uni-bonn.de/gall_juergen/>`__\\ :sup:`1,3`\n\n| 1. *University of Bonn* \n| 2. *University of T\u00fcbingen, MIT-IBM Watson AI Lab*\n| 3. *Lamarr Institute for Machine Learning and Artificial Intelligence*\n|\n\n|Docs| |License| |CodeStyle| |Workflow| |Arxiv| |Downloads| |Project|\n\n**Keywords:** Frechet Distance, Wavelet Packet Transform, FID, Diffusion, GAN, ImageNet, FD-DINOv2, \n\n**Abstract:** Modern metrics for generative learning like Fr\u00e9chet Inception Distance (FID) and\nDINOv2-Fr\u00e9chet Distance (FD-DINOv2) demonstrate impressive performance.\nHowever, they suffer from various shortcomings, like a bias towards specific generators and datasets. To address this problem, we propose the Fr\u00e9chet Wavelet\nDistance (FWD) as a domain-agnostic metric based on the Wavelet Packet Transform (:math:`W_p`). FWD provides a sight across a broad spectrum of frequencies in images\nwith a high resolution, preserving both spatial and textural aspects. Specifically,\nwe use (:math:`W_p`) to project generated and real images to the packet coefficient space. We\nthen compute the Fr\u00e9chet distance with the resultant coefficients to evaluate the\nquality of a generator. This metric is general-purpose and dataset-domain agnostic,\nas it does not rely on any pre-trained network while being more interpretable due\nto its ability to compute Fr\u00e9chet distance per packet, enhancing transparency. We\nconclude with an extensive evaluation of a wide variety of generators across various\ndatasets that the proposed FWD can generalize and improve robustness to domain\nshifts and various corruptions compared to other metrics.\n\n\n.. image:: https://raw.githubusercontent.com/BonnBytes/PyTorch-FWD/refs/heads/master/images/fwd_computation.png\n :width: 100%\n :alt: Alternative text\n\nInstallation\n============\n\nInstall via pip \n\n.. code:: bash\n\n pip install pytorchfwd\n\n\nUsage\n=====\n\n.. code:: bash\n\n python -m pytorchfwd <path to dataset> <path to generated images>\n\nHere are the other arguments and defaults used.\n\n.. code-block::\n\n python -m pytorchfwd --help\n \n usage: pytorchfwd.py [-h] [--batch-size BATCH_SIZE] [--num-processes NUM_PROCESSES] [--save-packets] [--wavelet WAVELET] [--max_level MAX_LEVEL] [--log_scale] path path\n \n positional arguments:\n path Path to the generated images or path to .npz statistics file.\n \n options:\n -h, --help show this help message and exit\n --batch-size Batch size for wavelet packet transform. (default: 128)\n --num-processes Number of multiprocess. (default: None)\n --save-packets Save the packets as npz file. (default: False)\n --wavelet Choice of wavelet. (default: Haar)\n --max_level wavelet decomposition level (default: 4)\n --log_scale Use log scaling for wavelets. (default: False)\n --resize Additional resizing. (deafult: None)\n\n**We conduct all the experiments with `Haar` wavelet with transformation/decomposition level of `4` for `256x256` image.**\n**The choice of max_level is dependent on the image resolution to maintain sufficient spial and frequency information. For 256 image-level 4, 128 image-level 3 and so on.**\nIn future, we plan to release the jax-version of this code.\n\nCitation\n========\nIf you use this work, please cite using following bibtex entry\n\n.. code-block::\n\n @inproceedings{veeramacheneni25fwd,\n author={Lokesh Veeramacheneni and Moritz Wolter and Hilde Kuehne and Juergen Gall},\n title={Fr\u00e9chet Wavelet Distance: A Domain-Agnostic Metric for Image Generation},\n year={2025},\n cdate={1735689600000},\n url={https://openreview.net/forum?id=QinkNNKZ3b},\n booktitle={ICLR},\n crossref={conf/iclr/2025}}\n\nAcknowledgments\n===============\n\nThe code is built with inspiration from\n`Pytorch-FID <https://github.com/mseitzer/pytorch-fid>`__. We use\n`PyTorch Wavelet\nToolbox <https://github.com/v0lta/PyTorch-Wavelet-Toolbox>`__ for\nWavelet Packet Transform implementation. We recommend to have a look at\nthese repositories.\n\nTesting\n=======\nThe `tests` folder contains tests to conduct independent verification of FWD. Github workflow executes all these tests.\nTo run tests on your local system install `nox`, as well as this package via `pip install .`, and run\n\n.. code-block:: sh\n\n nox -s test\n\n\n.. |Workflow| image:: https://github.com/BonnBytes/PyTorch-FWD/actions/workflows/tests.yml/badge.svg\n :target: https://github.com/BonnBytes/PyTorch-FWD/actions/workflows/tests.yml\n.. |License| image:: https://img.shields.io/badge/License-Apache_2.0-blue.svg\n :target: https://opensource.org/licenses/Apache-2.0\n.. |CodeStyle| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n.. |Docs| image:: https://readthedocs.org/projects/pytorchfwd/badge/?version=latest\n :target: https://pytorchfwd.readthedocs.io/en/latest/index.html\n :alt: Documentation Status\n.. |Project| image:: https://img.shields.io/badge/Project-Website-blue\n :target: https://lokiv.dev/frechet_wavelet_distance/\n :alt: Project Page\n.. |Arxiv| image:: https://img.shields.io/badge/OpenReview-Paper-blue\n :target: https://openreview.net/pdf?id=QinkNNKZ3b\n :alt: Paper\n.. |Downloads| image:: https://static.pepy.tech/badge/pytorchfwd\n :target: https://pepy.tech/projects/pytorchfwd\n\n\nFunding\n=======\nThis research was supported by the Federal Ministry of Education and Research (BMBF) under grant no.\\ 01IS22094A WEST-AI and 6DHBK1022 BNTrAInee, the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) GA 1927/9-1 (KI-FOR 5351) and the ERC Consolidator Grant FORHUE (101044724). Prof. Kuehne is supported by BMBF project STCL - 01IS22067. 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\u00fclich Supercomputing Centre (JSC). The authors heartfully thank all the volunteers who participated in the user study. The sole responsibility for the content of this publication lies with the authors.\n",
"bugtrack_url": null,
"license": "Apache-2.0 license",
"summary": "Compute frecet wavelet distances",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/BonnBytes/PyTorch-FWD/issues",
"Download": "https://github.com/BonnBytes/PyTorch-FWD/releases",
"Homepage": "https://github.com/BonnBytes/PyTorch-FWD",
"Source Code": "https://github.com/BonnBytes/PyTorch-FWD"
},
"split_keywords": [
"wavelets",
" wavelet transform",
" fast wavelet transform",
" pytorch",
" generative learning",
" fid",
" frechet inception distance"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9a7037c2177cd07574d7420dc95286ab2398625320074359048d3a3ba2c67b8b",
"md5": "6e9875818e03dc3e39d0aaa2ab06eafc",
"sha256": "122401b917195ed4ef08ebae0bfd42312022e292cbe80a77adbd6b6bb0fde6bd"
},
"downloads": -1,
"filename": "pytorchfwd-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e9875818e03dc3e39d0aaa2ab06eafc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 14993,
"upload_time": "2025-09-01T12:53:29",
"upload_time_iso_8601": "2025-09-01T12:53:29.568678Z",
"url": "https://files.pythonhosted.org/packages/9a/70/37c2177cd07574d7420dc95286ab2398625320074359048d3a3ba2c67b8b/pytorchfwd-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "70ca5071a3a3a93de34180b27b40a58cc32ab69fb1e54070b4526707fd7f0c41",
"md5": "495a4112b4141d104c63927956ef8d57",
"sha256": "5ed7a56da4adf7783c5c9c3b309f4c6ba6c299e1ea8d78add1a75bc3638d6a54"
},
"downloads": -1,
"filename": "pytorchfwd-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "495a4112b4141d104c63927956ef8d57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 20897,
"upload_time": "2025-09-01T12:53:31",
"upload_time_iso_8601": "2025-09-01T12:53:31.471736Z",
"url": "https://files.pythonhosted.org/packages/70/ca/5071a3a3a93de34180b27b40a58cc32ab69fb1e54070b4526707fd7f0c41/pytorchfwd-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-01 12:53:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BonnBytes",
"github_project": "PyTorch-FWD",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytorchfwd"
}