Tensorflow对象检测:int()参数必须是字符串,类似字节的对象或数字,而不是“ Tensor”

时间:2020-07-20 19:32:20

标签: tensorflow object-detection-api

我正在尝试使用tensorflow 1.15跟踪边缘电子对象检测方法

首先,我收到这样的警告:-

检测 加载对象检测模型:

1 model_name ='ssd_mobilenet_v1_coco_2017_11_17' 2 detection_model = load_model(型号名称) INFO:tensorflow:Saver未创建,因为图中没有要还原的变量

并最终出现此错误 enter image description here

完整代码:https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/object_detection_tutorial.ipynb

1 个答案:

答案 0 :(得分:0)

没有最少的运行示例,很难识别问题,但是仅在错误跟踪上,似乎问题在于output_dict中包含张量,而python的内置int()函数不知道如何处理张量流张量。我可以重现这样的问题:

import tensorflow as tf

test = tf.convert_to_tensor(1)
int(test)

您的解决方案可能只是分解从字典中弹出值的部分,然后将其从张量转换为numpy数组,然后处理将其降至整数。