stylegan2-pytorch icon indicating copy to clipboard operation
stylegan2-pytorch copied to clipboard

is there an easy way to generate 50k images for FID calculation? happy to add something if not

Open GetsEclectic opened this issue 4 years ago • 13 comments

I looked around the code a bit and didn't see an easy way to generate a large number of images to do a FID calculation. I'm thinking something like: stylegan2-pytorch --generate 50000 --results_dir /output/path/for/imgs

Am I missing anything? Happy to create a PR if this sounds like a useful feature.

I think it would actually be really handy to have a command to just calculate a FID score? Something like:

stylegan2-pytorch --data /path/to/data --calculate_fid 50000

Which would generate 50k images and then calculate a FID score between the images in /path/to/data and the new images. Would be happy to work on this also if you would consider merging it.

GetsEclectic avatar Jul 26 '20 15:07 GetsEclectic

@GetsEclectic that would be super useful! would happily accept a PR :)

lucidrains avatar Jul 26 '20 16:07 lucidrains

@GetsEclectic I've seen a couple Pytorch libraries that do FID and Inception score calculations, would be ok with merging any of them that is reasonable and bug free

lucidrains avatar Jul 26 '20 16:07 lucidrains

I've been using this one for a while and am happy with it so far: https://github.com/mseitzer/pytorch-fid

GetsEclectic avatar Jul 26 '20 16:07 GetsEclectic

@GetsEclectic sounds good! I'm beginning work on https://github.com/lucidrains/unet-stylegan2 but will circle around to this if you don't get to it first :)

lucidrains avatar Jul 26 '20 17:07 lucidrains

Just pushed up a WIP branch https://github.com/lucidrains/stylegan2-pytorch/pull/97

GetsEclectic avatar Jul 26 '20 17:07 GetsEclectic

https://github.com/mseitzer/pytorch-fid is not set up as a Distutils package so i'm not sure what the best way to include it would be? I've just been cloning the repo and running it on the command line

GetsEclectic avatar Jul 26 '20 18:07 GetsEclectic

@GetsEclectic ohh yea, that will be problematic, is there not a variant that is a pip installable package?

lucidrains avatar Jul 27 '20 16:07 lucidrains

This is the only one I've found that is supposed to produce the same results as the TF implementation.

GetsEclectic avatar Jul 27 '20 17:07 GetsEclectic

I'll see if I can submit a PR to make it a Distutils package.

GetsEclectic avatar Jul 27 '20 17:07 GetsEclectic

https://github.com/mseitzer/pytorch-fid/pull/37

GetsEclectic avatar Aug 01 '20 17:08 GetsEclectic

This is almost ready, just waiting for Max to upload pytorch-fid to pypi.

GetsEclectic avatar Aug 12 '20 20:08 GetsEclectic

PR is in pretty good shape: https://github.com/lucidrains/stylegan2-pytorch/pull/113

GetsEclectic avatar Aug 16 '20 22:08 GetsEclectic

I've been using this one for a while and am happy with it so far: https://github.com/mseitzer/pytorch-fid

Thank you for the response. I did some experiments with an augmented version of WGAN-GP, I found that the FID score is sensitive towards the number of images used. Scores increase for the number of images. I requets you to guide me in this regards. Regards Prabhav

KomputerMaster64 avatar Nov 25 '22 06:11 KomputerMaster64