Getting additional summaries about object_detection / eval.py (same as in train.py)
I am using the new tendorflow object discovery API on my own data. It works really well, but I'm a little disappointed that some of the statistics shown in Tensorboard only exist for the training set, not eval and vice versa. For example, I think it would be great to get global_step/sec
and losses during the evaluation as well as indicators Precision
and Performance
for the training phase (without evaluating it manually).
Is there an easy way to do this?
I'm practicing and testing scripts provided by the API with pretty standard config files with SSD and Faster-RCNN:
python tensorflow_models_dir/object_detection/train.py --logtostderr --pipeline_config_path=../models/SSD_v1/config_v1.config --train_dir=../models/SSD_v1/train
python tensorflow_models_dir/object_detection/eval.py --logtostderr --pipeline_config_path=../models/SSD_v1/config_v1.config --checkpoint_dir=../models/SSD_v1/train --eval_dir=../models/SSD_v1/eval
So far, I've tried to add a resume trainer.py
to tensor_dict
in evaluator.py
, but it failed at runtime. For this, I added the following lines to _extract_prediction_tensors
in evaluator.py
:
# Gather initial summaries.
summaries = set(tf.get_collection(tf.GraphKeys.SUMMARIES))
global_summaries = set([])
# Add summaries.
for model_var in slim.get_model_variables():
global_summaries.add(tf.summary.histogram(model_var.op.name, model_var))
for loss_tensor in tf.losses.get_losses():
global_summaries.add(tf.summary.scalar(loss_tensor.op.name, loss_tensor))
# global_summaries.add(
# tf.summary.scalar('TotalLoss', tf.losses.get_total_loss())) # Crashes
# Add the summaries from the first clone. These contain the summaries
# created by model_fn and either optimize_clones() or _gather_clone_loss().
summaries |= set(tf.get_collection(tf.GraphKeys.SUMMARIES))
summaries |= global_summaries
# Merge all summaries together.
summary_op = tf.summary.merge(list(summaries), name='summary_op')
tensor_dict['summary_op'] = summary_op
source to share
No one has answered this question yet
Check out similar questions: