tensorflow之faster rcnn 安装(ubuntu16.04版)

4 篇文章 0 订阅
3 篇文章 0 订阅
本文介绍了在Ubuntu16.04上安装TensorFlow Faster R-CNN的步骤,包括环境准备,安装所需库,从GitHub克隆代码,下载预训练模型,以及编译和运行过程。
摘要由CSDN通过智能技术生成

 

1. 准备 TensorFlow 环境

    Tensorflow (>= 1.0.0) 

     安装对应 python 库:

[cpp] view plain copy

  1. sudo apt-get install cython python-opencv python-tk python-scipy python-yaml  
  2. sudo pip install easydict  
  3. sudo pip install matplotlib  
  4. sudo python -m pip install Pillow 

 

       如果不行就先

               

 

  1. sudo apt-get update

 

 

 

2. Gtihub 代码

    代码下载:https://github.com/CharlesShang/TFFRCNN

    直接

 

  1. 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的语句要改一下,一定要改

      

  1. gcc --version

 

[cpp] view plain copy

  1. ## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below  
  2. g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \  
  3.     roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64  
  4.   
  5. # for gcc5-built tf  
  6. #g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=1 -o roi_pooling.so roi_pooling_op.cc \  
  7. #   roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64  
  8. cd ..  
  9.   
  10.   
  11. # add building psroi_pooling layer  
  12. cd psroi_pooling_layer  
  13. nvcc -std=c++11 -c -o psroi_pooling_op.cu.o psroi_pooling_op_gpu.cu.cc \  
  14.     -I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52  
  15.   
  16. #g++ -std=c++11 -shared -o psroi_pooling.so psroi_pooling_op.cc \  
  17. #   psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64  
  18.   
  19. ## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below  
  20. g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \  
  21.     psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64  

    执行命令行 make:

[cpp] view plain copy

  1. cd ./lib  
  2. 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

  1. cd ..  
  2. python demo.py --model your model path  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值