首页 > 解决方案 > 在 Windows 上编译协议缓冲区 Tensorflow 对象检测 API

问题描述

我是 Windows 环境的新手,花了几个小时尝试使用对象检测教程安装 Tensorflow。我已经阅读了几十个线程并看过几个视频,但没有运气。

这就是我所在的位置:我安装了所有 Tensorflow 依赖项和 protoc(3.7 版)可执行文件,但是当我运行该行时object_detection/protos/*.proto --python_out=.出现no such file or directory错误。

这是我从命令行从模型目录运行的内容:

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=.,因为从当前目录(模型)到 proto 文件的路径是research/object_detection/protos/

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

我收到此错误:

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 文件实际上在同一个目录中,所以我不确定为什么它没有找到它们。
我究竟做错了什么?

标签: pythontensorflowprotocol-buffers

解决方案


research您应该从目录运行命令。如此处所指定。

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

推荐阅读