从here
中的此示例进行了修改predictions = tf.argmax(logits, 1)
labels = tf.squeeze(labels)
names_to_values, names_to_updates = slim.metrics.aggregate_metric_map({
'Accuracy': slim.metrics.streaming_accuracy(predictions, labels),
'Precision': slim.metrics.streaming_precision(predictions, labels),
'Recall': slim.metrics.streaming_recall(predictions, labels),
'Recall_5': slim.metrics.streaming_recall_at_k(logits, labels, 5),
'Recall_3': slim.metrics.streaming_recall_at_k(logits, labels, 3),
'Recall_1': slim.metrics.streaming_recall_at_k(logits, labels, 1),
})
结果就像
2018-03-06 12:45:43.520961: I tensorflow/core/kernels/logging_ops.cc:79] eval/Recall_1[0.664843738]
2018-03-06 12:45:43.521368: I tensorflow/core/kernels/logging_ops.cc:79] eval/Recall[0.990521312]
2018-03-06 12:45:43.521429: I tensorflow/core/kernels/logging_ops.cc:79] eval/Recall_5[0.857031226]
2018-03-06 12:45:43.521487: I tensorflow/core/kernels/logging_ops.cc:79] eval/Precision[0.996820331]
2018-03-06 12:45:43.521537: I tensorflow/core/kernels/logging_ops.cc:79] eval/Accuracy[0.664843738]
2018-03-06 12:45:43.521584: I tensorflow/core/kernels/logging_ops.cc:79] eval/Recall_3[0.809375]
为什么streaming_recall和streaming_precision都是99%,而准确率和前1名召回率是66%。
严重的事情与recall and precision的已知含义不同 我们知道。为什么精确度与召回_1相同,为什么召回和召回_1不同?
问题是如何更新slim eval_image_classifier.py
以使其计算streaming_recall和streaming_precision以及非布尔值的f1得分?
答案 0 :(得分:2)
可能是因为预测被转换为布尔值,导致仅有True值的张量;然后召回是1.如果标签发生同样的事情,我可以理解精度是多少。