Skip to content

Commit 138ec08

Browse files
yan-wudiegolascasas
authored andcommitted
Fix bug in evaluating FID and IS scores.
PiperOrigin-RevId: 340464023
1 parent 56ecc38 commit 138ec08

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cs_gan/image_metrics.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def get_image_metrics_for_samples(
2828
def sample_fn(arg):
2929
del arg
3030
samples = generator(prior.sample(max_classifier_batch))
31-
# Ensure data is in [0, 1], as expected by TFGAN.
31+
# Samples must be in [-1, 1], as expected by TFGAN.
3232
# Resizing to appropriate size is done by TFGAN.
33-
return data_processor.postprocess(samples)
33+
return samples
3434

3535
fake_outputs = tfgan.eval.sample_and_run_inception(
3636
sample_fn,
@@ -39,7 +39,8 @@ def sample_fn(arg):
3939
fake_logits = fake_outputs['logits']
4040
inception_score = tfgan.eval.classifier_score_from_logits(fake_logits)
4141

42-
real_outputs = tfgan.eval.run_inception(real_images, num_batches=num_batches)
42+
real_outputs = tfgan.eval.run_inception(
43+
data_processor.preprocess(real_images), num_batches=num_batches)
4344
fid = tfgan.eval.frechet_classifier_distance_from_activations(
4445
real_outputs['pool_3'], fake_outputs['pool_3'])
4546

0 commit comments

Comments
 (0)