1.使用tensorboard可视化ACC,loss等曲线

 keras.callbacks.TensorBoard(log_dir='./Graph',
histogram_freq= 0 ,
write_graph=True,
write_images=True)
tbCallBack = keras.callbacks.TensorBoard(log_dir='./Graph',
histogram_freq= 0,
write_graph=True,
write_images=True)


model.compile(optimizer=optim,
loss=MultiboxLoss(NUM_CLASSES, neg_pos_ratio=2.0).compute_loss, metrics=['accuracy'])
nb_epoch = 30
history = model.fit_generator(gen.generate(True), gen.train_batches,
nb_epoch, verbose=1,
callbacks=[tbCallBack],
validation_data=gen.generate(False),
nb_val_samples=gen.val_batches,
nb_worker=1)

然后新开一个终端 
输入:

tensorboard --logdir path_to_current_dir/Graph 

之后打开终端给出的网址即可。

2.直接使用matplotlib画出训练LOSS与ACC曲线

第一步:

 # define the function
def training_vis(hist):
loss = hist.history['loss']
val_loss = hist.history['val_loss']
acc = hist.history['acc']
val_acc = hist.history['val_acc'] # make a figure
fig = plt.figure(figsize=(8,4))
# subplot loss
ax1 = fig.add_subplot(121)
ax1.plot(loss,label='train_loss')
ax1.plot(val_loss,label='val_loss')
ax1.set_xlabel('Epochs')
ax1.set_ylabel('Loss')
ax1.set_title('Loss on Training and Validation Data')
ax1.legend()
# subplot acc
ax2 = fig.add_subplot(122)
ax2.plot(acc,label='train_acc')
ax2.plot(val_acc,label='val_acc')
ax2.set_xlabel('Epochs')
ax2.set_ylabel('Accuracy')
ax2.set_title('Accuracy on Training and Validation Data')
ax2.legend()
plt.tight_layout()

第二步:

 # train the model
hist = model.fit(...)

第三步:

 # call the function
training_vis(hist)

最新文章

  1. 编写高质量代码:改善Java程序的151个建议(第8章:异常___建议114~117)
  2. ViewBag 找不到编译动态表达式所需的一种或多种类型,是否缺少引用?
  3. elasticsearch rpm 安装
  4. 关于 MAXScript 拷贝文件夹及内容到其他位置
  5. LGLProgressHUD
  6. Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError
  7. Objective-C:Foundation框架-常用类-NSArray
  8. 简单说说PHP优化那些事
  9. SEO名词_黒帽SEO
  10. tp框架基础知识
  11. 使用Python下载工具you-get下载媒体文件
  12. transform:translate(-50%,-50%)实现水平垂直居中
  13. vue案例todolist备忘录
  14. 一脸懵逼学习Hive的使用以及常用语法(Hive语法即Hql语法)
  15. DMA(直接存储器存取)
  16. 自己写一个java的mvc框架吧(三)
  17. Mongodb数据结构及与MySql对比
  18. winform命名规范
  19. Mysql和sqlite数据库操作心得
  20. 第9天:原型、继承、函数使用推荐以及this的指向

热门文章

  1. 1097G Vladislav and a Great Legend
  2. 冲刺NOIP2015提高组复赛模拟试题(五)2.道路修建
  3. Red Hat 6.5 Samba服务器的搭建(匿名访问,免登录)
  4. System.Reflection.Emit摘记
  5. mongodb 更新操作
  6. 网页渗透-wpscan
  7. RollingFileAppender
  8. opencv常用函数备忘
  9. C# 生成dll文件 并导入使用
  10. jmeter 读取多个用户名并同时发