Skip to content

Commit

Permalink
fixed small bugs in the mean_w calculation and image & shape generati…
Browse files Browse the repository at this point in the history
…on code
  • Loading branch information
royorel committed Mar 10, 2022
1 parent 1d2cf40 commit d4dd17d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion generate_shapes_and_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

def generate(opt, g_ema, surface_g_ema, device, mean_latent, surface_mean_latent):
g_ema.eval()
surface_g_ema.eval()
if not opt.no_surface_renderings:
surface_g_ema.eval()

# set camera angles
if opt.fixed_camera_angles:
Expand Down
9 changes: 5 additions & 4 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,14 @@ def make_noise(self):

def mean_latent(self, n_latent, device):
latent_in = torch.randn(n_latent, self.style_dim, device=device)
renderer_latent = self.style(latent_in).mean(0, keepdim=True)
renderer_latent = self.style(latent_in)
renderer_latent_mean = renderer_latent.mean(0, keepdim=True)
if self.full_pipeline:
decoder_latent = self.decoder.mean_latent(renderer_latent)
decoder_latent_mean = self.decoder.mean_latent(renderer_latent)
else:
decoder_latent = None
decoder_latent_mean = None

return [renderer_latent, decoder_latent]
return [renderer_latent_mean, decoder_latent_mean]

def get_latent(self, input):
return self.style(input)
Expand Down

0 comments on commit d4dd17d

Please sign in to comment.