Skip to content

Commit

Permalink
compute inception score in test steps
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidtronix committed Jan 20, 2025
1 parent 248487d commit 12ed639
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ml4h/models/diffusion_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def metrics(self):
m = [self.noise_loss_tracker, self.image_loss_tracker, self.mse_metric, self.mae_metric]
if self.tensor_map.axes() == 3 and self.inspect_model:
m.append(self.kid)
m.append(self.inception_score)
return m

def denormalize(self, images):
Expand Down Expand Up @@ -487,6 +488,7 @@ def test_step(self, images_original):
num_images=self.batch_size, diffusion_steps=20
)
self.kid.update_state(images, generated_images)
self.inception_score.update_state(images, generated_images)

return {m.name: m.result() for m in self.metrics}

Expand Down Expand Up @@ -676,6 +678,7 @@ def metrics(self):
m.append(self.supervised_loss_tracker)
if self.input_map.axes() == 3 and self.inspect_model:
m.append(self.kid)
m.append(self.inception_score)
return m

def denormalize(self, images):
Expand Down Expand Up @@ -883,6 +886,7 @@ def test_step(self, batch):
num_images=self.batch_size, diffusion_steps=20
)
self.kid.update_state(images, generated_images)
self.inception_score.update_state(images, generated_images)

return {m.name: m.result() for m in self.metrics}

Expand Down

0 comments on commit 12ed639

Please sign in to comment.