Caffe
错误: 采用make方式编译时遇到如下错误
@H_301_46@In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,from /usr/include/boost/python/args.hpp:8,from /usr/include/boost/python.hpp:11,from tools/caffe.cpp:2: /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory compilation terminated. Makefile:575: recipe for target '.build_release/tools/caffe.o' Failed make: *** [.build_release/tools/caffe.o] Error 1 @H_301_46@PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ # $(ANACONDA_HOME)/include/python2.7 \ # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \取消以下2行注释
@H_301_46@PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ $(ANACONDA_HOME)/include/python2.7 \ $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \ @H_301_46@Note:$(ANACONDA_HOME) #虚拟环境Anaconda2的根目录Faster-RCNN
问题: 如何编译只采用cpu版本的Faster-RCNN?
解决方案:
在./lib/setup.py中注释以下部分
问题:运行时,遇到错误:ImportError: No module named cv2
@H_301_46@File "./tools/test_net.py",line 13,in <module>
from fast_rcnn.test import test_net
File "/home/rtc5/JpHu/pva-faster-rcnn-master/tools/../lib/fast_rcnn/test.py",line 15,in <module>
import cv2
ImportError: No module named cv2
解决方案
(1)检查cv2是否存在:
在${HOME}
目录下运行
进行查找
(2)如果不存在cv2,安装python-opencv
(3)如果存在cv2,将文件夹cv2所在目录添加到.bashrc最后一行(如我将cv2安装在/home/rtc5/anaconda2/envs/tensorflow/lib/python2.7/site-packages/cv2
下)
运行命令
@H_301_46@source ./bashrc #激活激活./bashrc
问题:编译cpu版本成功后,faster-rcnn运行时,遇到错误ImportError: No module named gpu_nms
@H_301_46@File "./demo.py",line 18,in
from fast_rcnn.test import im_detect
File ".../py-faster-rcnn-master/tools/../lib/fast_rcnn/test.py",line 17,in
from fast_rcnn.nms_wrapper import nms
File ".../py-faster-rcnn-master/tools/../lib/fast_rcnn/nms_wrapper.py",line 11,in
from nms.gpu_nms import gpu_nms
ImportError: No module named gpu_nms
解决方案:
注释${FCNN}/py-faster-rcnn/lib/fast_rcnn/nms_wrapper.py
中有关gpu的代码
问题:(1)运行vgg16版本的faster-rcnn的./tools/demo.py
遇到如下问题
@H_301_46@WARNING: Logging before InitGoogleLogging() is written to STDERR
F1207 00:08:31.251930 20944 common.cpp:66] Cannot use GPU in cpu-only Caffe: check mode.
@H_249_404@*** Check failure stack trace: ***
Aborted (core dumped)
解决方案:
采用命令:
Note:运行pvanet示例时,遇到类似问题,则需要将测试文件*.py中set_gpu的相关代码注释
问题:如何编译cpu版本的pvanet
编译caffe,遇到问题:
@H_301_46@src/caffe/layers/proposal_layer.cpp:321:10: error: redefinition of ‘void caffe::ProposalLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&,const std::vector<bool>&,const std::vector<caffe::Blob<Dtype>*>&)’ STUB_GPU(ProposalLayer); ^ ./include/caffe/util/device_alternate.hpp:17:6: note: in definition of macro ‘STUB_GPU’ void classname<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,\ ^ In file included from src/caffe/layers/proposal_layer.cpp:1:0: ./include/caffe/fast_rcnn_layers.hpp:122:16: note: ‘virtual void caffe::ProposalLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype>*>&,const std::vector<caffe::Blob<Dtype>*>&)’ prevIoUsly declared here virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,^ Makefile:575: recipe for target '.build_release/src/caffe/layers/proposal_layer.o' Failed make: *** [.build_release/src/caffe/layers/proposal_layer.o] Error 1 make: *** Waiting for unfinished jobs....解决方案:
由于caffe::ProposalLayer<Dtype>::Backward_gpu
在./include/caffe/fast_rcnn_layers.hpp
和./include/caffe/util/device_alternate.hpp
(后者为模板形式)中定义了两次,被系统认为重定义。
解决方法如下:
将./include/caffe/fast_rcnn_layers.hpp
的Backward_gpu
代码
修改如下
@H_301_46@virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,const vector<Blob<Dtype>*>& bottom);由于Backward_cpu
只在./include/caffe/fast_rcnn_layers.hpp
中定义过一次,所以一定避免对它做如上gpu的修改。
问题:如何只用cpu训练caffe,py-faster-rcnn,pvanet?
*报错:
@H_301_46@smooth_L1_loss_layer Not Implemented Yet解决方案:*
补充./src/caffe/layers/smooth_L1_loss_layer.cpp函数实体SmoothL1LossLayer::Forward_cpu和SmoothL1LossLayer::Backward_cpu
转自: zhouphd 的解答,已验证有效,caffe能够通过编译,并进行训练
问题:运行pvanet时,报错
@H_301_46@Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.原因:由于之前安装tensorflow时,采用的是anaconda,它独自创建了一个虚拟环境(自行另安装依赖库),但由于anaconda会在~/.bashrc中添加PATH路径。所以执行caffe程序时(在虚拟环境之外),其依赖库也会受到anaconda安装软件的影响。
解决方案:屏蔽anaconda设置的PATH,在~/.bashrc中注释
注意:重开一个终端,在当前终端,source命令是没有生效的。
如何验证?
同样由此可知,当我们需要anaconda2时,我们可以将
@H_301_46@#export PATH="/home/cvrsg/anaconda2/bin:$PATH"解注释,并source ~/.bashrc
激活
不需要时,注释即可。
在上述命令被注释的情况下,运行source activate tensorflow
会出现以下错误
别着急,解注释,激活就好。
Note-切记:::
另外,如果我们要用conda安装软件时,一定要切换到相应的虚拟环境下,否则安装的软件很容易和系统软件发生版本冲突,导致程序出错。
在安装pycaffe依赖库时,遇到的问题
利用命令for req in $(cat requirements.txt); do pip install $req; done
安装pycaffe相关依赖库遇到问题:ImportError: No module named packaging.version
描述:这是因为采用 sudo apt-get install python-pip
安装的pip有问题
错误
@H_301_46@F0608 15:36:07.750129 6353 concat_layer.cpp:42] Check Failed: top_shape[j] == bottom[i]->shape(j) (63 vs. 62) All inputs must have the same shape,except at concat_axis. *** Check failure stack trace: *** Aborted (core dumped)这个似乎是新版本的PVANET的问题,旧版本的PVANET没有该问题。问题出在lib文件的改变。
其他
问题: wget如何避免防火墙的影响?
解决方案:
在命令
之后加
@H_301_46@—no-check-certificate 原文链接:https://www.f2er.com/ubuntu/355699.html