前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >faster-rcnn在编译时遇到的一些问题

faster-rcnn在编译时遇到的一些问题

作者头像
Gxjun
发布2018-03-27 12:08:11
1.3K0
发布2018-03-27 12:08:11
举报
文章被收录于专栏:ml

 1.在安装faster-rcnn事如果报这种错误   

代码语言:javascript
复制
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/net.hpp:10,
                 from ./include/caffe/solver.hpp:7,
                 from ./include/caffe/sgd_solvers.hpp:7,
                 from src/caffe/solvers/adam_solver.cpp:3:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:21:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING’ not handled in switch [-Wswitch]
   switch (status) {
          ^
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::setConvolutionDesc(cudnnConvolutionStruct**, cudnnTensorDescriptor_t, cudnnFilterDescriptor_t, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:108:70: error: too few arguments to function ‘cudnnStatus_t cudnnSetConvolution2dDescriptor(cudnnConvolutionDescriptor_t, int, int, int, int, int, int, cudnnConvolutionMode_t, cudnnDataType_t)’
       pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION));
                                                                      ^

  处理方案:

    这种问题出现的原因是在rbg开源这套物体检查方案时是依据的当时最新的cundnn版本,而这么多年过去,cudnn已经发布了好几个版本,所以要处理这个问题,只需要将caffe框架下的所有cudnn相关的文件替换车成当前caffe最新的即可.

rbg的faster-rcnn模型代码地址: https://github.com/rbgirshick/py-faster-rcnn

cafe框架的代码地址: https://github.com/BVLC/caffe

进入faster-rcnn目录下py-caffe的src/caffe/util/cudnn.cpp 以及src/caffe/layers/cudnn*中的所有文件.还有include/util/cudnn.hpp 和include/layers/cudnn*.hpp中的文件全部替换成caffe中对应的文件.然后编译即可.

2.

代码语言:javascript
复制
python setup.py build_ext --inplace
Traceback (most recent call last):
  File "setup.py", line 58, in <module>
    CUDA = locate_cuda()
  File "setup.py", line 55, in locate_cuda
    raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
EnvironmentError: The CUDA lib64 path could not be located in /usr/lib64
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

 这种问题是由于只需要将53行的第二个lib64换成lib即可.

3.安装opencv 

代码语言:javascript
复制
sudo apt-get install python-opencv

 4. 

代码语言:javascript
复制
 File "/home/gxjun/Qunar/py-faster-rcnn/tools/train_faster_rcnn_alt_opt.py", line 67, in get_roidb
    roidb = get_training_roidb(imdb)
  File "/home/gxjun/Qunar/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 118, in get_training_roidb
    imdb.append_flipped_images()
  File "/home/gxjun/Qunar/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 111, in append_flipped_images
    assert (boxes[:, 2] >= boxes[:, 0]).all()

这种问题,一般都是清楚缓存,去cache下删除所有文件就可以了

5. 出现问题:训练faster rcnn时出现如下报错:

代码语言:javascript
复制
File "/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 108, in append_flipped_images
    assert (boxes[:, 2] >= boxes[:, 0]).all()
AssertionError
代码语言:javascript
复制
2、问题分析:
代码语言:javascript
复制
检查自己数据发现,左上角坐标(x,y)可能为0,或标定区域溢出图片
其实还存在一种问题,就是图片出现旋转问题.

6.

代码语言:javascript
复制
snapshot_prefix: "vgg16_rpn"
average_loss: 100
I0421 11:53:05.251756 24051 solver.cpp:81] Creating training net from train_net file: models/pascal_voc/VGG16/faster_rcnn_alt_opt/stage1_rpn_train.pt
F0421 11:53:05.251797 24051 io.cpp:36] Check failed: fd != -1 (-1 vs. -1) File not found: models/pascal_voc/VGG16/faster_rcnn_alt_opt/stage1_rpn_train.pt
*** Check failure stack trace: ***

将sovler.txt中的路径设置成绝对路径

7.

代码语言:javascript
复制
 1 Traceback (most recent call last):
 2   File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
 3     self.run()
 4   File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
 5     self._target(*self._args, **self._kwargs)
 6   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/train_faster_rcnn_alt_opt.py", line 208, in train_fast_rcnn
 7     max_iters=max_iters)
 8   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 160, in train_net
 9     model_paths = sw.train_model(max_iters)
10   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 101, in train_model
11     self.solver.step(1)
12   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 144, in forward
13     blobs = self._get_next_minibatch()
14   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 63, in _get_next_minibatch
15     return get_minibatch(minibatch_db, self._num_classes)
16   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line 55, in get_minibatch
17     num_classes)
18   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line 125, in _sample_rois
19     roidb['bbox_targets'][keep_inds, :], num_classes)
20   File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line 176, in _get_bbox_regression_labels
21     bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
22 ValueError: could not broadcast input array from shape (4) into shape (0)

这种问题,一般是model配置参数有问题.需要重新设置protxt中的参数.

8. 

代码语言:javascript
复制
645 net.cpp:408] rpn_cls_prob_reshape -> rpn_cls_prob_reshape
F0810 10:54:11.421221   645 reshape_layer.cpp:80] Check failed: 0 == bottom[0]->count() % explicit_count (0 vs. 58320) bottom count (408240) must be divisible by the product of the specified dimensions (87480)
*** Check failure stack trace: ***

这种问题,一般是看对应的层的参数,比如这里是rpn_cls_prob参数有问题.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-04-06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档