【cpu版】Ubuntu + caffe + Anaconda2 + OpenCV3.x
2017.06.02:整理出第一个版本。
2018.01.05:整理libhdf5_hl.so.100和libopencv_highgui.so等两个问题。
2018.01.05:Ubuntu 16.04中使用Matlab R2016b编译Caffe接口出错的解决方法。
一、本文目的
本文基于上一篇博文《Ubuntu 常用软件安装:Matlab + XX-net + ... + TeamViewer + Tensorflow + Caffe》中的caffe环境的搭建部分进行完善,更详细的进行整理,主要贡献如下:
1、根据本人实践过程进行记录,更加完善记录整个“caffe环境搭建”的过程。
2、归纳总结问题集锦:caffe环境的搭建过程确实很多细节需要处理,本文尽可能收集一些相关的参考资料。
3、本文会尽可能详细的列出每个步骤,图文结合,并附上参考网址。
4、贴出【cpu版本】和【GPU版本】的Makefile.configure配置文件。
5、总结归纳测试案例。
参考网址:
1)caffe的配置过程:http://blog.csdn.net/brightming/article/details/51106629
2)【深度学习】 Ubuntu16.04 caffe Opencv2.4.13 GPU环境配置:http://blog.csdn.net/sinat_17196995/article/details/53466524
3)Ubuntu 常用软件安装:Matlab + XX-net + ... + TeamViewer + Tensorflow + Caffe
4)caffe安装:http://www.jb51.cc/article/p-hgkqqphr-qh.html
新增参考网址(20180105)
3D - caffe:https://github.com/faustomilletari/3D-Caffe.git
深度学习之常用软件(ubuntu):http://blog.csdn.net/houchaoqun_xmu/article/details/78869052
发表过CVPR-2017的作者的博客:http://zongweiz.leanote.com/post/Install-caffe-in-Ubuntu
cuda-8.0 + cudnn-5.1 的安装步骤请参考这里:OpenCV-3.3.0(Ubuntu-16.06)请参考这里:http://blog.csdn.net/houchaoqun_xmu/article/details/78565
二、GPU版caffe配置过程
1、更新安装必要的软件包,去除不必要的包
- sudoapt-getupdate
- sudoapt-getupgrade
- sudoapt-getinstallbuild-essential
- sudoapt-getautoremove
2、查看系统GPU信息:lspci | grep -i nvidia
- hcq@hcq-To-be-filled-by-O-E-M:~$lspci|grep-invidia
- 01:00.0VGAcompatiblecontroller:NVIDIACorporationGM206[GeForceGTX960](reva1)
- 01:00.1Audiodevice:NVIDIACorporationDevice0fba(reva1)
注:如果当前系统尚未安装NVIDIA驱动,需先进行安装,可参考这里。
3、安装并配置CUDA8.0
1)下载对应版本的CUDA安装包(.deb文件):https://developer.nvidia.com/cuda-downloads
2)cd到文件所在路径,并执行如下命令:
3)sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb
4)sudo apt-get update
5)sudo apt-get install cuda
=== 配置环境变量 ===
1)export PATH=“/usr/local/cuda-8.0/bin:$PATH”
2)export LD_LIBRARY_PATH=”/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH“
3)配置环境变量和动态链接库,在命令行输入【sudo gedit /etc/profile】在文件末尾加入【export PATH = “/usr/local/cuda/bin:$PATH”】,保存后关闭文件。
4)保存之后,创建链接文件,输入【sudo gedit /etc/ld.so.conf.d/cuda.conf】在打开的文件中添加如下语句【/usr/local/cuda/lib64】执行【sudo ldconfig】。
5)查看显卡的驱动版本: cat /proc/driver/nvidia/version
6)查看nvcc编译器的版本: nvcc -V
=== 编译CUDA Sample(可选) ===
2)【cd/usr/local/cuda-8.0/samples/bin/x86_64/linux/release】,然后执行【sudo ./deviceQuery】,出现如下信息,表示成功:
- sudo./deviceQuery
- [sudo]hcq的密码:
- ./deviceQueryStarting...
- CUDADeviceQuery(RuntimeAPI)version(CUDARTstaticlinking)
- Detected1CUDACapabledevice(s)
- Device0:"GeForceGTX960"
- CUDADriverVersion/RuntimeVersion8.0/8.0
- CUDACapabilityMajor/Minorversionnumber:5.2
- Totalamountofglobalmemory:1993MBytes(2090270720bytes)
- (8)Multiprocessors,(128)CUDACores/MP:1024CUDACores
- GPUMaxClockrate:1178MHz(1.18GHz)
- MemoryClockrate:3505Mhz
- MemoryBusWidth:128-bit
- L2CacheSize:1048576bytes
- MaximumTextureDimensionSize(x,y,z)1D=(65536),2D=(65536,65536),3D=(4096,4096,4096)
- MaximumLayered1DTextureSize,(num)layers1D=(16384),2048layers
- MaximumLayered2DTextureSize,(num)layers2D=(16384,16384),2048layers
- Totalamountofconstantmemory:65536bytes
- Totalamountofsharedmemoryperblock:49152bytes
- Totalnumberofregistersavailableperblock:65536
- Warpsize:32
- Maximumnumberofthreadspermultiprocessor:2048
- Maximumnumberofthreadsperblock:1024
- Maxdimensionsizeofathreadblock(x,z):(1024,1024,64)
- Maxdimensionsizeofagridsize(x,z):(2147483647,65535,65535)
- Maximummemorypitch:2147483647bytes
- Texturealignment:512bytes
- Concurrentcopyandkernelexecution:Yeswith2copyengine(s)
- Runtimelimitonkernels:Yes
- IntegratedGPUsharingHostMemory:No
- Supporthostpage-lockedmemorymapping:Yes
- AlignmentrequirementforSurfaces:Yes
- DevicehasECCsupport:Disabled
- DevicesupportsUnifiedAddressing(UVA):Yes
- DevicePCIDomainID/BusID/locationID:0/1/0
- ComputeMode:
- <Default(multiplehostthreadscanuse::cudaSetDevice()withdevicesimultaneously)>
- deviceQuery,CUDADriver=CUDART,CUDADriverVersion=8.0,CUDARuntimeVersion=8.0,NumDevs=1,Device0=GeForceGTX960
- Result=PASS
4、安装Anaconda2
1)到官网下载安装包(此处选择for Linux):https://www.continuum.io/downloads/
2)cd到安装包文件所在的目录下并执行:bash Anaconda2-4.3.1-Linux-x86_64.sh
3)配置环境变量:
== sudo gedit ~/.bashrc
== export PATH="/home/hcq/anaconda2/bin:$PATH"
== source ~/.bashrc5、安装、编译OpenCV3.x
1)sudo git clonehttps://github.com/jayrambhia/Install-OpenCV
2)在Install-OpenCV/Ubuntu目录下:
== 先执行命令:sudo chmod +x *
== 然后执行sudo ./opencv_latest.sh(此过程需要一段时间,最后出现OpenCV 3.2.0 ready to be used表示成功)
3)cd/home/hcq/Install-OpenCV/Ubuntu/OpenCV/opencv-3.2.0
4)sudo mkdirrelease
5)cd release
6)sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
7)sudo make(编译过程需要一段时间,要到100%才算是是成功)
8)sudo make install
===== 配置文件 =====
1)sudo gedit /etc/ld.so.conf.d/opencv.conf #配置相关文件
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
3)source /etc/bash.bashrc
6、安装依赖项
1)安装google-glog:参考这里
== 下载地址:https://pan.baidu.com/s/1slpjjeH
== 将glog‐0.3.3.tar.gz这个文件拷贝到主文件夹下,即/home/yourname 文件夹下,点击鼠标右键,选择提取到此处(也就是解压该文件)解压后在终端输入如下命令:
- cd/home/yourname/glog-0.3.3
- ./configure
- make
- sudomakeinstall
2)安装其他依赖项:
- sudoapt-getinstalllibatlas-base-devlibprotobuf-devlibleveldb-devlibsnappy-devlibopencv-dev
- sudoapt-getinstalllibboost-all-devlibhdf5-serial-devlibgflags-devlibgoogle-glog-devliblmdb-devprotobuf-compiler
3)安装OpenBLAS
- gitclonehttps://github.com/xianyi/OpenBLAS.git
- cdOpenBLAS
- make-j$(($(nproc)+1))
- makeinstall
参考网址:https://github.com/xianyi/OpenBLAS#set-the-number-of-threads-with-environment-variables
注:如果在sudo make runtest 的时候出现错误【libopenblas.so.0: cannot open shared object file: No such file or directory】,第四部分有介绍解决方案。
7、安装其他所需工具(可能导致错误的一些安装,建议读者先跳过本节的安装,遇到问题后再进行安装,印象会比较深刻)
1)conda install libgcc 参考网址:http://www.jb51.cc/article/p-vyhrkbir-yc.html
2)sudo apt install ffmpeg 参考网址:http://f.dataguru.cn/thread-738610-1-1.html
8、安装并配置CUDNN(一定要看好对应的版本!!否则后面一些链接库会出错):https://developer.nvidia.com/rdp/cudnn-download
====================== cudnn-5.1-8.0 ========================
1)切换到安装包所在的目录下:sudo tar xvf cudnn-8.0-linux-x64-v5.1.tgz
2)切换到 cuda/lib64 目录下:sudo cp lib* /usr/local/cuda-8.0/lib64/
3)切换到 cuda/include 目录下:sudo cp *.h /usr/local/cuda-8.0/include/
4)切换到 /usr/local/lib 目录下:sudo chmod +r libcudnn.so.5.1.10 && sudo ln -sf libcudnn.so.5.1.10 libcudnn.so.5 && sudo ln -sf libcudnn.so.5 libcudnn.so && sudo ldconfig
9、下载caffe源码、配置、编译:
=== 下载caffe源码 ===
1)cd到home/hcq/目录,下载caffe源码:sudo git clone https://github.com/BVLC/caffe.git
=== 配置相关文件 ===
1)cd到home/hcq/caffe,复制配置文件:sudo cp Makefile.config.example Makefile.config
2)配置Makefile.config文件:sudo geditMakefile.config,去掉注释并修改的部分如下所示:
- #cuDNNaccelerationswitch(uncommenttobuildwithcuDNN).
- USE_CUDNN:=1
- #Uncommentifyou'reusingOpenCV3
- OPENCV_VERSION:=3
- #openforOpenBlas
- BLAS:=open
- #(whichshouldwork)!
- BLAS_INCLUDE:=/opt/OpenBLAS/include
- BLAS_LIB:=/opt/OpenBLAS/lib
- ANACONDA_HOME:=/home/hcq/anaconda2
- PYTHON_INCLUDE:=$(ANACONDA_HOME)/include\
- $(ANACONDA_HOME)/include/python2.7\
- $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
- PYTHON_LIB:=$(ANACONDA_HOME)/lib
- #Whateverelseyoufindyouneedgoeshere.
- INCLUDE_DIRS:=$(PYTHON_INCLUDE)/usr/local/include/usr/include/hdf5/serial
- LIBRARY_DIRS:=$(PYTHON_LIB)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/usr/lib/x86_64-linux-gnu/hdf5/serial
- #N.B.bothbuildanddistributedirsareclearedon`makeclean`
- BUILD_DIR:=build
- DISTRIBUTE_DIR:=distribute
- #TheIDoftheGPUthat'makeruntest'willusetorununittests.
- TEST_GPUID:=0
- #enableprettybuild(commenttoseefullcommands)
- Q?=@
3)修改Makefile文件:sudo geditMakefile,进行如下修改:
- NVCCFLAGS+=-ccbin=$(CXX)-Xcompiler-fPIC$(COMMON_FLAGS)#这行去掉
- NVCCFLAGS+=-D_FORCE_INLINES-ccbin=$(CXX)-Xcompiler-fPIC$(COMMON_FLAGS)#添加这行
4)进入/usr/lib/x86_64-linux-gnu目录下,执行如下命令(否则会提示:/usr/bin/ld: 找不到 -lhdf5_hl 和 /usr/bin/ld: 找不到 -lhdf5)
- sudolnlibhdf5_serial.so.10.1.0libhdf5.so
- sudolnlibhdf5_serial_hl.so.10.0.2libhdf5_hl.so
- sudoldconfig#使连接生效
5)caffe源码中,python的一些必要安装:
- cd/home/hcq/caffe/python
- forreqin$(catrequirements.txt);dopipinstall$req;done
注:如果需要执行权限问题,就改变caffe文件的执行权限 sudo chown -R 'hcq' xxx
=== 编译caffe(期间遇到问题可以到第四部分查看是否有相关的解决方案)===
1)cd /home/hcq/caffe:进入caffe的根目录下
2)sudo make clean
3)sudo make all -j4 (-j4表示使用4核处理器执行当前指令)
4)sudomake test -j4(最好加上sudo防止有些文件的访问权限不够)
5)sudomake runtest-j4
6)sudo make pycaffe -j4(配置pycaffe)
=== 效果图展示 ===
1)sudo make all 成功后的效果图,如下所示:
2)sudo make runtest 成功后的效果图,如下所示:
- [OK]ArgMaxLayerTest/1.TestcpuMaxVal(1ms)
- [RUN]ArgMaxLayerTest/1.TestSetupMaxVal
- [OK]ArgMaxLayerTest/1.TestSetupMaxVal(1ms)
- [RUN]ArgMaxLayerTest/1.TestSetupAxis
- [OK]ArgMaxLayerTest/1.TestSetupAxis(0ms)
- [RUN]ArgMaxLayerTest/1.TestcpuTopK
- [OK]ArgMaxLayerTest/1.TestcpuTopK(1ms)
- [----------]12testsfromArgMaxLayerTest/1(48mstotal)
- [----------]4testsfromContrastiveLossLayerTest/1,whereTypeParam=caffe::cpuDevice<double>
- [RUN]ContrastiveLossLayerTest/1.TestGradientLegacy
- [OK]ContrastiveLossLayerTest/1.TestGradientLegacy(125ms)
- [RUN]ContrastiveLossLayerTest/1.TestForward
- [OK]ContrastiveLossLayerTest/1.TestForward(0ms)
- [RUN]ContrastiveLossLayerTest/1.TestGradient
- [OK]ContrastiveLossLayerTest/1.TestGradient(136ms)
- [RUN]ContrastiveLossLayerTest/1.TestForwardLegacy
- [OK]ContrastiveLossLayerTest/1.TestForwardLegacy(0ms)
- [----------]4testsfromContrastiveLossLayerTest/1(261mstotal)
- [----------]Globaltestenvironmenttear-down
- [==========]1106testsfrom150testcasesran.(43894mstotal)
- [PASSED]1106tests.
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe$
10、caffe的测试案例:
参考网址:http://caffe.berkeleyvision.org/gathered/examples/mnist.html
1)import caffe,输入如下命令:
== cd /home/hcq/caffe
== python
== import caffe
== 第一次成功后如下所示:
- hcq@ubuntu:~/caffe/python$python
- Python2.7.13|Anacondacustom(64-bit)|(default,Dec202016,23:09:15)
- [GCC4.4.720120313(RedHat4.4.7-1)]onlinux2
- Type"help","copyright","credits"or"license"formoreinformation.
- AnacondaisbroughttoyoubyContinuumAnalytics.
- Pleasecheckout:http://continuum.io/thanksandhttps://anaconda.org
- >>>importcaffe
- /home/hcq/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:280:UserWarning:Matplotlibisbuildingthefontcacheusingfc-list.Thismaytakeamoment.
- 'Matplotlibisbuildingthefontcacheusingfc-list.'
2)MNIST 模型
==cd/home/hcq/caffe(确保当前目录是caffe目录),执行如下命令:
== sudo ./data/mnist/get_mnist.sh
== sudo ./examples/mnist/create_mnist.sh
==sudo./examples/mnist/train_lenet.sh
== 训练完成后如下所示:
- I060113:09:21.12908329215solver.cpp:447]Snapshottingtobinaryprotofileexamples/mnist/lenet_iter_10000.caffemodel
- I060113:09:21.13408929215sgd_solver.cpp:273]Snapshottingsolverstatetobinaryprotofileexamples/mnist/lenet_iter_10000.solverstate
- I060113:09:21.16399029215solver.cpp:310]Iteration10000,loss=0.00275877
- I060113:09:21.16401329215solver.cpp:330]Iteration10000,Testingnet(#0)
- I060113:09:25.22633729217data_layer.cpp:73]Restartingdataprefetchingfromstart.
- I060113:09:25.39416729215solver.cpp:397]Testnetoutput#0:accuracy=0.991
- I060113:09:25.39420929215solver.cpp:397]Testnetoutput#1:loss=0.0280903(*1=0.0280903loss)
- I060113:09:25.39421529215solver.cpp:315]OptimizationDone.
- I060113:09:25.39423429215caffe.cpp:259]OptimizationDone.
3)Cifar-10 模型
== cd /home/hcq/caffe #cd到caffe源码的根目录下
== sudo ./data/cifar10/get_cifar10.sh #该脚本会下载二进制的cifar,并解压,会在/data/cifar10中出现很多batch文件
== sudo ./examples/cifar10/create_cifar10.sh #运行后将会在examples中出现数据集./cifar10_xxx_lmdb和数据集图像均值./mean.binaryproto
注:CIFAR-10的卷积神经网络模型由卷积层,pooling层,ReLU,非线性变换层,局部对比归一化线性分类器组成。该模型定义在CAFFE_ROOT/examples/cifar10/cifar10_quick_train_test.prototxt中。
== sudo./examples/cifar10/train_quick.sh #先以0.001的学习率迭代4000次,再以0.01的学习率接着再迭代1000次,共5000次
注:同理可以训练full模型,full模型比quick模型迭代次数多,一共迭代70000次,前60000次学习率是0.001,中间5000次学习率是0.0001,最后5000次学习率是0.00001。full模型的网络层数也比quick模型多,输入如下命令训练full模型
== sudo./examples/cifar10/train_full.sh
参考网址:
== caffe示例实现之1在CIFAR-10数据集上训练与测试Caffe:http://blog.csdn.net/liumaolincycle/article/details/47258937
== caffe官网:http://caffe.berkeleyvision.org/
训练成功后,提示如下所示,以sudo./examples/cifar10/train_quick.sh为例:
- I060117:15:20.21963532594solver.cpp:237]Trainnetoutput#0:loss=0.550304(*1=0.550304loss)
- I060117:15:20.21964232594sgd_solver.cpp:105]Iteration4700,lr=0.0001
- I060117:16:15.67182332594solver.cpp:218]Iteration4800(1.80336iter/s,55.452s/100iters),loss=0.403176
- I060117:16:15.67189132594solver.cpp:237]Trainnetoutput#0:loss=0.403176(*1=0.403176loss)
- I060117:16:15.67189832594sgd_solver.cpp:105]Iteration4800,lr=0.0001
- I060117:17:10.76178532594solver.cpp:218]Iteration4900(1.81524iter/s,55.089s/100iters),loss=0.466545
- I060117:17:10.76190332594solver.cpp:237]Trainnetoutput#0:loss=0.466545(*1=0.466545loss)
- I060117:17:10.76190732594sgd_solver.cpp:105]Iteration4900,lr=0.0001
- I060117:18:02.53276432595data_layer.cpp:73]Restartingdataprefetchingfromstart.
- I060117:18:04.70677932594solver.cpp:457]SnapshottingtoHDF5fileexamples/cifar10/cifar10_quick_iter_5000.caffemodel.h5
- I060117:18:04.70835332594sgd_solver.cpp:283]SnapshottingsolverstatetoHDF5fileexamples/cifar10/cifar10_quick_iter_5000.solverstate.h5
- I060117:18:04.92949232594solver.cpp:310]Iteration5000,loss=0.451509
- I060117:18:04.92952232594solver.cpp:330]Iteration5000,Testingnet(#0)
- I060117:18:26.00878632597data_layer.cpp:73]Restartingdataprefetchingfromstart.
- I060117:18:26.88809732594solver.cpp:397]Testnetoutput#0:accuracy=0.7575
- I060117:18:26.88812332594solver.cpp:397]Testnetoutput#1:loss=0.737631(*1=0.737631loss)
- I060117:18:26.88814132594solver.cpp:315]OptimizationDone.
- I060117:18:26.88814432594caffe.cpp:259]OptimizationDone.
4)使用训练的模型来分类新数据:
== 确保 sudo make pycaffe 已经编译成功。
== 打开终端,在caffe源码的根目录下,执行如下命令:
- pythonpython/classify.pyexamples/images/cat.jpgfoo#直接用一下别人的模型分类试一下:(默认用的ImageNet的模型)
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe$pythonpython/classify.pyexamples/images/cat.jpgfoo
- cpumode
- WARNING:LoggingbeforeInitGoogleLogging()iswrittentoSTDERR
- W060211:25:53.5616469707_caffe.cpp:139]DEPRECATIONWARNING-deprecateduSEOfPythoninterface
- W060211:25:53.5616989707_caffe.cpp:140]Usethisinstead(withthenamed"weights"parameter):
- W060211:25:53.5617099707_caffe.cpp:142]Net('python/../models/bvlc_reference_caffenet/deploy.prototxt',1,weights='python/../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel')
- Traceback(mostrecentcalllast):
- File"python/classify.py",line138,in<module>
- main(sys.argv)
- File"python/classify.py",line110,inmain
- channel_swap=channel_swap)
- File"/home/hcq/caffe/python/caffe/classifier.py",line26,in__init__
- caffe.Net.__init__(self,model_file,pretrained_file,caffe.TEST)
- RuntimeError:Couldnotopenfilepython/../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
错误原因:
解决方案:
1)cd/home/hcq/caffe/script
2)python download_model_binary.py /home/hcq/caffe/models/bvlc_reference_caffenet
参考网址:http://blog.csdn.net/u011636440/article/details/52441519
- I060211:51:24.16338910753upgrade_proto.cpp:53]AttemptingtoupgradeinputfilespecifiedusingdeprecatedV1LayerParameter:python/../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
- I060211:51:24.36864610753upgrade_proto.cpp:61]SuccessfullyupgradedfilespecifiedusingdeprecatedV1LayerParameter
- I060211:51:24.43614910753net.cpp:744]Ignoringsourcelayerloss
- Traceback(mostrecentcalllast):
- File"python/classify.py",line138,in<module>
- main(sys.argv)
- File"python/classify.py",line110,inmain
- channel_swap=channel_swap)
- File"/home/hcq/caffe/python/caffe/classifier.py",line34,in__init__
- self.transformer.set_mean(in_,mean)
- File"/home/hcq/caffe/python/caffe/io.py",line259,inset_mean
- raiseValueError('Meanshapeincompatiblewithinputshape.')
- ValueError:Meanshapeincompatiblewithinputshape.
解决方案:修改了 ./python/caffe/io.py 文件,如下
将:
- ifms!=self.inputs[in_][1:]:
- raiseValueError('Meanshapeincompatiblewithinputshape.')
修改为:
- ifms!=self.inputs[in_][1:]:
- print(self.inputs[in_])
- in_shape=self.inputs[in_][1:]
- m_min,m_max=mean.min(),mean.max()
- normal_mean=(mean-m_min)/(m_max-m_min)
- mean=resize_image(normal_mean.transpose((1,2,0)),
- in_shape[1:]).transpose((2,0,1))*\
- (m_max-m_min)+m_min
- #raiseValueError('Meanshapeincompatiblewithinputshape.')
参考网址:http://blog.csdn.net/gzljss/article/details/45849013
运行成功后,提示如下所示:
- I060212:00:07.86424810953net.cpp:200]conv1doesnotneedbackwardcomputation.
- I060212:00:07.86425110953net.cpp:200]datadoesnotneedbackwardcomputation.
- I060212:00:07.86425410953net.cpp:242]Thisnetworkproducesoutputprob
- I060212:00:07.86426610953net.cpp:255]Networkinitializationdone.
- I060212:00:07.98715710953upgrade_proto.cpp:44]Attemptingtoupgradeinputfilespecifiedusingdeprecatedtransformationparameters:python/../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
- I060212:00:07.98719010953upgrade_proto.cpp:47]Successfullyupgradedfilespecifiedusingdeprecateddatatransformationparameters.
- W060212:00:07.98719510953upgrade_proto.cpp:49]NotethatfutureCaffereleaseswillonlysupporttransform_parammessagesfortransformationfields.
- I060212:00:07.98719810953upgrade_proto.cpp:53]AttemptingtoupgradeinputfilespecifiedusingdeprecatedV1LayerParameter:python/../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
- I060212:00:08.21731310953upgrade_proto.cpp:61]SuccessfullyupgradedfilespecifiedusingdeprecatedV1LayerParameter
- I060212:00:08.28918610953net.cpp:744]Ignoringsourcelayerloss
- (10,3,227,227)
- Loadingfile:examples/images/cat.jpg
- Classifying1inputs.
- Donein0.43s.
- Savingresultsintofoo
== 使用cifar10_quick_iter_4000.caffemodel.h5模型:
- pythonpython/classify.py--model_defexamples/cifar10/cifar10_quick.prototxt--pretrained_modelexamples/cifar10/cifar10_quick_iter_4000.caffemodel.h5--center_onlyexamples/images/cat.jpgfoo#指定自己的模型进行分类
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe$pythonpython/classify.py--model_defexamples/cifar10/cifar10_quick.prototxt--pretrained_modelexamples/cifar10/cifar10_quick_iter_4000.caffemodel.h5--center_onlyexamples/images/cat.jpgfoo
- cpumode
- WARNING:LoggingbeforeInitGoogleLogging()iswrittentoSTDERR
- W060211:27:22.8577199729_caffe.cpp:139]DEPRECATIONWARNING-deprecateduSEOfPythoninterface
- W060211:27:22.8577569729_caffe.cpp:140]Usethisinstead(withthenamed"weights"parameter):
- W060211:27:22.8577599729_caffe.cpp:142]Net('examples/cifar10/cifar10_quick.prototxt',weights='examples/cifar10/cifar10_quick_iter_4000.caffemodel.h5')
- Traceback(mostrecentcalllast):
- File"python/classify.py",caffe.TEST)
- RuntimeError:Couldnotopenfileexamples/cifar10/cifar10_quick_iter_4000.caffemodel.h5
解决方案:到目录/home/hcq/caffe/examples/cifar10下查看已有的模型,然后把指定的模型换成已有的模型,已有的模型如下所示(因人而异):
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe/examples/cifar10$ls-lrt
- 总用量6788
- -rwxrwxr-x1hcqhcq3385月2711:55train_quick.sh
- -rwxrwxr-x1hcqhcq1395月2711:55train_full_sigmoid.sh
- -rwxrwxr-x1hcqhcq1425月2711:55train_full_sigmoid_bn.sh
- -rwxrwxr-x1hcqhcq5245月2711:55train_full.sh
- -rw-rw-r--1hcqhcq52435月2711:55readme.md
- -rwxrwxr-x1hcqhcq4675月2711:55create_cifar10.sh
- -rw-rw-r--1hcqhcq36775月2711:55convert_cifar_data.cpp
- -rw-rw-r--1hcqhcq19215月2711:55cifar10_quick.prototxt
- -rw-rw-r--1hcqhcq31225月2711:55cifar10_full_train_test.prototxt
- -rw-rw-r--1hcqhcq28795月2711:55cifar10_full_sigmoid_train_test.prototxt
- -rw-rw-r--1hcqhcq31925月2711:55cifar10_full_sigmoid_train_test_bn.prototxt
- -rw-rw-r--1hcqhcq21745月2711:55cifar10_full.prototxt
- drwxr--r--2hcqroot40966月115:38cifar10_train_lmdb
- drwxr--r--2hcqroot40966月115:38cifar10_test_lmdb
- -rw-r--r--1hcqroot122996月115:38mean.binaryproto
- -rw-rw-r--1hcqhcq30886月115:39cifar10_quick_train_test.prototxt
- -rw-rw-r--1hcqhcq8596月116:25cifar10_quick_solver.prototxt
- -rw-rw-r--1hcqhcq9446月116:25cifar10_full_solver_lr1.prototxt
- -rw-rw-r--1hcqhcq8826月116:26cifar10_quick_solver_lr1.prototxt
- -rw-rw-r--1hcqhcq9446月116:26cifar10_full_solver.prototxt
- -rw-rw-r--1hcqhcq9596月116:26cifar10_full_sigmoid_solver_bn.prototxt
- -rw-rw-r--1hcqhcq9536月116:26cifar10_full_sigmoid_solver.prototxt
- -rw-rw-r--1hcqhcq9456月116:26cifar10_full_solver_lr2.prototxt
- -rw-r--r--1hcqroot3660486月201:37cifar10_full_iter_10000.solverstate.h5
- -rw-r--r--1hcqroot3757526月201:37cifar10_full_iter_10000.caffemodel.h5
- -rw-r--r--1hcqroot3660486月202:34cifar10_full_iter_20000.solverstate.h5
- -rw-r--r--1hcqroot3757526月202:34cifar10_full_iter_20000.caffemodel.h5
- -rw-r--r--1hcqroot3660486月203:30cifar10_full_iter_30000.solverstate.h5
- -rw-r--r--1hcqroot3757526月203:30cifar10_full_iter_30000.caffemodel.h5
- -rw-r--r--1hcqroot3660486月204:27cifar10_full_iter_40000.solverstate.h5
- -rw-r--r--1hcqroot3757526月204:27cifar10_full_iter_40000.caffemodel.h5
- -rw-r--r--1hcqroot3660486月205:24cifar10_full_iter_50000.solverstate.h5
- -rw-r--r--1hcqroot3757526月205:24cifar10_full_iter_50000.caffemodel.h5
- -rw-r--r--1hcqroot3660486月206:21cifar10_full_iter_60000.solverstate.h5
- -rw-r--r--1hcqroot3757526月206:21cifar10_full_iter_60000.caffemodel.h5
- -rw-r--r--1hcqroot5824966月216:40cifar10_quick_iter_4000.solverstate
- -rw-r--r--1hcqroot5833016月216:40cifar10_quick_iter_4000.caffemodel
- -rw-r--r--1hcqroot5900646月216:44cifar10_quick_iter_5000.solverstate.h5
- -rw-r--r--1hcqroot6000326月216:44cifar10_quick_iter_5000.caffemodel.h5
== 选择【cifar10_quick_iter_5000.caffemodel.h5】作为指定模型,再次运行如下命令:
- pythonpython/classify.py--model_defexamples/cifar10/cifar10_quick.prototxt--pretrained_modelexamples/cifar10/cifar10_quick_iter_5000.caffemodel.h5--center_onlyexamples/images/cat.jpgfoo
- cpumode
- WARNING:LoggingbeforeInitGoogleLogging()iswrittentoSTDERR
- W060216:48:24.26168312766_caffe.cpp:139]DEPRECATIONWARNING-deprecateduSEOfPythoninterface
- W060216:48:24.26173212766_caffe.cpp:140]Usethisinstead(withthenamed"weights"parameter):
- W060216:48:24.26173512766_caffe.cpp:142]Net('examples/cifar10/cifar10_quick.prototxt',1,weights='examples/cifar10/cifar10_quick_iter_5000.caffemodel.h5')
- I060216:48:24.26283012766net.cpp:51]Initializingnetfromparameters:
- name:"CIFAR10_quick_test"
- state{
- phase:TEST
- level:0
- }
- layer{
- ...
- ...
- I060216:48:24.26377412766net.cpp:242]Thisnetworkproducesoutputprob
- I060216:48:24.26378212766net.cpp:255]Networkinitializationdone.
- I060216:48:24.26453912766net.cpp:798]Ignoringsourcelayercifar
- I060216:48:24.26462712766hdf5.cpp:32]Datatypeclass:H5T_FLOAT
- I060216:48:24.26504812766net.cpp:798]Ignoringsourcelayerloss
- (1,3,32,32)
- Loadingfile:examples/images/cat.jpg
- Classifying1inputs.
- Donein0.03s.
- Savingresultsintofoo
注:默认的classify脚本不会直接输出结果,而是会把结果输入到foo文件里,不太直观,网上有一个修改版,添加了一些参数,可以输出概率最高的分类。
替换Python/classify.py,下载地址:
这个脚本添加了两个参数,可以指定labels_file,然后可以直接把分类结果输出出来:
- pythonpython/classify.py--print_results--model_defexamples/cifar10/cifar10_quick.prototxt--pretrained_modelexamples/cifar10/cifar10_quick_iter_5000.caffemodel.h5--labels_filedata/cifar10/cifar10_words.txt--center_onlyexamples/images/cat.jpgfoo
Caffe学习资料:
1、Classification: Instant Recognition with Caffe:http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb
三、cpu版caffe环境配置过程
1、cpu和GPU版本的一些区别:
1)cpu版本的话,不需要NVIDIA驱动,不需要安装CUDA,不需要配置CUDNN
2)caffe目录下的Makefile.configure配置不一样
3)配置模型的时候,solver_mode: cpu,变成cpu(如果没改的话会报错),如下所示:
2、cpu版本的Makefile.configure配置,未注释掉的部分,如下所示:
- #cpu-onlyswitch(uncommenttobuildwithoutGPUsupport).
- cpu_ONLY:=1
- #Uncommentifyou'reusingOpenCV3
- OPENCV_VERSION:=3
- #openforOpenBlas
- BLAS:=open
- #(whichshouldwork)!
- BLAS_INCLUDE:=/opt/OpenBLAS/include
- BLAS_LIB:=/opt/OpenBLAS/lib
- ANACONDA_HOME:=/home/hcq/anaconda2
- PYTHON_INCLUDE:=$(ANACONDA_HOME)/include\
- $(ANACONDA_HOME)/include/python2.7\
- $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
- PYTHON_LIB:=$(ANACONDA_HOME)/lib
- #Whateverelseyoufindyouneedgoeshere.
- INCLUDE_DIRS:=$(PYTHON_INCLUDE)/usr/local/include/usr/include/hdf5/serial
- LIBRARY_DIRS:=$(PYTHON_LIB)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/usr/lib/x86_64-linux-gnu/hdf5/serial
- #N.B.bothbuildanddistributedirsareclearedon`makeclean`
- BUILD_DIR:=build
- DISTRIBUTE_DIR:=distribute
- #TheIDoftheGPUthat'makeruntest'willusetorununittests.
- TEST_GPUID:=0
- #enableprettybuild(commenttoseefullcommands)
- Q?=@
3、测试案例跟GPU的类似,只不过需要把solver_mode: cpu改为cpu。
四、问题集锦
1、sudo make all 编译过程遇到的错误,【conda install libgcc】安装libgcc即可,错误提示如下所示:
- /usr/local/lib/libglog.so:对‘std::__cxx11::basic_ostringstream<char,std::char_traits<char>,std::allocator<char>>::~basic_ostringstream()@GLIBCXX_3.4.21’未定义的引用
- /usr/lib/x86_64-linux-gnu/libgflags.so:对‘std::__cxx11::basic_string<char,std::allocator<char>>::find(charconst*,unsignedlong,unsignedlong)const@GLIBCXX_3.4.21’未定义的引用
- .build_release/lib/libcaffe.so:对‘std::out_of_range::out_of_range(std::__cxx11::basic_string<char,std::allocator<char>>const&)’未定义的引用
- .build_release/lib/libcaffe.so:对‘std::__cxx11::basic_string<char,std::allocator<char>>::_M_replace_aux(unsignedlong,char)’未定义的引用
- /usr/local/lib/libopencv_core.so:对‘std::basic_istream<char,std::char_traits<char>>&std::getline<char,std::allocator<char>>(std::basic_istream<char,std::char_traits<char>>&,std::__cxx11::basic_string<char,std::allocator<char>>&,char)@GLIBCXX_3.4.21’未定义的引用
- .build_release/lib/libcaffe.so:对‘std::__cxx11::basic_string<char,std::allocator<char>>::compare(unsignedlong,charconst*)const’未定义的引用
- /usr/lib/x86_64-linux-gnu/libprotobuf.so:对‘std::__cxx11::basic_string<char,std::allocator<char>>::swap(std::__cxx11::basic_string<char,std::allocator<char>>&)@GLIBCXX_3.4.21’未定义的引用
- /usr/local/lib/libglog.so:对‘vtableforstd::__cxx11::basic_stringbuf<char,std::allocator<char>>@GLIBCXX_3.4.21’未定义的引用
- /usr/local/lib/libopencv_core.so:对‘std::__cxx11::basic_stringbuf<char,std::allocator<char>>::str()const@GLIBCXX_3.4.21’未定义的引用
- collect2:error:ldreturned1exitstatus
- Makefile:629:recipefortarget'.build_release/tools/upgrade_solver_proto_text.bin'Failed
- make:***[.build_release/tools/upgrade_solver_proto_text.bin]Error1
或者如下所示:
- AR-o.build_release/lib/libcaffe.a
- LD-o.build_release/lib/libcaffe.so.1.0.0
- CXX/LD-o.build_release/tools/upgrade_solver_proto_text.bin
- CXX/LD-o.build_release/tools/test_net.bin
- CXX/LD-o.build_release/tools/upgrade_net_proto_text.bin
- CXX/LD-o.build_release/tools/finetune_net.bin
- .build_release/tools/test_net.o:Infunction`boost::system::system_error::what()const':
- test_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0x74):undefinedreferenceto`std::__cxx11::basic_string<char,std::allocator<char>>::_M_replace(unsignedlong,charconst*,unsignedlong)'
- test_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xa1):undefinedreferenceto`std::__cxx11::basic_string<char,std::allocator<char>>::_M_append(charconst*,unsignedlong)'
- test_net.cpp:(.text._ZNK5boost6system12system_error4whatEv[_ZNK5boost6system12system_error4whatEv]+0xe3):undefinedreferenceto`std::__cxx11::basic_string<char,unsignedlong)'
- /usr/local/lib/libglog.so:undefinedreferenceto`std::__cxx11::basic_string<char,std::allocator<char>>::_M_create(unsignedlong&,unsignedlong)@GLIBCXX_3.4.21'
- /usr/local/lib/libglog.so:undefinedreferenceto`std::__cxx11::basic_string<char,char)@GLIBCXX_3.4.21'
- ...
- ...
- ...
- .build_release/lib/libcaffe.so:undefinedreferenceto`std::out_of_range::out_of_range(std::__cxx11::basic_string<char,std::allocator<char>>const&)'
- .build_release/lib/libcaffe.so:undefinedreferenceto`std::__cxx11::basic_string<char,char)'
- /usr/local/lib/libopencv_core.so:undefinedreferenceto`std::basic_istream<char,char)@GLIBCXX_3.4.21'
- .build_release/lib/libcaffe.so:undefinedreferenceto`std::__cxx11::basic_string<char,charconst*)const'
- /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libprotobuf.so:undefinedreferenceto`std::__cxx11::basic_string<char,std::allocator<char>>&)@GLIBCXX_3.4.21'
- /usr/local/lib/libglog.so:undefinedreferenceto`vtableforstd::__cxx11::basic_stringbuf<char,std::allocator<char>>@GLIBCXX_3.4.21'
- /usr/local/lib/libopencv_core.so:undefinedreferenceto`std::__cxx11::basic_stringbuf<char,std::allocator<char>>::str()const@GLIBCXX_3.4.21'
- collect2:error:ldreturned1exitstatus
- Makefile:629:recipefortarget'.build_release/tools/upgrade_net_proto_text.bin'Failed
- make:***[.build_release/tools/upgrade_net_proto_text.bin]Error1
2、sudo make runtest 时遇到的错误,【sudo apt install ffmpeg】安装ffmpeg即可,错误提示如下所示:
- hcq@ubuntu:~/caffe$sudomakeruntest
- .build_release/tools/caffe
- .build_release/tools/caffe:errorwhileloadingsharedlibraries:libopencv_core.so.3.2:cannotopensharedobjectfile:Nosuchfileordirectory
- Makefile:538:recipefortarget'runtest'Failed
- make:***[runtest]Error127
3、sudo make runtest 时遇到的错误,缺失一些相关的so链接:
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe$sudomakeruntest-j4
- .build_release/tools/caffe
- .build_release/tools/caffe:errorwhileloadingsharedlibraries:libhdf5_hl.so.10:cannotopensharedobjectfile:Nosuchfileordirectory
- Makefile:536:recipefortarget'runtest'Failed
- make:***[runtest]Error127
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe$sudomakeruntest-j4
- .build_release/tools/caffe
- .build_release/tools/caffe:errorwhileloadingsharedlibraries:libhdf5.so.10:cannotopensharedobjectfile:Nosuchfileordirectory
- Makefile:536:recipefortarget'runtest'Failed
- make:***[runtest]Error127
原因:目录/usr/lib/x86_64-linux-gnu下确实是找不到【libhdf5_hl.so.10】和【libhdf5.so.10】这两个文件,如下图所示:
- sudolnlibhdf5_serial_hl.so.10libhdf5_hl.so.10
- sudolnlibhdf5_serial.so.10libhdf5.so.10
- NVCCsrc/caffe/layers/mvn_layer.cu
- nvccwarning:The'compute_20','sm_20',and'sm_21'architecturesaredeprecated,andmayberemovedinafuturerelease(Use-Wno-deprecated-gpu-targetstosuppresswarning).
- nvccwarning:The'compute_20',andmayberemovedinafuturerelease(Use-Wno-deprecated-gpu-targetstosuppresswarning).
- NVCCsrc/caffe/layers/filter_layer.cu
- nvccwarning:The'compute_20',andmayberemovedinafuturerelease(Use-Wno-deprecated-gpu-targetstosuppresswarning).
- nvccwarning:The'compute_20',andmayberemovedinafuturerelease(Use-Wno-deprecated-gpu-targetstosuppresswarning).
- F060110:03:16.68394028607cudnn.hpp:122]CheckFailed:status==CUDNN_STATUS_SUCCESS(3vs.0)CUDNN_STATUS_BAD_PARAM
- ***Checkfailurestacktrace:***
- @0x7f52e7de2e3dgoogle::LogMessage::Fail()
- @0x7f52e7de4bc0google::LogMessage::SendToLog()
- @0x7f52e7de2a23google::LogMessage::Flush()
- @0x7f52e7de558egoogle::LogMessageFatal::~LogMessageFatal()
- @0x7f52e313c5f8caffe::CuDNNConvolutionLayer<>::Reshape()
- @0x7f52e325ed37caffe::Net<>::Init()
- @0x7f52e326146ecaffe::Net<>::Net()
- @0x888f2ccaffe::NetTest<>::InitNetFromProtoString()
- @0x88e1d1caffe::NetTest_TestReshape_Test<>::TestBody()
- @0x91e4b3testing::internal::HandleExceptionsInMethodIfSupported<>()
- @0x917acatesting::Test::Run()
- @0x917c18testing::TestInfo::Run()
- @0x917cf5testing::TestCase::Run()
- @0x918fcftesting::internal::UnitTestImpl::RunAllTests()
- @0x9192f3testing::UnitTest::Run()
- @0x46d44dmain
- @0x7f52e2443830(unknown)
- @0x474f69_start
- Makefile:536:recipefortarget'runtest'Failed
- make:***[runtest]已放弃(coredumped)
原因:初步断定是NVIDIA的显存不够,本文所使用的机器是GeForce GTX 960 2GB的显存。本人做了如下探究:
1)据同学介绍,他使用的机器显存有8GB,就不会出现这样的问题。
2)本人还尝试使用cpu( 物理内存8GB )运行sudo make runtest -j4,也不会出现这样的问题。
解决方案:
2)改用cpu跑程序,不过最后使用GPU的话还是需要使用好一点的设备(显卡、显卡)
参考网址:http://www.cnblogs.com/penguinliong/p/6351215.html
6、build_release/tools/caffe: error while loading shared libraries: libopenblas.so.0: cannot open shared object file: No such file or directory
描述:Makefile.configure配置好了,相应的引用位置也有libopenblas.so.0 该文件,make runtest的时候仍然出错。
解决方案:将openblas 的库所在位置添加到系统环境变量 LD_LIBRARY_PATH,export LD_LIBRARY_PATH=/opt/OpenBLAS/lib/ sudo ldconfig。打开终端,输入如下命令:
1)export LD_LIBRARY_PATH=/opt/OpenBLAS/lib/
2)sudo ldconfig
参考网址:
1)http://www.jb51.cc/article/p-hgkqqphr-qh.html
2)http://www.jb51.cc/article/p-mxwdsawn-ek.html
3)https://github.com/sermanet/OverFeat/issues/10
配置成功后的提示如下所示:
- [OK]ArgMaxLayerTest/1.TestcpuMaxVal(1ms)
- [RUN]ArgMaxLayerTest/1.TestSetupMaxVal
- [OK]ArgMaxLayerTest/1.TestSetupMaxVal(1ms)
- [RUN]ArgMaxLayerTest/1.TestSetupAxis
- [OK]ArgMaxLayerTest/1.TestSetupAxis(0ms)
- [RUN]ArgMaxLayerTest/1.TestcpuTopK
- [OK]ArgMaxLayerTest/1.TestcpuTopK(1ms)
- [----------]12testsfromArgMaxLayerTest/1(48mstotal)
- [----------]4testsfromContrastiveLossLayerTest/1,whereTypeParam=caffe::cpuDevice<double>
- [RUN]ContrastiveLossLayerTest/1.TestGradientLegacy
- [OK]ContrastiveLossLayerTest/1.TestGradientLegacy(125ms)
- [RUN]ContrastiveLossLayerTest/1.TestForward
- [OK]ContrastiveLossLayerTest/1.TestForward(0ms)
- [RUN]ContrastiveLossLayerTest/1.TestGradient
- [OK]ContrastiveLossLayerTest/1.TestGradient(136ms)
- [RUN]ContrastiveLossLayerTest/1.TestForwardLegacy
- [OK]ContrastiveLossLayerTest/1.TestForwardLegacy(0ms)
- [----------]4testsfromContrastiveLossLayerTest/1(261mstotal)
- [----------]Globaltestenvironmenttear-down
- [==========]1106testsfrom150testcasesran.(43894mstotal)
- [PASSED]1106tests.
- hcq@hcq-To-be-filled-by-O-E-M:~/caffe$
7、Check Failed: fd != -1 (-1 vs. -1) File not found: examples/cifar10/cifar10_full_iter_60000.solverstate
描述:执行【sudo./examples/cifar10/train_full.sh】报错。
解决方案:
相似问题:Check Failed: fd != -1 (-1 vs. -1) File not found: deploy.prototxt
原因:因为没有把deploy.prototxt文件复制到demo下。
解决方案:把caffe/models/bvlc_reference_caffnnet/deploy.prototxt复制到demo下即可。
参考网址:http://www.jb51.cc/article/p-fwfghnpr-qq.html
8、error while loading shared libraries: libhdf5_hl.so.100
- build_release/tools/caffe:errorwhileloadingsharedlibraries:libhdf5_hl.so.100:cannotopensharedobjectfile:Nosuchfileordirectory
- Makefile:470:recipefortarget'runtest'Failed
9、Makefile:567: recipe for target '.build_release/examples/cifar10/convert_cifar_data.bin' Failed
- Makefile:567:recipefortarget'.build_release/examples/mnist/convert_mnist_data.bin'Failed
- make:***[.build_release/examples/mnist/convert_mnist_data.bin]Error1
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadRGBAStrip@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFIsTiled@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFWriteScanline@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFGetField@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFScanlineSize@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadEncodedTile@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadRGBATile@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFClose@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFRGBAImageOK@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFOpen@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadEncodedStrip@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFSetField@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFSetWarningHandler@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFSetErrorHandler@LIBTIFF_4.0'
- collect2:error:ldreturned1exitstatus
- Makefile:567:recipefortarget'.build_release/examples/cifar10/convert_cifar_data.bin'Failed
- make:***[.build_release/examples/cifar10/convert_cifar_data.bin]Error1
9、Ubuntu 16.04中使用Matlab R2016b编译Caffe接口出错的解决方法
- MEX-file'caffe/matlab/+caffe/private/caffe_.mexa64'无效:
- caffe/matlab/+caffe/private/caffe_.mexa64:undefined
- symbol:_ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE。
- 出错caffe.set_mode_cpu(line5)
- caffe_('set_mode_cpu');
- 出错caffe.run_tests(line6)
- caffe.set_mode_cpu();
10、gcc 降级后的问题
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFGetField@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFScanlineSize@LIBTIFF_4.0'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptorconst*,int)'
- .build_release/lib/libcaffe.so:undefinedreferenceto`cv::imread(std::stringconst&,int)'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadEncodedTile@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadRGBATile@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFClose@LIBTIFF_4.0'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::DescriptorPool::FindFileByName(std::stringconst&)const'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFRGBAImageOK@LIBTIFF_4.0'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*,std::string*)'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFOpen@LIBTIFF_4.0'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::MessageFactory::InternalRegisterGeneratedFile(charconst*,void(*)(std::stringconst&))'
- .build_release/lib/libcaffe.so:undefinedreferenceto`leveldb::DB::Open(leveldb::Optionsconst&,std::stringconst&,leveldb::DB**)'
- .build_release/lib/libcaffe.so:undefinedreferenceto`cv::imencode(std::stringconst&,cv::_InputArrayconst&,std::vector<unsignedchar,std::allocator<unsignedchar>>&,std::vector<int,std::allocator<int>>const&)'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFReadEncodedStrip@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFSetField@LIBTIFF_4.0'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::internal::StringTypeHandlerBase::New()'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int,google::protobuf::io::CodedOutputStream*)'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFSetWarningHandler@LIBTIFF_4.0'
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so:undefinedreferenceto`TIFFSetErrorHandler@LIBTIFF_4.0'
- .build_release/lib/libcaffe.so:undefinedreferenceto`leveldb::Status::ToString()const'
- .build_release/lib/libcaffe.so:undefinedreferenceto`google::protobuf::internal::WireFormatLite::WriteString(int,google::protobuf::io::CodedOutputStream*)'
- collect2:error:ldreturned1exitstatus
- Makefile:567:recipefortarget'.build_release/examples/cifar10/convert_cifar_data.bin'Failed
- make:***[.build_release/examples/cifar10/convert_cifar_data.bin]Error1
reference: http://www.jb51.cc/article/p-vyhrkbir-yc.html
其他相关的参考网址:
1、解决/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found问题:http://www.jb51.cc/article/p-dncvgnde-ey.html
2、Caffe搭建:常见问题解决办法和ubuntu使用中遇到问题(持续更新):http://www.cnblogs.com/empty16/p/4828476.html
3、安装python caffe过程中遇到的一些问题以及对应的解决方案:http://www.cnblogs.com/TiBAi/p/6848307.html
4、安装caffe总结:http://blog.csdn.net/csoldiers/article/details/51685179
5、caffe+cuda7.0+opencv3.0.0+mkl ubuntu14.04配置:http://www.th7.cn/system/lin/201504/103304.shtml
6、Caffe 环境搭建中应注意的问题:http://www.jb51.cc/article/p-evvodmjx-gt.html
7、caffe cpu版 Anaconda3 python 接口安装:http://www.jb51.cc/article/p-xoksgxry-bcx.html