Error while run eval.py
I'm using tensorflow 1.5 installed from binary on windows 10 on CPU.
I've retrained ssd_mobilenet_v1_coco on my dataset with one class with id 1. When I tried run eval after training I got ValueError: not enough values to unpack (expected 2, got 0) in eval_util.py in result_dict, result_losses_dict = batch_processor(tensor_dict, sess, batch, counters, losses_dict=losses_dict) and warning The following classes have no ground truth examples: 1, but ground truth examples should be in evaluation dataset.
C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research>python object_detection/eval.py --logtostderr --checkpoint_dir=E:/tensorflow/models/train/ --pipeline_config_path=E:/tensorflow/models/model/ssd_mobilenet_v1_coco.config --eval_dir=E:/tensorflow/models/eval/
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:Restoring parameters from E:/tensorflow/models/train/model.ckpt-73
INFO:tensorflow:Restoring parameters from E:/tensorflow/models/train/model.ckpt-73
WARNING:root:The following classes have no ground truth examples: 1
C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research\object_detection\utils\metrics.py:144: RuntimeWarning: invalid value encountered in true_divide
num_images_correctly_detected_per_class / num_gt_imgs_per_class)
C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research\object_detection\utils\object_detection_evaluation.py:710: RuntimeWarning: Mean of empty slice
mean_ap = np.nanmean(self.average_precision_per_class)
C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research\object_detection\utils\object_detection_evaluation.py:711: RuntimeWarning: Mean of empty slice
mean_corloc = np.nanmean(self.corloc_per_class)
Traceback (most recent call last):
File "object_detection/eval.py", line 135, in <module>
tf.app.run()
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
_sys.exit(main(argv))
File "object_detection/eval.py", line 131, in main
FLAGS.checkpoint_dir, FLAGS.eval_dir)
File "C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research\object_detection\evaluator.py", line 259, in evaluate
losses_dict=losses_dict)
File "C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research\object_detection\eval_util.py", line 423, in repeated_checkpoint_run
losses_dict=losses_dict)
File "C:\Program Files\Python36\Lib\site-packages\tensorflow\models-master\research\object_detection\eval_util.py", line 294, in _run_checkpoint_once
tensor_dict, sess, batch, counters, losses_dict=losses_dict)
ValueError: not enough values to unpack (expected 2, got 0)
Here part of my config file:
eval_config: {
num_examples: 1151
max_evals: 1
}
eval_input_reader: {
tf_record_input_reader {
input_path: "E:/tensorflow/data/test.record"
}
label_map_path: "E:/tensorflow/data/label_map.pbtxt"
shuffle: false
num_readers: 1
}
Could anybody get me some suggest how I can fix it? Thanks!
It sounds like the data and label map may be causing a parsing issue. Can you provide the label_map and input file you are using? (If not the whole input file, at least a section that includes some of the "ground truth" examples.)
My label map:
item {
id: 1
name: 'Door'
}
I'm using TFRecord format for imput data.
I created this file using create_data.py from text file that have format:
path_to_image width height xmin1 xmax1 ymin1 ymax2 ... xminN xmaxN yminN ymaxN
for example:
train\img1.jpg 500.00 200.00 20.00 50.00 31.00 63.00
leftTrain\img1.jpg 500.00 145.00 12.00 34.00 31.00 63.00 66.00 91.00 10.00 32.00
@pkulzc - not sure if Mobilenet supports single-labels currently? Assigning to you as code owner.
The warning "WARNING:root:The following classes have no ground truth examples: 1" is saying that no ground truth boxes for class 1 was read. You probably want to use tf.logging.info to print out the content of result_dict here. @UserLiubov did you sync your fork after the model is trained? if so, when did you train and when did you sync?
No, I didn't sync, what is it for? Can you explain or give documentation how to use tf.logging.info, please? I looked at https://www.tensorflow.org/versions/r1.0/get_started/monitors and add tf.logging.set_verbosity(tf.logging.INFO) to the beggining of eval_util.py but nothing changed.
What I'm suggesting is to use something like "tf.logging.info(results-dict.keys()) " after this line to see what has been read from GT.
Thank you! It help me!
@UserLiubov I met the same issue. How did you solve? WARNING:root:The following classes have no ground truth examples: [1 2 3 4 ...20] I trained voc2012 with ‘faster_rcnn_resnet50’.
@xinyuabcd After using tf.logging.info(results-dict.keys()) as said pkulzc it showed me that in my training data there are coordinates greater than 1, I just changed all coordinates > 1 to = 1.
When add tf.logging.info(results-dict.keys()),it shows that:
INFO:tensorflow:dict_keys(['original_image', 'key', 'detection_boxes', 'detection_classes', 'detection_scores', 'groundtruth_boxes', 'groundtruth_classes', 'groundtruth_area', 'groundtruth_is_crowd', 'groundtruth_difficult', 'groundtruth_group_of']) INFO:tensorflow:dict_keys(['original_image', 'key', 'detection_boxes', 'detection_classes', 'detection_scores', 'groundtruth_boxes', 'groundtruth_classes', 'groundtruth_area', 'groundtruth_is_crowd', 'groundtruth_difficult', 'groundtruth_group_of']) INFO:tensorflow:dict_keys(['original_image', 'key', 'detection_boxes', 'detection_classes', 'detection_scores', 'groundtruth_boxes', 'groundtruth_classes', 'groundtruth_area', 'groundtruth_is_crowd', 'groundtruth_difficult', 'groundtruth_group_of'])
What the logs mean?
@UserLiubov Got the same issue again.
INFO:tensorflow:Restoring parameters from train_ckpt_1\model.ckpt-31688 INFO:tensorflow:Restoring parameters from train_ckpt_1\model.ckpt-31688 WARNING:root:The following classes have no ground truth examples: 1 C:\ProgramData\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\metrics.py:142: RuntimeWarning: invalid value encountered in true_divide num_images_correctly_detected_per_class / num_gt_imgs_per_class) C:\ProgramData\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\object_detection_evaluation.py:859: RuntimeWarning: Mean of empty slice mean_ap = np.nanmean(self.average_precision_per_class) C:\ProgramData\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\object_detection_evaluation.py:860: RuntimeWarning: Mean of empty slice mean_corloc = np.nanmean(self.corloc_per_class)
TENSORBOARD SCREENSHOT: 
We used tf.logging.info(results-dict.keys()) after the line as mentioned by @pkulzc. How did you get to know that the coordinates were greater than 1.
@tlokeshkumar I saw at cmd that the coordinates were grater than 1. May be your problem in training? Can you get information about training?
@UserLiubov Hi, I met the same error, can you please tell me the detail of your solution? Thanks a lot!