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

Function plot_predictions

VAE_AutoEncoder/utils.py:76–89  ·  view source on GitHub ↗

:param y_true: 真实的图像 :param y_pred: 网络输出的图像 :return:

(y_true,y_pred,step,epoch)

Source from the content-addressed store, hash-verified

74 print("\n================================>Saving images...")
75
76def plot_predictions(y_true,y_pred,step,epoch):
77 """
78 :param y_true: 真实的图像
79 :param y_pred: 网络输出的图像
80 :return:
81 """
82 f,ax = plt.subplots(nrows=2,ncols=10,sharex=True,sharey=True)
83 for i in range(10):
84 ax[0][i].imshow(np.reshape(y_true[i],(28,28)),aspect='auto')
85 ax[1][i].imshow(np.reshape(y_pred[i].detach().cpu().numpy(),(28,28)),aspect='auto')
86 #tight_layout会自动调整子图参数,使之填充整个图像区域。
87 # 这是个实验特性,可能在一些情况下不工作。它仅仅检查坐标轴标签、刻度标签以及标题的部分。
88 plt.tight_layout()
89 plt.savefig(os.path.join(config.SAVE_IMAGES,str(epoch)+"_"+str(step)+'.png'))
90
91def samples(args):
92 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected