sbarratt / inception-score-pytorch

Inception Score for GANs in Pytorch
MIT License
638 stars 125 forks source link

Inception score for conditional GANs #2

Closed mathfinder closed 6 years ago

mathfinder commented 6 years ago

IMO,there are tow ways to calculate Inception score of conditional GANs.

  1. For every "condition", calculate a IS and Average them.
  2. Sample "condition" from "real condition distribution" and generate fake data to calculate IS.

Which way is reasonable. thx.

sbarratt commented 6 years ago

I'd say either, depending on what fits your application the best.

Also, see http://arxiv.org/abs/1801.01973

mathfinder commented 6 years ago

thx, @sbarratt I've read your code and paper. There is a problem. I just run the code on CIFAR-10(splits:10), and get IS:6.1999668740385081/0.092341845425796432. But your paper report IS:9.737±0.148.

IMO, it is because code line 37: inception_model = inception_v3(pretrained=True, transform_input=True).type(dtype) sets transform_input=True. It's function is transforming mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225] to mean=[0.5, 0.5, 0.5] and std=[0.5, 0.5, 0.5].It is not correct, since line 84 has normalize numerical value to mean=0.5, std=0.5.

I set line 37 transform_input=False, and got IS: 9.3701126926910518/0.14960956431793704 closer to the paper.

sbarratt commented 6 years ago

You are correct, change reflected in https://github.com/sbarratt/inception-score-pytorch/commit/3bcf441c7a3229985e3e18c7c03ea3984ff74836.