Chris H
Chris H

Reputation: 31

TF object detection API - Compute evaluation measures failed

I successfully trained a model on my own dataset, exported the inference graph and did the inference on my test dataset.

I now have

When I try to compute the measures like in the new object detector inference and evaluation measure computation tutorial with

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

It returns this 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'

Any hints?

Upvotes: 3

Views: 961

Answers (1)

Varun
Varun

Reputation: 111

I fixed it (temporarily) as follows:

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]

In place of the existing lines (195-198) in

object_detection/metrutils/object_detection_evaluation.py

The error is caused due to the fact that, even in the case there is no difficulty flag passed, the size of the object is being checked for.

This is an error if you skipped that parameter in your tf records.

Perhaps this was the intent of the developers, but the clarity of documentation certainly leaves a lot to be desired for.

Upvotes: 1

Related Questions