Skip to main content

FID computation in Jax/Flax.

Project description

FID computation in Jax/Flax

This is a port of mseitzer/pytorch-fid, which is a port of the original FID implementation (bioinf-jku/TTUR).

The parameters for the InceptionV3 network are taken from mseitzer/pytorch-fid. The FID scores are almost identical (absolute difference around 1e-7).
The only difference is that mseitzer/pytorch-fid resizes the images to 299x299 by default. In this implementation, the images are not resized by default. You can resize the images using the --img_size argument.

Installation

You will need Python 3.7 or later.

  1. For GPU usage, follow the Jax installation with CUDA.
  2. Then install:
    > pip install jax-fid
    

For CPU-only you can skip step 1.

Usage

Compute FID score

> CUDA_VISIBLE_DEVICES=N python -m jax_fid --path1 /path/to/dataset1 --path2 /path/to/dataset2

where N is the GPU index.

Pre-compute statistics for image directory

> CUDA_VISIBLE_DEVICES=N python -m jax_fid --precompute --img_dir /path/to/dataset --out_dir /path/to/stats

Arguments

--path1 - Path to image directory or .npz file containing pre-computed statistics.
--path2 - Path to image directory or .npz file containing pre-computed statistics.
--batch_size - Batch size per device for computing the Inception activations.
--img_size - Resize images to this size. The format is (height, width).
--precompute - If True, pre-compute statistics for given image directory.
--img_dir - Path to image directory for pre-computing statistics.
--out_dir - Path where pre-computed statistics are stored.

License

Apache-2.0 License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jax-fid-0.0.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jax_fid-0.0.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file jax-fid-0.0.1.tar.gz.

File metadata

  • Download URL: jax-fid-0.0.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for jax-fid-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a2647ddead33685b30454ba053f30eaf08a37183a1b3cfb2fe6c2c2d7da90bd1
MD5 919d26b615db0aab7cd628e788e05628
BLAKE2b-256 5e40cdee858705bd9294155b0d2d06ccaccbb5ebdf7c89c167b29433ed971d0c

See more details on using hashes here.

File details

Details for the file jax_fid-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: jax_fid-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for jax_fid-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10485de92b98d8d106e62c5f9a563a0599aa41cbcc157d51cbe6fe834bb10ff1
MD5 da0253709b0ec8d355c6662288690819
BLAKE2b-256 3a7a63a91291ca97839f036b1d325e4d555e196bb60df2531ee896150e40d064

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page