MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / generagedImage

Function generagedImage

GANCode/mainWindow.py:71–85  ·  view source on GitHub ↗

:param model: :return:

(model)

Source from the content-addressed store, hash-verified

69 return True
70
71def generagedImage(model):
72 """
73 :param model:
74 :return:
75 """
76 random_noise = torch.randn(size=(16, 100), device='cpu')
77 genImg = model(random_noise).detach().cpu().numpy()
78 genImg = np.squeeze(genImg)
79 fig = plt.figure(figsize=(4, 4))
80 for i in range(16):
81 plt.subplot(4, 4, i + 1)
82 # 由于生成器输出的结果为[-1,1]之间,所以需要转换为[0,1]之间
83 plt.imshow((genImg[i] + 1) / 2)
84 plt.axis('off')
85 plt.savefig('cur.png')
86
87def loadModel(model,root):
88 """

Callers 1

loadModelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected