【问题标题】:ERROR when trying to compile protoc files: file not found or had errors尝试编译 protoc 文件时出错:文件未找到或有错误
【发布时间】:2021-06-29 10:24:07
【问题描述】:

我正在尝试使用此命令编译 protoc 文件:

protoc/bin/protoc models/research/object_detection/protos/*.proto --python_out=.

但是我在 cmd 上得到了这个输出

object_detection/protos/flexible_grid_anchor_generator.proto: File not found.
object_detection/protos/grid_anchor_generator.proto: File not found.
object_detection/protos/multiscale_anchor_generator.proto: File not found.
object_detection/protos/ssd_anchor_generator.proto: File not found.
models/research/object_detection/protos/anchor_generator.proto:5:1: Import "object_detection/protos/flexible_grid_anchor_generator.proto" was not found or had errors.
models/research/object_detection/protos/anchor_generator.proto:6:1: Import "object_detection/protos/grid_anchor_generator.proto" was not found or had errors.
models/research/object_detection/protos/anchor_generator.proto:7:1: Import "object_detection/protos/multiscale_anchor_generator.proto" was not found or had errors.
models/research/object_detection/protos/anchor_generator.proto:8:1: Import "object_detection/protos/ssd_anchor_generator.proto" was not found or had errors.
models/research/object_detection/protos/anchor_generator.proto:14:5: "GridAnchorGenerator" is not defined.
models/research/object_detection/protos/anchor_generator.proto:15:5: "SsdAnchorGenerator" is not defined.
models/research/object_detection/protos/anchor_generator.proto:16:5: "MultiscaleAnchorGenerator" is not defined.
models/research/object_detection/protos/anchor_generator.proto:17:5: "FlexibleGridAnchorGenerator" is not defined.

那么可能是什么问题 谢谢

【问题讨论】:

    标签: python tensorflow object-detection protoc


    【解决方案1】:

    您需要在正确的目录中运行 protobuf 编译器。在这种情况下,它将是models/research

    $ cd models/research
    $ ../../protoc/bin/protoc object_detection/protos/*.proto --python_out=.
    

    protobuf 文件将被编译为 python。在object_detection/protos/目录中,你应该有以protobuf文件命名的python文件(即<name_protobuf>_pb2.py)。

    这些 protobuf 文件中存在相对导入,因此 protobuf 编译器在正确的目录中运行非常重要。您有一个提示,这可能是错误,因为 File not Found 错误消息列出了与您当前目录不同的路径。

    【讨论】:

    • 感谢您的帮助,我试过了,没有出现错误,实际上什么也没出现,这正常吗?我可以考虑编译的文件吗? @lescurel
    • 这个答案对我有帮助,之后什么都没有出现@Jenny ?
    猜你喜欢
    • 1970-01-01
    • 2018-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多