在Tensorflow对象检测中尝试评估相关模型时出错

时间:2019-07-31 09:12:35

标签: python python-3.x tensorflow runtime-error object-detection

我正在尝试对我的视频数据评估预训练的张量流对象截面模型。

我在这里的另一个问题中尝试了此脚本,但是它不起作用

python
/Users/user_name/PycharmProjects/ObjDectCount/Tensorflow/models/research/object_detection/legacy/eval.py --logtostderr --checkpoint_dir=test_ckpt --eval_dir=/Users/Documents/1426-1200reduced.avi   --pipelineline_config_path=/samples/configs/ssd_inception_v2_coco.config

这是我尝试运行脚本时遇到的错误:

Traceback (most recent call last):
  File "/Users/user_name/PycharmProjects/ObjDectCount/Tensorflow/models/research/object_detection/legacy/eval.py", line 51, in <module>
    from object_detection.builders import model_builder
  File "/Users/user_name/.conda/envs/ObjDectCount/lib/python3.7/site-packages/object_detection-0.1-py3.7.egg/object_detection/builders/model_builder.py", line 35, in <module>
    from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
  File "/Users/user_name/.conda/envs/ObjDectCount/lib/python3.7/site-packages/object_detection-0.1-py3.7.egg/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py", line 28, in <module>
    from nets import inception_resnet_v2
ModuleNotFoundError: No module named 'nets'

1 个答案:

答案 0 :(得分:1)

从该线程https://github.com/tensorflow/models/issues/1842看来,您似乎没有向python环境添加正确的路径。我不确定您的安装位置,但是我的位置在~/Documents/TensorFlow/models/research/slim。确保将此路径添加到您的PYTHONPATH变量中。请注意,您还需要models目录,这应该可以解决问题:

export PYTHONPATH=$PYTHONPATH:~/Documents/TensorFlow/models/:~/Documents/TensorFlow/models/research/slim

让我知道它是否有效, 干杯,