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
Metadata
Release files for jax-fid 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jax-fid-0.0.2.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jax_fid-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / jax-fid-0.0.2.tar.gz
| Download URL | jax-fid-0.0.2.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
666f0ee8aba2845bce33fadf0eb017f1711b195545da3b693539af69516dbc54
|
|
BLAKE2b-256 checksum How to use checksums |
25f59959ccd05f5ca6766b7a5ccb3f52537ed2d20e4f50e6ac4a8d83c20db640
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / jax_fid-0.0.2-py3-none-any.whl
| Download URL | jax_fid-0.0.2-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21b69592c8ff24bc3b38477b496e5638d72aa6500681e84286324152f3659b13
|
|
BLAKE2b-256 checksum How to use checksums |
32628a6b3d8358e3d1aead84d86b59038bf816fe79b01c03111a273db47fcb3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|