0
点赞
收藏
分享

微信扫一扫

plt.ion动图使用,训练过程展示


代码如下:

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(10) # 启动时间,方便截屏
plt.pause(0.5)

plt.ioff()
plt.show()

在keras训练模型时,model.fit返回得有训练评价信息,可以依此动态可视化。
可参考​​​keras中的History对象​​​ 。
以及​​​读取tensorboard日志数据​​。

plt.ion动图使用,训练过程展示_启动时间


举报

相关推荐

0 条评论