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.2.tar.gz (14.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.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jax-fid-0.0.2.tar.gz
  • Upload date:
  • Size: 14.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.2.tar.gz
Algorithm Hash digest
SHA256 666f0ee8aba2845bce33fadf0eb017f1711b195545da3b693539af69516dbc54
MD5 f47a6b12b9ae85871c03cb4c7e1fbeab
BLAKE2b-256 25f59959ccd05f5ca6766b7a5ccb3f52537ed2d20e4f50e6ac4a8d83c20db640

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jax_fid-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 21b69592c8ff24bc3b38477b496e5638d72aa6500681e84286324152f3659b13
MD5 a2e04ecdd275d75a54e6be5063279372
BLAKE2b-256 32628a6b3d8358e3d1aead84d86b59038bf816fe79b01c03111a273db47fcb3e

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