def validation_step(self, batch, batch_idx): input_photo = batch log_images( self, { 'input/real': input_photo, 'generate/anime': self.generator(input_photo) })
def validation_step(self, batch: Tuple[torch.Tensor, torch.Tensor], batch_idx): input_photo = torch.cat(batch) generator_img = self.generator(input_photo) log_images(self, { 'input/real': input_photo, 'generate/anime': generator_img, }, 8)
def validation_step(self, batch, batch_idx): input_photo, input_cartoon = batch d = {} d['input/real'] = input_photo d['input/cartoon'] = input_cartoon for i, idx in enumerate(self.hparams.layer_indexs): d[f'gen/{self.vgg_names[idx-1]}_real'] = self.real_generators[i](input_photo) d[f'gen/{self.vgg_names[idx-1]}_cartoon'] = self.real_generators[i](input_cartoon) log_images(self, d)
def validation_step(self, batch: Tuple[torch.Tensor, torch.Tensor], batch_idx): input_photo = torch.cat(batch) generator_img = self.generator(input_photo) output = self.guided_filter(input_photo, generator_img, r=1) blur_fake = self.guided_filter(output, output, r=5, eps=2e-1) gray_fake, = self.colorshift(output) input_superpixel = torch.from_numpy( simple_superpixel(output.detach().permute((0, 2, 3, 1)).cpu().numpy(), self.superpixel_fn) ).to(self.device).permute((0, 3, 1, 2)) log_images(self, { 'input/real': input_photo, 'input/superpix': input_superpixel, 'generate/anime': generator_img, 'generate/filtered': output, 'generate/gray': gray_fake, 'generate/blur': blur_fake, }, num=8)
def validation_step(self, batch, batch_idx): real_A, real_B = batch fake_A2B, _, fake_A2B_heatmap = self.genA2B(real_A) # fake_A2B2A, _, fake_A2B2A_heatmap = self.genB2A(fake_A2B) # fake_A2A, _, fake_A2A_heatmap = self.genB2A(real_A) log_images(self, {'gen/A/fake_A2B': fake_A2B})