在Windows上编译协议缓冲区Tensorflow对象检测API

时间:2019-05-21 18:04:55

标签: python tensorflow protocol-buffers

我是Windows环境的新手,并且花了几个小时尝试使用对象检测教程来安装Tensorflow。我读过很多主题,看了几段视频,都没有运气。

我在这里:我已经安装了所有Tensorflow依赖项和protoc(3.7版)可执行文件,但是当我运行行object_detection/protos/*.proto --python_out=.时,我得到了no such file or directory错误。

这是我在命令行中从models目录运行的内容:

D:\training\Tensorflow\protoc\bin\protoc object_detection/protos/*.proto --python_out=.

我也尝试过D:\training\Tensorflow\protoc\bin\protoc research/object_detection/protos/*.proto --python_out=.,因为从当前目录(模型)到原型文件的路径为research/object_detection/protos/

This线程建议一个一个地编译每个.proto文件,然后尝试使用D:\training\Tensorflow\protoc\bin\protoc research/object_detection/protos/anchor_generator.proto --python_out=.

编译第一个.proto文件

我收到此错误:

object_detection/protos/grid_anchor_generator.proto: File not found.
object_detection/protos/ssd_anchor_generator.proto: File not found.
object_detection/protos/multiscale_anchor_generator.proto: File not found.
research/object_detection/protos/anchor_generator.proto: Import "object_detection/protos/grid_anchor_generator.proto" was not found or had errors.
research/object_detection/protos/anchor_generator.proto: Import "object_detection/protos/ssd_anchor_generator.proto" was not found or had errors.
research/object_detection/protos/anchor_generator.proto: Import "object_detection/protos/multiscale_anchor_generator.proto" was not found or had errors.
research/object_detection/protos/anchor_generator.proto:13:5: "GridAnchorGenerator" is not defined.
research/object_detection/protos/anchor_generator.proto:14:5: "SsdAnchorGenerator" is not defined.
research/object_detection/protos/anchor_generator.proto:15:5: "MultiscaleAnchorGenerator" is not defined.

其他.proto文件实际上位于同一目录中,所以我不确定为什么找不到这些文件。
我在做什么错了?

1 个答案:

答案 0 :(得分:0)

您应该从research目录运行命令。如here所示。

# From tensorflow/models/research/
D:\training\Tensorflow\protoc\bin\protoc object_detection/protos/*.proto --python_out=.