使用Keras和fit_generator的TensorBoard分布和直方图 [英] TensorBoard Distributions and Histograms with Keras and fit_generator

查看:496
本文介绍了使用Keras和fit_generator的TensorBoard分布和直方图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Keras通过fit_generator函数训练CNN.

I'm using Keras to train a CNN using the fit_generator function.

TensorBoard似乎没有显示直方图和分布图,这似乎是一个已知问题在此设置中.

It seems to be a known issue that TensorBoard doesn't show histograms and distributions in this setup.

有人能找到一种使它正常工作的方法吗?

Did anybody figure out a way to make it work anyway?

推荐答案

没有简单的方法可以将其插入一行代码,而必须手动编写摘要.

There is no easy way to just plug it in with one line of code, you have to write your summaries by hand.

好消息是,这并不难,您可以使用版本2 准备.

Good news is that it's not difficult and you can use the TensorBoard callback code in Keras as a reference. (There is also a version 2 in preparation.)

基本上,编写一个函数,例如write_summaries(model)并在需要编写摘要时调用它(例如,紧随fit_generator()之后)

Basically, write a function e.g. write_summaries(model) and call it whenever you want to write your summaries (e.g. just after your fit_generator())

write_summaries(model)函数内部使用tf.summaryhistogram_summary和其他摘要函数记录要在张量板上看到的数据.

Inside your write_summaries(model) function use tf.summary, histogram_summary and other summary functions to log data you want to see on tensorboard.

如果您不知道确切的方法,请查看官方教程: 以及带有摘要的MNIST的绝佳示例.

If you don't know exactly how, check official tutorial: and this great example of MNIST with summaries.

这篇关于使用Keras和fit_generator的TensorBoard分布和直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆