ImportError:没有名为“ nets”的模块

Ishara Abeykoon:

我正在尝试从tensorflow / models中提供的export_inference_graph.py脚本将trained_checkpoint转换为最终冻结的模型,但是会出现以下错误。是的,我已经将$ PYTHONPATH设置为“ models / slim”,但是仍然出现此错误,有人可以帮我吗?

$ echo $PYTHONPATH
:/home/ishara/tensorflow_models/models:/home/ishara/tensorflow_models/models/slim

*****************************问题******************** ****************************************************** ******

$sudo python3 object_detection/export_inference_graph.py  --input_type image_tensor  --pipeline_config_path = "ssd_inception_v2_pets.config"  --trained_checkpoint_prefix="output/model.ckpt-78543"  --output_directory="birds_inference_graph.pb"

Traceback (most recent call last):
  File "object_detection/export_inference_graph.py", line 74, in <module>
    from object_detection import exporter
  File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/exporter.py", line 28, in <module>

  File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 30, in <module>
  File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py", line 28, in <module>
ImportError: No module named 'nets'

我已经为此苦苦挣扎了几天,尝试了许多解决方案,但无济于事。我正在使用带有tensorflow-gpu版本的Ubuntu 16.04。

Pawan Mishra:

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md上查看Protobuf编译并正确设置PYTHONPATH,这就是我为Windows解决的方法

对于Windows:

来自tensorflow / models / research /

步骤1: protoc object_detection/protos/*.proto --python_out=.

第2步:

set PYTHONPATH= <Path to 'research' Directory> ; <Path to 'slim' Directory>

例如:

set PYTHONPATH=C:\Users\Guy\Desktop\models\research;C:\Users\Guy\Desktop\models\research\slim

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章