Tensorflow Object Detection API 安装

git:https://github.com/tensorflow/models/tree/master/object_detection

中文文档:http://wiki.jikexueyuan.com/project/tensorflow-zh/


linux环境


一、安装pip

#yum -y install epel-release
#yum install python-pip
升级:
#pip install --upgrade pip

二、安装环境

安装过程中,可能报gcc错误,执行一下命令

#yum -y install gcc gcc-c++ kernel-devel
#yum -y install python-devel libxslt-devel libffi-devel openssl-devel

依赖:

1、Protobuf 2.6

pip install protobuf==2.6.0

2、Pillow 1.0

pip install pillow==1.0

3、lxml

基本已经安装好了

4、tf Slim (which is included in the "tensorflow/models" checkout)

pip install tf

5、Jupyter notebook

pip install Jupyter notebook

6、Matplotlib

pip install Matplotlib

7、Tensorflow

pip install Tensorflow

docker环境


1、docker镜像

docker pull registry.cn-beijing.aliyuncs.com/ttmama/tensorflow

2、运行镜像,8888端口用于执行jupyter,6006端口用于监视训练

docker run -ti -p 8888:8888 -p 6006:6006 -v /mnt/hgfs/workspace:/workspace 镜像名 bash

3、docker环境运行jupyter请执行:

/run_jupyter.sh --allow-root

二、安装项目

#git clone https://github.com/tensorflow/models
#cd models
#protoc object_detection/protos/*.proto --python_out=.
#export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
测试是否安装成功
#python object_detection/builders/model_builder_test.py
 

三、运行

#chmod -R 777 /run/user/0

切换非root用户执行:

#jupyter notebook

访问屏幕出现的url地址

进入object_detection文件夹中的object_detection_tutorial.ipynb

点击Cell内的Run All,等待3分钟左右,出结果

修改图片文件目录:PATH_TO_TEST_IMAGES_DIR