tensorflow之faster rcnn 安装(ubuntu16.04版)
2017-11-21 15:58
525 查看
1. 准备 TensorFlow 环境
Tensorflow (>= 1.0.0)
安装对应 python 库:
[cpp] view
plain copy
sudo apt-get install cython python-opencv python-tk python-scipy python-yaml
sudo pip install easydict
sudo pip install matplotlib
sudo python -m pip install Pillow
如果不行就先
sudo apt-get update
2. Gtihub 代码
代码下载:https://github.com/CharlesShang/TFFRCNN
直接
git clone https://github.com/CharlesShang/TFFRCNN
3. 下载训练好的网络
在 TFFRCNN-master 下新建文件夹 model,存放要下载入的 net(参考 Github 下载地址),推荐下载:
——.VGG16 - https://drive.google.com/file/d/0B_xFdh9onPagX0JWRlR0cTZ5OGc/view
——.VGG16 - https://drive.google.com/file/d/0B_xFdh9onPagVmt5VHlCU25vUEE/view
——.Resnet50 - https://drive.google.com/file/d/0B_xFdh9onPagbXk1b0FIeDRJaU0/view
百度云链接:
Resnet:https://pan.baidu.com/s/1kWRYN3L 密码:yylr
VGG:https://pan.baidu.com/s/1bpOBguz 密码:8rdu
在faster rcnn根目录下新建一个model文件放进去
4. 编译
打开 lib文件夹下的 make.sh,根据提示修改,如果是 binary版本的 TensorFlow,需要关闭 D_GLIBCXX_USE_CXX11_ABI,设为0:
事先要查看gcc版本(我的是版本五,但是好像是 binary,因此也要注意一下make.sh的语句要改一下,一定要改)
gcc --version
[cpp] view
plain copy
## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below
g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \
roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
# for gcc5-built tf
#g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=1 -o roi_pooling.so roi_pooling_op.cc \
# roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
cd ..
# add building psroi_pooling layer
cd psroi_pooling_layer
nvcc -std=c++11 -c -o psroi_pooling_op.cu.o psroi_pooling_op_gpu.cu.cc \
-I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52
#g++ -std=c++11 -shared -o psroi_pooling.so psroi_pooling_op.cc \
# psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below
g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \
psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
执行命令行 make:
[cpp] view
plain copy
cd ./lib
make # compile cython and roi_pooling_op, you may need to modify make.sh for your platform
5. 运行
将 faster_rcnn/ 文件夹下的 demo.py copy到根目录下,执行如下命令:
[cpp] view
plain copy
cd ..
python demo.py --model your model path
Tensorflow (>= 1.0.0)
安装对应 python 库:
[cpp] view
plain copy
sudo apt-get install cython python-opencv python-tk python-scipy python-yaml
sudo pip install easydict
sudo pip install matplotlib
sudo python -m pip install Pillow
如果不行就先
sudo apt-get update
2. Gtihub 代码
代码下载:https://github.com/CharlesShang/TFFRCNN
直接
git clone https://github.com/CharlesShang/TFFRCNN
3. 下载训练好的网络
在 TFFRCNN-master 下新建文件夹 model,存放要下载入的 net(参考 Github 下载地址),推荐下载:
——.VGG16 - https://drive.google.com/file/d/0B_xFdh9onPagX0JWRlR0cTZ5OGc/view
——.VGG16 - https://drive.google.com/file/d/0B_xFdh9onPagVmt5VHlCU25vUEE/view
——.Resnet50 - https://drive.google.com/file/d/0B_xFdh9onPagbXk1b0FIeDRJaU0/view
百度云链接:
Resnet:https://pan.baidu.com/s/1kWRYN3L 密码:yylr
VGG:https://pan.baidu.com/s/1bpOBguz 密码:8rdu
在faster rcnn根目录下新建一个model文件放进去
4. 编译
打开 lib文件夹下的 make.sh,根据提示修改,如果是 binary版本的 TensorFlow,需要关闭 D_GLIBCXX_USE_CXX11_ABI,设为0:
事先要查看gcc版本(我的是版本五,但是好像是 binary,因此也要注意一下make.sh的语句要改一下,一定要改)
gcc --version
[cpp] view
plain copy
## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below
g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \
roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
# for gcc5-built tf
#g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=1 -o roi_pooling.so roi_pooling_op.cc \
# roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
cd ..
# add building psroi_pooling layer
cd psroi_pooling_layer
nvcc -std=c++11 -c -o psroi_pooling_op.cu.o psroi_pooling_op_gpu.cu.cc \
-I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52
#g++ -std=c++11 -shared -o psroi_pooling.so psroi_pooling_op.cc \
# psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below
g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \
psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64
执行命令行 make:
[cpp] view
plain copy
cd ./lib
make # compile cython and roi_pooling_op, you may need to modify make.sh for your platform
5. 运行
将 faster_rcnn/ 文件夹下的 demo.py copy到根目录下,执行如下命令:
[cpp] view
plain copy
cd ..
python demo.py --model your model path
相关文章推荐
- Ubuntu16.04环境下安装caffe及运行faster-rcnn
- AWS-G2-Ubuntu16.04下安装cuda,caffe和py-faster-rcnn
- Ubuntu16.04环境下安装caffe及运行faster-rcnn gpu 實現
- Ubuntu16.04 caffe py-faster-rcnn安装以及训练自己的数据
- ubuntu16.04+caffe安装和 py-faster-rcnn的CPU安装
- Ubuntu16.04+caffe的安装和Py-faster-rcnn在CPU电脑的安装-2
- ubuntu16.04配置py-faster-rcnn
- Ubuntu 16.04 + CUDA 9.0下安装GPU版TensorFlow 1.4(无需从源码编译安装)
- Ubuntu16.04安装TensorFlow教程
- ubuntu16.04安装TensorFlow(虚拟机 CPU)
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- Ubuntu16.04下安装Tensorflow GPU版本(图文详解)
- Ubuntu16.04下安装配置了tensorflow GPU版本后导致的常见错误
- Ubuntu 16.04 GTX950M + cuda9.0 + cuDNN7.0 + TensorFlow 1.5 安装记录
- tensorflow 1.2.0 cuda8.0 cudnn5.0 ubuntu16.04 安装
- TensorFlow的安装以及环境配置(ubuntu16.04+1070+Anaconda)
- Ubuntu 16.04 安装 CUDA,CUDNN 和 GPU 版本的 TensorFlow 一般步骤总结
- Ubuntu 16.04 LTS安装TensorFlow(Anaconda 4.3.1)
- ubuntu16.04 python3安装opencv及tensorflow
- Ubuntu16.04下安装Anaconda3过程python3.6使用,以及重新建立新的Python2.7并安装tensorflow-gpu,测试并成功。