【问题标题】:Python can not import an existing filePython 无法导入现有文件
【发布时间】:2018-08-21 13:48:50
【问题描述】:

我正在构建谷歌检测 api 模型,我正处于最后一步 - 训练。 运行此代码后

python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_resnet_v2_atrous_coco.config

我收到以下错误

Traceback (most recent call last):
   File "train.py", line 49, in <module>
from object_detection.builders import dataset_builder
File "C:\Program Files\Python36\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\builders\dataset_builder.py", line 27, in <module>
from object_detection.data_decoders import tf_example_decoder
File "C:\Program Files\Python36\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\data_decoders\tf_example_decoder.py", line 27, in <module>
from object_detection.protos import input_reader_pb2
ImportError: cannot import name 'input_reader_pb2'

我确实有 proto 和 python

input_reader_pb2

文件。如果有人真的帮助我并且不将我重定向到其他线程,我会非常高兴。

【问题讨论】:

  • 一般提示:如果您的错误是“ImportError”-> 谷歌它。因为 stackoverflow 上的人通常无法重现这种错误,除非他们的库安装也损坏(并且以相同的方式损坏),因此这是浪费时间......

标签: python tensorflow protocol-buffers


【解决方案1】:

很抱歉发布链接。但它来自 tensorflow 本身。

请找到此链接:https://github.com/tensorflow/models/issues/3933

它说您必须执行以下步骤:

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

也可以在那里完整地进行对话。

【讨论】:

  • .. 我收到此错误.....'protoc' 不是内部或外部命令、可运行程序或批处理文件。
猜你喜欢
  • 2018-02-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多