Skip to content

Evaluation toolkit for image generators using StyleGAN3 recommended metrics, including FID, KID, IS, Precision, and Recall

Notifications You must be signed in to change notification settings

vkinakh/stylegan-metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StyleGAN3 Metrics for Image Generators

Evaluate your image-generating models with the recommended metrics from the latest StyleGAN3 implementation.

Description

This repository offers a comprehensive toolkit to assess the quality and diversity of generated images. It encompasses the following metrics:

  • Frechet Inception Distance (FID)
  • Kernel Inception Distance (KID)
  • Inception Score (IS)
  • Precision
  • Recall

Whether you're using a StyleGAN model or any other image generator, you can easily evaluate its performance by generating images, saving them, and executing the calc_metrics command.

Installation

Set up the environment and install required dependencies using:

conda env create -f environment.yml

Run Unittests

To ensure the functionality of the repository, execute the unittests:

python -m unittest discover tests/

Run evaluation

Evaluate your generated images with the following script:

python calc_metrics.py --path_real /path/to/real/images \
                       --path_fake /path/to/generated/images \
                       --resolution <image resolution> \
                       --metrics fid,kid,pr,inception_score \
                       --gpus 1 \
                       --verbose True \
                       --results_folder ./results

Note: This script is compatible with individual image files in .npy format with the shape (H, W, 3), as well as the standard .png and .jpg formats.

Attribution

This repository does not claim ownership over any intellectual property related to StyleGAN3. It's a modified version of the calc_metrics.py script from the original StyleGAN3 implementation. The intent is to adapt it for broader use, allowing for evaluations across various image generators by simply generating and saving images to a directory.

About

Evaluation toolkit for image generators using StyleGAN3 recommended metrics, including FID, KID, IS, Precision, and Recall

Resources

Stars

Watchers

Forks

Packages

No packages published