First install pip, then do the following
The installation of tensorflow is now very simple, directly
pip install tensorflow
Then install the libraries required by the object detection API:
sudo apt-get install protobuf-compiler python-pil python-lxml
pip install -i https://pypi.doubanio.com/simple/ ipython==5.3.0
sudo pip install -i https://pypi.doubanio.com/simple/ jupyter
sudo pip install matplotlib
Finally, download the models on github:
git clone https://github.com/tensorflow/models.git
After downloading, the file name is: models-master
Note: There is a little difference here. The online tutorials are directly operated in models/object_detection. This version of tensorflow has been slightly changed here. I also found it after a long time of searching. The current version puts object_detection in research Under the folder, the other one is all the operations based on the models folder on the Internet. Here, the corresponding ones are models-master, which can be downloaded and renamed as models.
Finally, you need to add the slim folder to the environment variable, otherwise an error will be reported when running:
File "model_builder_test.py", line 21, in <module>
from object_detection.builders import model_builder
ImportError: No module named object_detection.builders
Enter the following command:
vi ~ / .bashrc
Add at the end:
export PYTHONPATH=$PYTHONPATH:/******/models-master/research:/*****/models-master/research/slim
Here /******/models-master/research is the path you downloaded, save and exit
source ~/.bashrc
It's good to go here, run model_builder_test.py to try, cd to the research folder:
python object_detection/builders/model_builder_test.py
If there is no error, the following result will be OK
...........
----------------------------------------------------------------------
Ran 11 tests in 0.047s
OK