Skip to content

Instantly share code, notes, and snippets.

@udithhaputhanthri
Last active June 1, 2020 09:59
Show Gist options
  • Save udithhaputhanthri/0e5267bd3412b72b6f48a623417eced1 to your computer and use it in GitHub Desktop.
Save udithhaputhanthri/0e5267bd3412b72b6f48a623417eced1 to your computer and use it in GitHub Desktop.
Image-to-Image Translation Using Conditional DCGANs
G=Generator()
filepath='gdrive/My Drive/pix2pixmodel/G_L1.pth'
G.load_state_dict(torch.load(filepath,map_location=torch.device('cpu')))
G.eval()
for x,y in dataloader:
z=torch.randn((batch_size,1,128,128)).to(device)
generated_imgs=G(x[:5],z[:5])
real_imgs=x[:5]
imgs=torch.cat([generated_imgs,real_imgs,y[:5]],0).data.cpu()
grid=make_grid(imgs,nrow=5).permute(1,2,0).numpy()
plt.imshow(grid)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment