Search code examples
pythonpython-3.xtensorflowruntime-errorobject-detection

Error when trying to evaluate pertained model in tensorflow object-detection


I am trying to evaluate a pretrained tensorflow object section model on my video data.

I tried this script within a different question on here but it doesn't work

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

This is the error I get when I try to run the script:

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'

Solution

  • from this thread https://github.com/tensorflow/models/issues/1842, it seems you didn't add the proper path to your python environment. I'm not sure where you installed yours, but mine is here : ~/Documents/TensorFlow/models/research/slim. Make sure to add this path to your PYTHONPATH variable. Note that you also need the models directory, this should do the trick:

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

    Let me know if it works, Cheers,