tensorflow / tensorflow/models

TypeError: int() argument must be a string, a bytes-like object or a number, not 'Tensor'

Open
#8,608 6 comments 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Jun 2, 2020.

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

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • [#] I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • I checked to make sure that this issue has not already been filed.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/tree/master/research/...

2. Describe the bug

I have completed the object_detection_tutorial run on Colab and it worked well. But when I run locally,there is a TypeError:

in run_inference_for_single_image(model, image)
12 # Convert to numpy arrays, and take index [0] to remove the batch dimension.
13 # We're only interested in the first num_detections.
---> 14 num_detections = int(output_dict.pop('num_detections'))
15 output_dict = {key:value[0, :num_detections].numpy()
16 for key,value in output_dict.items()}

TypeError: int() argument must be a string, a bytes-like object or a number, not 'Tensor'

I noticed that someone said he solved the problem on TF2.0. But your installation instruction requires only TensorFlow 1.15. So what 's the problem?

3. Steps to reproduce

Steps to reproduce the behavior.

4. Expected behavior

A clear and concise description of what you expected to happen.

5. Additional context

Include any logs that would be helpful to diagnose the problem.

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Win7 X64
  • Mobile device name if the issue happens on a mobile device:
  • TensorFlow installed from (source or binary):binary
  • TensorFlow version (use command below):1.15.0
  • Python version:3.7
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

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.