我正在阅读有关 pytorch 的本教程。https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html 我已经能够在我生成的假图像旁边显示真实图像。
# Grab a batch of real images from the dataloader
real_batch = next(iter(dataloader))
# Plot the real images
plt.figure(figsize=(15,15))
plt.subplot(1,2,1)
plt.axis("off")
plt.title("Real Images")
plt.imshow(np.transpose(vutils.make_grid(real_batch[0].to(device)[:64], padding=5, normalize=True).cpu(),(1,2,0)))
# Plot the fake images from the last epoch
plt.subplot(1,2,2)
plt.axis("off")
plt.title("Fake Images")
plt.imshow(np.transpose(img_list[-1],(1,2,0)))
plt.show()
我想知道如何从生成的假图像中显示一张图像。如果可能,我还想将其显示为 512 X 512 图像。
编辑: img_list[-1].shape 是 torch.Size([3, 530, 530])。
这部分训练表明 img_list 是一个图像列表,每个图像是一组子图像(无法将它们分开)。有没有办法可以编辑它以使 img_list 成为每个生成的假图像的图像?