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

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

In file included from ./include/caffe/util/device_alternate.hpp::,
from ./include/caffe/common.hpp:,
from ./include/caffe/blob.hpp:,
from ./include/caffe/net.hpp:,
from ./include/caffe/solver.hpp:,
from ./include/caffe/sgd_solvers.hpp:,
from src/caffe/solvers/adam_solver.cpp::
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp::: 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::: 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, , , 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.

python setup.py build_ext --inplace
Traceback (most recent call last):
File "setup.py", line , in <module>
CUDA = locate_cuda()
File "setup.py", line , 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:: recipe for target 'all' failed
make: *** [all] Error

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

3.安装opencv

sudo apt-get install python-opencv

 4. 

 File "/home/gxjun/Qunar/py-faster-rcnn/tools/train_faster_rcnn_alt_opt.py", line , in get_roidb
roidb = get_training_roidb(imdb)
File "/home/gxjun/Qunar/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line , in get_training_roidb
imdb.append_flipped_images()
File "/home/gxjun/Qunar/py-faster-rcnn/tools/../lib/datasets/imdb.py", line , in append_flipped_images
assert (boxes[:, ] >= boxes[:, ]).all()

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

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

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

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

6.

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.

 Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line , in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line , in run
self._target(*self._args, **self._kwargs)
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/train_faster_rcnn_alt_opt.py", line , in train_fast_rcnn
max_iters=max_iters)
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line , in train_net
model_paths = sw.train_model(max_iters)
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line , in train_model
self.solver.step()
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line , in forward
blobs = self._get_next_minibatch()
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line , in _get_next_minibatch
return get_minibatch(minibatch_db, self._num_classes)
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line , in get_minibatch
num_classes)
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line , in _sample_rois
roidb['bbox_targets'][keep_inds, :], num_classes)
File "/media/gxjun/78289D37289CF4FA/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line , in _get_bbox_regression_labels
bbox_targets[ind, start:end] = bbox_target_data[ind, :]
ValueError: could not broadcast input array from shape () into shape ()

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

8.

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参数有问题.

上一篇:win8中完成进度


下一篇:记录maven java.lang.String cannot be cast to XX error