测试数据集的Tensorflow对象检测模型评估

问题描述 投票:1回答:1

我已经调整了Model Zoo上可用的faster_rcnn_resnet101模型来检测我的自定义对象。我将数据拆分为train和eval set,我在训练时在配置文件中使用它们。现在训练完成后,我想在一个看不见的数据上测试我的模型(我称之为测试数据)。我使用了几个函数,但无法确定使用tensorflow的API来评估测试数据集的性能。以下是我尝试过的事情:

  1. 我使用了object_detection / metrics / offline_eval_map_corloc.py函数来获取对测试数据集的评估。代码运行正常但我负值或AR和AP适用于大中型边界框。

平均精度(AP)@ [IoU = 0.50:0.95 | area = all | maxDets = 100] = 0.459

平均精度(AP)@ [IoU = 0.50 | area = all | maxDets = 100] = 0.601

平均精度(AP)@ [IoU = 0.75 | area = all | maxDets = 100] = 0.543

平均精度(AP)@ [IoU = 0.50:0.95 | area = small | maxDets = 100] = 0.459

平均精度(AP)@ [IoU = 0.50:0.95 | area = medium | maxDets = 100] = -1.000

平均精度(AP)@ [IoU = 0.50:0.95 | area = large | maxDets = 100] = -1.000

平均召回(AR)@ [IoU = 0.50:0.95 | area = all | maxDets = 1] = 0.543

平均召回(AR)@ [IoU = 0.50:0.95 | area = all | maxDets = 10] = 0.627

平均召回(AR)@ [IoU = 0.50:0.95 | area = all | maxDets = 100] = 0.628

平均召回(AR)@ [IoU = 0.50:0.95 | area = small | maxDets = 100] = 0.628

平均召回(AR)@ [IoU = 0.50:0.95 | area = medium | maxDets = 100] = -1.000

平均召回(AR)@ [IoU = 0.50:0.95 | area = large | maxDets = 100] = -1.000

现在,我知道mAP和AR不能是负面的,而且有些不对劲。我想知道为什么在测试数据集上运行离线评估时会看到负值?

我用来运行此管道的查询是:SPLIT = test

echo "
label_map_path: '/training_demo/annotations/label_map.pbtxt'
tf_record_input_reader: { input_path: '/training_demo/Predictions/test.record' }
" > /training_demo/${SPLIT}_eval_metrics/${SPLIT}_input_config.pbtxt

echo "
metrics_set: 'coco_detection_metrics'
" > /training_demo/${SPLIT}_eval_metrics/${SPLIT}_eval_config.pbtxt 

python object_detection/metrics/offline_eval_map_corloc.py \
  --eval_dir='/training_demo/test_eval_metrics' \
  --eval_config_path='training_demo/test_eval_metrics/test_eval_config.pbtxt' \
  --input_config_path='/training_demo/test_eval_metrics/test_input_config.pbtxt'
  1. 我也尝试了object_detection / legacy / eval.py,但我得到评估指标的值为负数:

DetectionBoxes_Recall / AR @ 100(中): - 1.0 DetectionBoxes_Recall / AR @ 100(小): - 1.0 DetectionBoxes_Precision / mAP @ .50IOU:-1.0 DetectionBoxes_Precision / mAP(medium): - 1.0等

我使用了管道,python eval.py \ --logtostderr \ --checkpoint_dir = trained-inference-graphs / output_inference_graph / \ --eval_dir = test_eval_metrics \ --pipeline_config_path = training / faster_rcnn_resnet101_coco-Copy1.config

在fast_rcnn_resnet101_coco-Copy1.config中的eval_input_reader指向测试TFRecord的地面实况和检测信息。

  1. 我也尝试了object_detection / utils / object_detection_evaluation来获得评估。这与使用第一种方法没什么不同,因为它没有相同的基本函数 - evaluateator.evaluate()

我将不胜感激任何帮助。

python tensorflow object-detection object-detection-api
1个回答
0
投票

评估指标采用COCO格式,因此您可以参考COCO API了解这些值的含义。

如coco api code中所述,如果该类别不存在,-1是默认值。在您的情况下,检测到的所有对象仅属于“小”区域。 “小”,“中”和“大”的区域类别也取决于区域采用的像素here

© www.soinside.com 2019 - 2024. All rights reserved.