问题描述
我正在尝试设置 tensorflow OD 包,并尝试从 repo 安装它,但它似乎不起作用.
I'm trying to setup the tensorflow OD package and I tried installing it from the repo, but it doesn't seem to be working.
我按照安装步骤(object_detection) 并尝试运行测试文件 object_detection.builders.model_builder_tf2_test.py
无济于事.
I followed the installation steps (object_detection) and tried running the test files object_detection.builders.model_builder_tf2_test.py
with no avail.
- 无法识别
protoc
可执行文件 - 我曾收到一条
tf_utils 丢失
消息 - 最后得到
ImportError: cannot import name 'string_int_label_map_pb2' from 'object_detection.protos'
- The
protoc
executable is not recognized - I got a
tf_utils missing
message at one point - And ended up with
ImportError: cannot import name 'string_int_label_map_pb2' from 'object_detection.protos'
我是这个工具的新手,有人遇到过这些问题吗?
I'm a novice playing with this tool, has anybody ran into these issues?
我发现了这些相关问题并尝试了几件事,但我向前迈出的每一步都会解开另一个问题.
I found these related issues and tried several things, but each step I make forward unlocks another issue.
推荐答案
经过一些尝试,从一个新环境开始,我整理了使其工作的步骤.
After some attempts, starting from a new environment, I put together the steps to make it work.
- 使用此准系统设置创建新环境(请参阅下面的代码段)
- 克隆对象检测器 (OD) 存储库
- 按照此处的说明操作:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2.md#python-package-installation
git clone https://github.com/tensorflow/models.git
- 按照此处的说明操作:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2.md#python-package-installation
- https://github.com/protocolbuffers/protobuf/releases/download/v3.15.1/protoc-3.15.1-win64.zip
- 解压
- 从
bin/
复制protoc.exe
到C:\Windows\System32
- 通过在命令提示符下运行
protoc
进行测试
- https://github.com/protocolbuffers/protobuf/releases/download/v3.15.1/protoc-3.15.1-win64.zip
- unzip
- from
bin/
copyprotoc.exe
toC:\Windows\System32
- test by running
protoc
in command prompt
cd models/research
# Compile protos.
protoc object_detection/protos/*.proto --python_out=.
# Install TensorFlow Object Detection API.
cp object_detection\packages\tf2\setup.py .
# Step below is important even if some comments online (2021-02-23) suggest it is deprecated
python -m pip install --use-feature=2020-resolver .
# The step below was added, after unsuccessful previous attempts, from [this related issue][1]
pip install .
python object_detection.builders.model_builder_tf2_test.py
import object_detection.builders.model_builder_tf2_test
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: win-64
@EXPLICIT
https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2021.1.19-haa95532_0.conda
https://repo.anaconda.com/pkgs/main/win-64/vs2015_runtime-14.27.29016-h5e58377_2.conda
https://repo.anaconda.com/pkgs/main/win-64/vc-14.2-h21ff451_1.conda
https://repo.anaconda.com/pkgs/main/win-64/openssl-1.1.1i-h2bbff1b_0.conda
https://repo.anaconda.com/pkgs/main/win-64/zlib-1.2.11-h62dcd97_4.conda
https://repo.anaconda.com/pkgs/main/win-64/sqlite-3.33.0-h2a8f88b_0.conda
https://repo.anaconda.com/pkgs/main/win-64/python-3.8.0-hff0d562_2.conda
https://repo.anaconda.com/pkgs/main/win-64/certifi-2020.12.5-py38haa95532_0.conda
https://repo.anaconda.com/pkgs/main/noarch/wheel-0.36.2-pyhd3eb1b0_0.conda
https://repo.anaconda.com/pkgs/main/win-64/wincertstore-0.2-py38_0.conda
https://repo.anaconda.com/pkgs/main/win-64/setuptools-52.0.0-py38haa95532_0.conda
https://repo.anaconda.com/pkgs/main/win-64/pip-20.3.3-py38haa95532_0.conda
这篇关于无法在 Windows 上运行对象检测器问题(导入错误:无法从“object_detection.protos"导入名称“string_int_label_map_pb2")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!