当我尝试运行 tf_pose 时遇到了问题

时间:2021-04-28 17:17:38

标签: tensorflow

我正在尝试使用 tensorflow version2 使用 tf-pose。

!git clone https://github.com/gsethi2409/tf-pose-estimation.git > /dev/null
%cd tf-pose-estimation
!pip3 install -r requirements.txt

这是我克隆的地方。但是当我运行下面的代码时。它显示一个错误。

!python run.py --model=mobilenet_thin --resize=432x368 --image=./images/p1.jpg
<块引用>

回溯(最近一次调用最后一次):文件“run.py”,第 39 行,在 e = TfPoseEstimator(get_graph_path(args.model), target_size=(w, h)) 文件“/content/tf-pose-estimation/tf_pose/estimator.py”,行 337,在初始化 self.tensor_image = self.graph.get_tensor_by_name('TfPoseEstimator/image:0') 文件 "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", 第 3902 行,在 get_tensor_by_name 中 返回 self.as_graph_element(name, allow_tensor=True, allow_operation=False) 文件 "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", 第 3726 行,在 as_graph_element 中 返回 self._as_graph_element_locked(obj, allow_tensor, allow_operation) 文件 "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", 第 3768 行,在 _as_graph_element_locked 中 “图形。” % (repr(name), repr(op_name))) KeyError: “名称‘TfPoseEstimator/image:0’指的是一个不存在的张量。 操作,'TfPoseEstimator/image',在图中不存在。"

1 个答案:

答案 0 :(得分:0)

在 tf_pose/estimatory.py 中导入 tensorflow 的行下添加以下行

tf.compat.v1.disable_eager_execution() link

相关问题