3

我成功地在我自己的数据集上训练了一个模型,导出了推理图并对我的测试数据集进行了推理。

我现在有

  • 检测作为 tfrecord 文件,在输入配置中指定
  • 具有指定指标集的 eval_config 文件

当我尝试计算新的对象检测器推断和评估度量计算教程中的度量时

python object_detection/metrics/offline_eval_map_corloc.py --eval_dir=/media/sf_shared --eval_config_path=/media/sf_shared/eval_config.pbtxt --input_config_path=/media/sf_shared/input_config.pbtxt

它返回此 AttributeError:

INFO:tensorflow:Processing file: /media/sf_shared/detections.record
INFO:tensorflow:Processed 0 images...
Traceback (most recent call last):
 File "object_detection/metrics/offline_eval_map_corloc.py", line 173, in <module>
     tf.app.run(main)
 File "/home/chrza/anaconda2/envs/tf27/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
     _sys.exit(main(_sys.argv[:1] + flags_passthrough))
 File "object_detection/metrics/offline_eval_map_corloc.py", line 166, in main
      metrics = read_data_and_evaluate(input_config, eval_config)
 File "object_detection/metrics/offline_eval_map_corloc.py", line 124, in read_data_and_evaluate
     decoded_dict)
 File "/home/chrza/anaconda2/envs/tf27/lib/python2.7/site-packages/tensorflow/models/research/object_detection/utils/object_detection_evaluation.py", line 174, in add_single_ground_truth_image_info
    (groundtruth_dict[standard_fields.InputDataFields.groundtruth_difficult]
AttributeError: 'NoneType' object has no attribute 'size'

有什么提示吗?

4

1 回答 1

1

我将它(暂时)修复如下:

if (standard_fields.InputDataFields.groundtruth_difficult in groundtruth_dict.keys()) and groundtruth_dict[standard_fields.InputDataFields.groundtruth_difficult]: if groundtruth_dict[standard_fields.InputDataFields.groundtruth_difficult].size or not groundtruth_classes.size: groundtruth_difficult = groundtruth_dict[standard_fields.InputDataFields.groundtruth_difficult]

代替现有线路 (195-198)

object_detection/metrutils/object_detection_evaluation.py

该错误是由于以下事实引起的,即使在没有通过难度标志的情况下,也会检查对象的大小。

如果您在 tf 记录中跳过该参数,则会出现错误。

也许这是开发人员的意图,但文档的清晰度肯定还有很多不足之处。

于 2018-05-24T11:10:52.120 回答