【发布时间】:2020-01-25 20:38:09
【问题描述】:
我在 keras 中有一个模型,我将自定义指标用作:
class MyMetrics(keras.callbacks.Callback):
def __init__(self):
initial_value = 0
def on_train_begin(self, logs={}):
...
def on_epoch_end(self, batch, logs={}):
here I calculate my important values
现在,有一种方法可以在 Tensorboard 中可视化它们吗? 例如,如果我的指标是这样的:
def mymetric(y_true,y_pred):
return myImportantValues
我可以在 Tensorboard 中通过
mymodel.compile(..., metrics = mymetric)
指标回调有类似的东西吗?
我尝试在 MyMetric 类中创建一个函数并将其传递给mymodel.compile,但它不会更新值。
【问题讨论】:
-
您可以继承
Tensorboard类并使用它的writer来编写您需要的内容,而不是继承基类Callback。
标签: keras tensorboard