很久才發(fā)現(xiàn)tensorflow官網(wǎng)[https://github.com/tensorflow/models]提供了各種模型撩笆。
其中要求tf的版本在1.0以上鲤孵。
以object_detection為例子侠鳄。[https://github.com/tensorflow/models/tree/master/object_detection]
安裝過(guò)程:
1.安裝tensorflow
2.安裝對(duì)應(yīng)依賴庫(kù)
- Protobuf 2.6
- Pillow 1.0
- lxml
- tf Slim (which is included in the "tensorflow/models" checkout)
- Jupyter notebook
- Matplotlib
安裝 程序:
sudo apt-get install protobuf-compiler python-pil python-lxml
sudo pip install jupyter
sudo pip install matplotlib
#或者仔引,protobuf之后的無(wú)法安裝
sudo pip install pillow
sudo pip install lxml
sudo pip install jupyter
sudo pip install matplotlib
使用protobuf生成按照要求文件
#在 tensorflow/models/路徑下運(yùn)行
protoc object_detection/protos/*.proto --python_out=.
添加系統(tǒng)環(huán)境變量:
# pwd為tensorflow/models/
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
測(cè)試安裝是否完成
python object_detection/builders/model_builder_test.py
如果成功則顯示:
.......
----------------------------------------------------------------------
Ran 7 tests in 0.022s
OK