centos上目标检测(一)

本文介绍了如何在CentOS上进行Faster R-CNN目标检测的初步步骤,包括从GitHub克隆源码,理解`--recursive`选项的作用,以及安装必要的依赖如Cython、easydict和python-opencv。还提到了解决安装pip和Python环境问题的方法。
摘要由CSDN通过智能技术生成

faster-rcnn

一、先下载faster-rcnn的源码https://github.com/rbgirshick/py-faster-rcnn

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git

--recursive很重要,当克隆一个含有子模块的项目时,默认会包含子模块目录,但是没有任何文件。使用递归recursive选项会自动初始化并更新仓库的每一个子模块。还有一种方法是用submodule:先git  submodule  init 然后 git  submodule update。

二、下载依赖:Cython、easydict、python-opencv

1. 先安装pip:安装前需要安装setuptools:wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26

解压,然后python  setup.py  build   &&  python  setup.py  install

安装pip:wget --no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb

解压,同上安装。

测试报错:ImportError: cannot import name 'HTTPSHandler'

缺少OpenSSL的开发环境,yum  install  openssl-devel,重新编译安装Python3.5,建立软链接ln  -s  /usr/local/python/python3/pip3  /usr/bin/pip

2. 安装Cython和easydict:sudo  pip  install  Cython  ;  sudo  pip  install  easydict

    修改Cython的lib目录下setup.py文件,这里用的是纯CPU版,注释掉GPU相关

。。。
#CUDA =locate_cuda()

。。。
          self.set_executable('compiler_so',CUDA['nvcc'])
。。。
  Extension('nms.gpu_nms',
      ['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
      library_dirs=[CUDA['lib64']],
      libraries=['cudart'],
      language='c++',
      runtime_library_dirs=[CUDA['lib64']],
      # this syntax is specific to this build system
      # we're only going to use certain compiler args with nvcc and notwith
      # gcc the implementation of this trick is in customize_compiler()below
      extra_compile_args={'gcc':["-Wno-unused-function"],
                          'nvcc': ['-arch=sm_35',
                                   '--ptxas-options=-v',
                                   '-c',
                                   '--compiler-options',
                                   "'-fPIC'"]},
      include_dirs = [numpy_include, CUDA['include']]
  ),
。。。
3. 下载模型,用源码自带的/data/scripts/fetch_faster_rcnn_models.sh得翻墙,也可以找网盘的资源下载ZF_faster_rcnn_final.caffemodel和VGG16_faster_rcnn_final.caffemodel

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值