如何修复"calibration_pb2 from 'object_detection.protos' "错误 (Windows)



我尝试运行以下代码,但它总是给出一组错误。我尝试搜索答案,但没有一个适用于我的代码,有两个名为"object_detection"的文件,一个在研究文件夹中,另一个在 object_detection-0.1-py3.7.egg 文件夹中,这可能会导致错误,但我试图更改路径,但错误仍然存在

我正在尝试执行此命令:

C:tensorflow1modelsresearchobject_detection>python train.py -- 
logtostderr --train_dir=training/ -- 
pipeline_config_path=training/faster_rcnn_inception_v2_pets.config

但是出现以下错误:

Traceback (most recent call last):
1. File "train.py", line 51, in <module>
   from object_detection.builders import model_builder
2. File "C:UsersSwayammypythonlibsite-packagesobject_detection- 
   0.1- 
   py3.7.eggobject_detectionbuildersmodel_builder.py", line 27, in 
   <module>
   from object_detection.builders import post_processing_builder
3. File "C:UsersSwayammypythonlibsite-packagesobject_detection- 
   0.1- 
   py3.7.eggobject_detectionbuilderspost_processing_builder.py", 
   line 2 
   2, in <module>
   from object_detection.protos import post_processing_pb2
4. File "C:UsersSwayammypythonlibsite-packagesobject_detection- 
   0.1- 
   py3.7.eggobject_detectionprotospost_processing_pb2.py", line 15, 
   in 
   <module>
   from object_detection.protos import calibration_pb2 as 
   object__detection_dot_protos_dot_calibration__pb2
5. ImportError: cannot import name 'calibration_pb2' from 
   'object_detection.protos' (C:UsersSwayammypythonlibsite- 
packagesobject_detection-0.1- 
py3.7.eggobject_detectionprotos__init__.py)

我试过使用

protoc object_detection/protos/*.proto --python_out=.

命令,但它也会带来错误。

另外,环境不是在conda中制作的,这可能是错误的原因吗?尽管所有必要的安装都存在于现有的虚拟环境中。

试试这个解决方案:
检查文件
是否"calibration_pb2.py">
位于以下路径中,在您的情况下可能是此路径:
C:UsersSwayammypythonlibsite-packagesobject_detection-0.1- py3.7.eggobject_detectionprotos

如果没有,只需从您的工作路径中复制它:
C:tensorflow1modelsresearchobject_detectionprotos

如果它有效,我建议您尝试将所有 *pb2.py 文件复制到上述路径中。

你只是编译这个

protoc --python_out=. .object_detectionprotosanchor_generator.proto .object_detectionprotosargmax_matcher.proto .object_detectionprotosbipartite_matcher.proto .object_detectionprotosbox_coder.proto .object_detectionprotosbox_predictor.proto .object_detectionprotoseval.proto .object_detectionprotosfaster_rcnn.proto .object_detectionprotosfaster_rcnn_box_coder.proto .object_detectionprotosgrid_anchor_generator.proto .object_detectionprotoshyperparams.proto .object_detectionprotosimage_resizer.proto .object_detectionprotosinput_reader.proto .object_detectionprotoslosses.proto .object_detectionprotosmatcher.proto .object_detectionprotosmean_stddev_box_coder.proto .object_detectionprotosmodel.proto .object_detectionprotosoptimizer.proto .object_detectionprotospipeline.proto .object_detectionprotospost_processing.proto .object_detectionprotospreprocessor.proto .object_detectionprotosregion_similarity_calculator.proto .object_detectionprotossquare_box_coder.proto .object_detectionprotosssd.proto .object_detectionprotosssd_anchor_generator.proto .object_detectionprotosstring_int_label_map.proto .object_detectionprotostrain.proto .object_detectionprotoskeypoint_box_coder.proto .object_detectionprotosmultiscale_anchor_generator.proto .object_detectionprotosgraph_rewriter.proto .object_detectionprotoscalibration.proto

它将解决问题

相关内容

  • 没有找到相关文章

最新更新