TF+SSD环境搭建

TensoeFlow+SSD的环境搭建

  1. 注意Tensorflow和CUDA的版本对应,官网可查

https://tensorflow.google.cn/install/source#linux

  1. 先下载TensorFlow的models,然后进入models_master文件夹

https://github.com/tensorflow/models

  1. 安装依赖库(见3~)

Protobuf 3.0.0
Python-tk
Pillow 1.0
lxml
tf Slim (which is included in the "tensorflow/models/research/" checkout)
Jupyter notebook
Matplotlib
Tensorflow (1.15.0)
Cython
contextlib2
cocoapi

  1. 对于TF有CPU和GPU版本

pip3 install tensorflow
pip3 install tensorflow-gpu

  1. 其他依赖库

sudo apt-get install protobuf-compiler python-tk
pip3 install --user Cython
pip3 install --user contextlib2
pip3 install --user pillow
pip3 install --user lxml
pip3 install --user jupyter
pip3 install --user matplotlib

  1. COCO API

git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
make(这是编译指令,需要我们先将Makefile文件中的Python修改为python3)
cp -r pycocotools <path_to_tensorflow>/models/research/

  1. Protobuf编译

%From tensorflow/models/research/在该文件夹处执行命令
protoc object_detection/protos/*.proto --python_out=.
如果出错可能是版本问题,可以去官网下载其他版本解压,然后在protoc解压文件夹的bin文件夹下可以看到可执行命令,同样是上面这行命令,在protoc前加上相应地址就可

  1. 添加slim到环境变量

%From tensorflow/models/research/
export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim
source ~/.bashrc

  1. 测试

% If using Tensorflow 1.X:
python3 object_detection/builders/model_builder_tf1_test.py

posted @ 2020-05-24 10:05  盐亭的森林  阅读(346)  评论(0编辑  收藏  举报