Reputation:
Not sure whether I should be posting this on askubuntu or here. I am trying to perform object detection using Tensorflow. I am therefor following this tutorial (this link shows the exact issue I am facing).
When running this script, I get this error:
$ python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection import trainer
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/trainer.py", line 33, in <module>
from deployment import model_deploy
ImportError: No module named 'deployment
According to the info I found online and the video I linked above I have to execute this command:
export PYTHONPATH=$PYTHONPATH:`pwd`/slim
While being in the tensorflow/model/
directory. Yet, it doesn't solve my issue. And I don't really know what I should check in order to find out what is causing this persistent issue.
Could someone help me out?
Thanks
EDIT:
exactly what I do:
(tensorflow) xxx@yyy-ThinkPad-X200:~/Downloads/models/research/build/lib/object_detection$ cd ../../../../
(tensorflow) xxx@yyy-ThinkPad-X200:~/Downloads/models$ export PYTHONPATH=$PYTHONPATH:`pwd`/slim
(tensorflow) xxx@yyy-ThinkPad-X200:~/Downloads/models$ cd ~/Downloads/models/research/build/lib/object_detection
(tensorflow) xxx@yyy-ThinkPad-X200:~/Downloads/models/research/build/lib/object_detection$ python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection import trainer
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/trainer.py", line 33, in <module>
from deployment import model_deploy
ImportError: No module named 'deployment'
(tensorflow) xxx@yyy-ThinkPad-X200:~/Downloads/models/research/build/lib/object_detection$
Upvotes: 5
Views: 9389
Reputation: 2317
If you are installing from a clone of the tensorflow/models github you need to be inside models/research folder when you run the command:
$ export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
Notice the extra `pwd`
to your command.
I still had problems until I ran from within models/research:
$ python setup.py build
$ python setup.py install
$ python slim/setup.py build
$ python slim/setup.py install
Note: In your case you may need to run python3
instead of python
.
Upvotes: 7
Reputation: 195
As of now, the slim folder has been moved to models/research
. So if models is in the /home
directory, do the following to resolve the issue:
1- Open the ~/.bashrc
and add the following line to the end of the file:
export PYTHONPATH="$PYTHONPATH:/home/models:/home/models/research/slim/"
3- Close the file and do source ~/.bashrc
Upvotes: 1
Reputation: 758
This work for me:
then run again.It will work!
Upvotes: 3
Reputation: 34734
It's PYTHONPATH
not PYTHONPAT
. You're missing H
in your export
statement.
Upvotes: 1