Tensorboard-keras代码实现

概述

在keras中,是通过 TensorBoard 回调函数实现

官方网址

https://tensorflow.google.cn/guide/summaries_and_tensorboard

https://tensorflow.google.cn/tensorboard/get_started

Keras代码

1. 创建事件文件夹

import os,datetime
log_dir=os.path.join('预测身高_logs',datetime.datetime.now().strftime('%Y%m%d_%H%M%S'))

2. 定义TensorBoard回调函数

tb_cb=tf.keras.callbacks.TensorBoard(log_dir,histogram_freq=1)

如果histogram_freq设置成 0 ,TensorBoard的distributions和histograms仪表盘不显示。

3. 在fit()函数中指定回调函数

history=model.fit(x,y,epochs=500,callbacks=[tb_cb])

感谢

https://blog.csdn.net/u010099080/article/details/77426577


原文出处:/show_1EF4CyV17yOZ.html