Git Product home page Git Product logo

gan_metrics's Introduction

GAN Metrics

Inception Score

Run python inception_score.py --dataroot "path/to/image/folder" to calculate IS

Because I use Pytorch ImageFolder class from torchvision.datasets, path/to/image/folder should contain folder of images. Please refer to the documentation for more detail.

path
└── to
    └── image
         └── folder
                └── class0
                        ├── 0.jpg
                        └── 1.jpg
                └── class1
                        ├── 0.jpg
                        └── 1.jpg

IS code is derived from sbarratt

Fréchet Inception Distance

Run python fid_score.py path/to/image/folder1 path/to/image/folder2 --gpu 0 to calculate FID. The folder1 and folder2 should contain images.

path
└── to
    └── image
         └── folder
                ├── 0.jpg
                └── 1.jpg

Option to calculate FID on multiple generated image folders. python fid_score.py path/to/image/folder path/to/generated/folder --gpu 0 --multiple_gen_dir. This command will output a summary file called fid.csv. Run this command to find the best FID epoch.

path
└── to
    └── generated
         └── folder
                └── epoch0
                        ├── 0.jpg
                        └── 1.jpg
                └── epoch1
                        ├── 0.jpg
                        └── 1.jpg

FID code is derived from mseitzer

gan_metrics's People

Contributors

kvpratama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gan_metrics's Issues

About running scripts & folder structure

Hello Mr. @kvpratama,

Thank you for your nice work and for making it open-source.
Could you guide me on which kind of changes I am supposed to do if my folder structure is like this:

real/
        class0/
                   234.png
                   001.png
                   etc. 
        class1/
                   532.png

The generated folder image structure is the same.

Currently, I'm facing with this issue:

File "fid_score.py", line 231, in <module>
    fid_value = calculate_fid_given_paths(args.path, args.batch_size, args.gpu != '', args.dims)
  File "fid_score.py", line 179, in calculate_fid_given_paths
    m1, s1 = _compute_statistics_of_path(paths[0], model, batch_size, dims, cuda)
  File "fid_score.py", line 163, in _compute_statistics_of_path
    m, s = calculate_activation_statistics(files, model, batch_size, dims, cuda)
  File "fid_score.py", line 149, in calculate_activation_statistics
    act = get_activations(files, model, batch_size, dims, cuda)
  File "fid_score.py", line 54, in get_activations
    for i in tqdm(range(0, len(files), batch_size)):
ValueError: range() arg 3 must not be zero

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.