我正在使用TensorFlow-Slim,我在eval_image_classifier.py(位于/ models / slim /)中添加了一些代码行来计算TP,TN,FP和FN。但是,计算精度=(TP + TN)/(TP + FP + FN + TN)不等于slim.metrics.streaming_accuracy(预测,标签)给出的精度。
我已经改变了标准代码:
names_to_values, names_to_updates = slim.metrics.aggregate_metric_map({
'Accuracy': slim.metrics.streaming_accuracy(predictions, labels),
'Recall_5': slim.metrics.streaming_recall_at_k(
logits, labels, 5),
})
......对此:
names_to_values, names_to_updates = slim.metrics.aggregate_metric_map({
'Accuracy': slim.metrics.streaming_accuracy(predictions, labels),
'TruePositives': slim.metrics.streaming_true_positives(predictions, labels),
'TrueNegatives': slim.metrics.streaming_true_negatives(predictions, labels),
'FalsePositives': slim.metrics.streaming_false_positives(predictions, labels),
'FalseNegatives': slim.metrics.streaming_false_negatives(predictions, labels),
'Recall_5': slim.metrics.streaming_recall_at_k(
logits, labels, 5),
})
输出:
I tensorflow/core/kernels/logging_ops.cc:79] eval/TruePositives[322]
I tensorflow/core/kernels/logging_ops.cc:79] eval/TrueNegatives[72]
I tensorflow/core/kernels/logging_ops.cc:79] eval/FalsePositives[4]
I tensorflow/core/kernels/logging_ops.cc:79] eval/FalseNegatives[2]
I tensorflow/core/kernels/logging_ops.cc:79] eval/Accuracy[0.9525]
I tensorflow/core/kernels/logging_ops.cc:79] eval/Recall_5[1]
我测试了finetune_resnet_v1_50_on_flowers.sh脚本(位于/ models / slim / scripts中)而没有改变任何东西(克隆于12.04.2017)。
我无法找到我的错误。我很高兴收到你对这个问题的答案,意见或具体建议。
CUDA版本:8.0版,V8.0.53
从二进制测试版本安装的TensorFlow:1.0.1和1.1.0rc1
GPU:NVIDIA Tesla P100(SXM2)