import matplotlib.pyplot as plt x = list(range(1, 100)) # epoch array loss = [10 / (i**2) for i in x] # loss values array plt.ion() for i in range(1, len(x)): ix = x[:i] iy = loss[:i] plt.title("loss") plt.plot(ix, iy) plt.xlabel("epoch") plt.ylabel("loss") # plt.xlim(0,len(x)) #固定x軸 if i == 1: plt.pause(1) # 啟動時間,方便截屏 plt.pause(0.5) plt.ioff() plt.show()
在keras訓練模型時,model.fit返回得有訓練評價信息,可以依此動態可視化。
可參考keras中的History對象 。
以及讀取tensorboard日志數據。