问题描述
我正在尝试从 tensorflow/models 中提供的 export_inference_graph.py 脚本中将trained_checkpoint 转换为最终冻结模型,但结果出现以下错误.是的,我已经将 $PYTHONPATH 设置为models/slim",但仍然出现此错误,有人可以帮我吗?
I am trying to convert trained_checkpoint to final frozen model from the export_inference_graph.py script provided in tensorflow/models,but the following error results.And yes,I have already setup $PYTHONPATH to "models/slim" but still I get this error,can someone help me out?
$ echo $PYTHONPATH
:/home/ishara/tensorflow_models/models:/home/ishara/tensorflow_models/models/slim
********************************问题*******************************************************************************
*****************************problem****************************************************************************
$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.
I have been struggling with this for days now,tried many solutions nothing workI am using Ubuntu 16.04 with tensorflow-gpu version.
推荐答案
查看 Protobuf Compilation athttps://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md并正确设置 PYTHONPATH,这就是我为 Windows 解决这个问题的方法
Take a look at Protobuf Compilation athttps://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.mdand set PYTHONPATH correctly, this is how I solved this for Windows
对于 Windows:
For Windows:
第一步: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
这篇关于导入错误:没有名为“nets"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!