我试图从 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。
最佳答案
查看 Protobuf 编译 https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md 并正确设置 PYTHONPATH,这就是我为 Windows 解决此问题的方法
对于 Windows:
来自tensorflow/models/research/
第一步:protoc object_detection/protos/*.proto --python_out=.
第二步:
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
关于python - 导入错误 : No module named 'nets' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46030481/