Last active
June 1, 2020 09:59
-
-
Save udithhaputhanthri/0e5267bd3412b72b6f48a623417eced1 to your computer and use it in GitHub Desktop.
Image-to-Image Translation Using Conditional DCGANs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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