tensorflow / tensorflow/models

How to save intermediate tensors that are used during the application lifecycle

Open
#8,209 1 comment 0 reactions 1 assignee View on GitHub

@jch1 is already working on this.

Since May 15, 2020.

models:research:odapi type:support
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Basically, I am running the evaluation script using:

python3 object_detection/legacy/eval.py \
    --pipeline_config_path=../../faster_rcnn_resnet101_voc12.pbtxt\
    --checkpoint_dir=../../trainedmodel_voc07 \
    --eval_dir=../../eval_results \
    --run_once=True \
    --alsologtostderr

Now, this script outputs the bounding boxes on image along with prediction scores. But what I need is, the metrics calculated.

When I looked into the eval.py, I found that, it returns nothing. It run the evaluation, calculates the metrics but doesn't return it. So, I just changed the code to return the metrics and print it on console.

metrics = evaluator.evaluate(
        create_input_dict_fn,
        model_fn,
        eval_config,
        categories,
        FLAGS.checkpoint_dir,
        FLAGS.eval_dir,
        graph_hook_fn=graph_rewriter_fn,
    )
print(metrics)

But, as we know, this won't print the values inside the metric. I have tried several things like metrics.numpy() which won't work when eager execution is turned off. I have also tried using metrics.eval() by creating a session but this just hangs up the PC and does nothing.

Also, tf.print() won't work as it runs in graph mode.

Then I found that TF stores summaries of metrics and we can visualize it using tensorboard. That's okay.. but what I wanted to extract values from other tensors?

So, basically, how can I access the intermediate tensors in the script?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.