嗨,我想画出像训练损失这样的评估损失: image ,而不仅仅是tensorflow教程之类的点,我是怎么做的,这是我的代码,使用此代码,我只会得到一个点,表示评估损失:
accuracy=tf.metrics.accuracy(labels=labels, predictions=predictions["classes"])
metrics = {"accuracy": accuracy}
tf.summary.scalar("accuracy", accuracy[1])
#Configure of the training operation
if mode==tf.estimator.ModeKeys.TRAIN:
optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.001)
train_op=optimizer.minimize(loss=loss,global_step=tf.train.get_global_step())
return tf.estimator.EstimatorSpec(mode=mode,loss=loss,train_op=train_op)
#Configure the evaluation operation
if mode == tf.estimator.ModeKeys.EVAL:
return tf.estimator.EstimatorSpec(mode=mode, loss=loss, eval_metric_ops=metrics)
当我在指标中输入“ loss”:损耗时,我会出现错误,该怎么办?
答案 0 :(得分:0)
您必须指定要使用的损失类型:
查看文档:{{3}}
例如:loss='mean_squared_error'