NVIDIA-AI-IOT / tf_to_trt_image_classification

Image classification with NVIDIA TensorRT from TensorFlow models.
BSD 3-Clause "New" or "Revised" License
455 stars 155 forks source link

Wrong imports file 'scripts/models_to_frozen_graphs.py' and 'scripts/model_meta.py' #2

Closed mroelandts closed 6 years ago

mroelandts commented 6 years ago

Hello, When executing the models_to_frozen_graphs.py script I receive the following error

Traceback (most recent call last):
  File "scripts/models_to_frozen_graphs.py", line 12, in <module>
    import slim.nets as nets
ImportError: No module named slim.nets

I don't know where you got the 'slim' from but with my Jetson TX2 it is located in /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/slim So I changed the import to: import tensorflow.contrib.slim.nets as nets

Then the same kind of error came for the nets.vgg import so I located this file to /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/slim/python/slim/nets folder So I again changed that import to: import tensorflow.contrib.slim.python.slim.nets.vgg

Then the errors came from the model_meta.py script. These were the same import errors as the others. Only now you import also inception, resnet_v1, resnet_v2 and mobilenet_v1. These were also found in the /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/slim/python/slim/nets folder, EXCEPT the mobilenet_v1 file.

It appears that I'm totally missing that file. I followed the README completely so how come these imports are locating to the wrong place and I am missing the mobilenet_v1 file. The mobilenet is the reason I'm trying this is the first place. What have I done wrong?

ghost commented 6 years ago

It looks like when you cloned the repository the tensorflow/models submodule was not downloaded.

Make sure when cloning the github repository you add the --recursive flag.

If you've already cloned the repository you can call

git submodule init git submodule update

from the root directory of the project to download the third party submodule.

John