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.
- For GPU usage, follow the Jax installation with CUDA.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2647ddead33685b30454ba053f30eaf08a37183a1b3cfb2fe6c2c2d7da90bd1
|
|
| MD5 |
919d26b615db0aab7cd628e788e05628
|
|
| BLAKE2b-256 |
5e40cdee858705bd9294155b0d2d06ccaccbb5ebdf7c89c167b29433ed971d0c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10485de92b98d8d106e62c5f9a563a0599aa41cbcc157d51cbe6fe834bb10ff1
|
|
| MD5 |
da0253709b0ec8d355c6662288690819
|
|
| BLAKE2b-256 |
3a7a63a91291ca97839f036b1d325e4d555e196bb60df2531ee896150e40d064
|