Search code examples
windowstensorflowenvironment-variablesobject-detection

Tensorflow object detection: ImportError: No module named nets


I am currently attempting to install the tensorflow object detection app on Windows 7 (employer requirement) and I am failing at a few steps from the end.

Basically I get the following error when I run the installation test command: ImportError: No module named nets.

I have read some solutions on the subject:

https://github.com/tensorflow/models/issues/729 https://github.com/tensorflow/models/issues/1842

which looks like this: export PYTHONPATH="$PYTHONPATH:"somepath"/tensorflow/models/slim"

basically meaning that I must set the right path in the PYTHONPATH environmental variable.

Working with Windows, I tried calling this: SET PYTHONPATH="$PYTHONPATH:C:tensorflow/models/slim And when it didn't work, I created a PYTHONPATH variable in system-> environmental variables.

I'm still getting the error so I suppose that I am still missing something but due to my lack of knowledge I still can't figure out what.

Would someone familiar with Windows be able to point out what's missing?

Thanks


Solution

  • I figured out a way to make it work. I am not writing this as a final answer as it is mostly a workaround and due to lack of understanding from my part I cannot guarantee it will work (and also it might not be best good practice).

    Anyway here it is:

    As Beta previously suggested, you have to run setup.py, however running it from models folder did not do it for me, I also had to run it from object detection folder.

    However there was a problem there, it generated an error saying the BUILD already existed (which was correct) so I had to delete the BUILD file from inside of model.

    After that it worked, turns out the path I had set was working fine.

    Now if some experts would look into this and explain how and why this workaround worked it might make this a valid solution.