Faster R-CNN

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Faster R-CNN相关的知识,希望对你有一定的参考价值。

参考:https://github.com/rbgirshick/py-faster-rcnn

进入路径,编译出现错误:

In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/caffe.hpp:7,
                 from src/caffe/parallel.cpp:12:
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::createPoolingDesc(cudnnPoolingStruct**, caffe::PoolingParameter_PoolMethod, cudnnPoolingMode_t*, int, int, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:127:41: error: too few arguments to function ‘cudnnStatus_t cudnnSetPooling2dDescriptor(cudnnPoolingDescriptor_t, cudnnPoolingMode_t, cudnnNanPropagation_t, int, int, int, int, int, int)’
         pad_h, pad_w, stride_h, stride_w));
                                         ^
./include/caffe/util/cudnn.hpp:15:28: note: in definition of macro ‘CUDNN_CHECK’
     cudnnStatus_t status = condition;                             ^
In file included from ./include/caffe/util/cudnn.hpp:5:0,
                 from ./include/caffe/util/device_alternate.hpp:40,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/caffe.hpp:7,
                 from src/caffe/parallel.cpp:12:
/usr/local/cuda/include/cudnn.h:952:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(
                           ^
Makefile:566: recipe for target ‘.build_release/src/caffe/parallel.o‘ failed
make: *** [.build_release/src/caffe/parallel.o] Error 1

 由于faster cudnn版本低,所以重新拷贝,继续make -j8即可编译成功。

cp caffe/include/caffe/util/cudnn.hpp py-faster-rcnn/caffe-fast-rcnn/include/caffe/util/cudnn.hpp 

cp caffe/src/caffe/layers/cudnn_* py-faster-rcnn/caffe-fast-rcnn/src/caffe/layers/

cp caffe/include/caffe/layers/cudnn_* py-faster-rcnn/caffe-fast-rcnn/include/caffe/layers/

 运行demo时出现:

Traceback (most recent call last):
  File "/home/peiyuyang/py-faster-rcnn/tools/demo.py", line 17, in <module>
    from fast_rcnn.config import cfg
  File "/home/peiyuyang/py-faster-rcnn/tools/../lib/fast_rcnn/config.py", line 23, in <module>
    from easydict import EasyDict as edict
ImportError: No module named easydict

安装模块easydict

pip install easydict

出现:

Traceback (most recent call last):
  File "/home/peiyuyang/py-faster-rcnn/tools/demo.py", line 18, in <module>
    from fast_rcnn.test import im_detect
  File "/home/peiyuyang/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 15, in <module>
    import cv2
ImportError: No module named cv2

安装模块cv2

pip install opencv-python

编译成功。

以上是关于Faster R-CNN的主要内容,如果未能解决你的问题,请参考以下文章

TensorFlow2深度学习实战(十七):目标检测算法 Faster R-CNN 实战

TensorFlow2深度学习实战(十七):目标检测算法 Faster R-CNN 实战

Faster R-CNN简介及其发展

R-CNN/Fast R-CNN/Faster R-CNN

Faster R-CNN

r-cnn学习系列:从r-cnn到faster r-cnn