lucidrains / stylegan2-pytorch

Simplest working implementation of Stylegan2, state of the art generative adversarial network, in Pytorch. Enabling everyone to experience disentanglement
https://thispersondoesnotexist.com
MIT License
3.69k stars 585 forks source link

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

Open GetsEclectic opened 4 years ago

GetsEclectic commented 4 years ago

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.

lucidrains commented 4 years ago

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

lucidrains commented 4 years ago

@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

GetsEclectic commented 4 years ago

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

lucidrains commented 4 years ago

@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 :)

GetsEclectic commented 4 years ago

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

GetsEclectic commented 4 years ago

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

lucidrains commented 4 years ago

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

GetsEclectic commented 4 years ago

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

GetsEclectic commented 4 years ago

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

GetsEclectic commented 4 years ago

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

GetsEclectic commented 4 years ago

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

GetsEclectic commented 4 years ago

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

KomputerMaster64 commented 1 year ago

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