很久才发现tensorflow官网[https://github.com/tensorflow/models]提供了各种模型。
其中要求tf的版本在1.0以上。
以object_detection为例子。[https://github.com/tensorflow/models/tree/master/object_detection]
安装过程:
1.安装tensorflow
2.安装对应依赖库
- 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之后的无法安装
sudo pip install pillow
sudo pip install lxml
sudo pip install jupyter
sudo pip install matplotlib
使用protobuf生成按照要求文件
#在 tensorflow/models/路径下运行
protoc object_detection/protos/*.proto --python_out=.
添加系统环境变量:
# pwd为tensorflow/models/
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
测试安装是否完成
python object_detection/builders/model_builder_test.py
如果成功则显示:
.......
----------------------------------------------------------------------
Ran 7 tests in 0.022s
OK