【神经网络与深度学习】转-caffe安装吐血总结
这周安装了caffe的windows版本和Linux版本,依赖关系太多,如果系统选对了,安装起来很easy,选错了,就会遇见各种坑。
1.操作系统最好使用ubuntu desktop 14.04 64位。
我试用的操作系统版本比较多,以下介绍一下操作系统的坑:
ubuntu server 14.04 64位,部分u盘启动工具不支持,安装一半会报错找不到cdrom。
ubuntu server 15.10 64位,gcc版本太高,编译OpenCV时调用cudnn时有问题,替换低版本无效,未查到原因。
ubuntu server 16.04 64位,cudnn没有相应版本,编译cudnn是报错。
opensuse,下载依赖库很麻烦,很多依赖库都没有,建议不要使用。
2.本人一直是做服务器开发,习惯了命令行(这也是一开始选择server版本遇到各种坑的原因),而且桌面占用资源太多,所以要关闭ubuntu desktop。
其中有一点说的是ctrl+alt+f2,桌面可以和命令行转换,在我安装的版本无效,没查到原因。
要想彻底关闭,可以采用了如下方法:
sudo vim /etc/default/grub
找到这一行:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
改为:GRUB_CMDLINE_LINUX_DEFAULT="text "或者"quiet splash text"
保存后sudo update-grub 重启即可。
3.显卡驱动,cuda安装
个人使用的是显卡GTX1080,显卡驱动及cuda需要在文本模式下操作,否则会安装失败。
使用cuda7.5在make runtest时报错
3.1.对应显卡驱动安装
http://www.nvidia.cn/Download/index.aspx?lang=cn下载
3.2.cuda安装
如果有老的先卸载
在路径:
/usr/local/cuda-6.5/bin
有CUDA自带的卸载工具uninstall_cuda_toolkit_6.5.pl,使用命令:
sudo ./uninstall_cuda_toolkit_6.5.pl
然后别忘了卸载cuda samples.也是在/usr/local文件夹下。
安装很简单,执行cuda_8.0.27_linux-run,驱动不安装,因为已经安装过了。
in/x86_64/linux/release/deviceQuery,检测是否安装成功
3.3cudnn安装
tar xvf cudnn*.tgzcd cuda
sudo cp */*.h /usr/local/cuda/include/
sudo cp */libcudnn* /usr/local/cuda/lib64/sudo
chmod a+r /usr/local/cuda/lib64/libcudnn*
3.剩下的就按caffe官网安装caffe的方法安装就行了,一路顺畅。
顺便提醒一下,caffe没有说要安装opencv,这个是需要安装的,可以在所以安装完毕后,安装opencv。
4.opencv安装,
4.1ffmpeg:
sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
sudo apt-get update
sudo apt-get install ffmpeg
4.2 No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so', needed by `lib/libopencv_core.so.2.4.11'. Stop.
解决方法,删除旧的,然后,重新定向
ln -s /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/libGL.so.1
4.3make j导致电脑死机
改用make,而不适用make j
4.4以上就是OpenCV安装全过程,安装过程中可能碰到一些问题,例举一些。
在编译的过程中可能会碰到找不到Qt5文件的情况,只是一个警告可以不理,如果有强迫症的同学可以安装一下Qt5
<code class="hljs objectivec" style="display: block; padding: 0.5em; color: rgb(0, 0, 0); background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><span class="hljs-built_in" style="color: rgb(102, 0, 102);">CMake</span> Warning at cmake/OpenCVFindLibsGUI.cmake:<span class="hljs-number" style="color: rgb(0, 102, 102);">18</span> (find_package):
By not providing <span class="hljs-string" style="color: rgb(0, 136, 0);">"FindQt5Core.cmake"</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136);">in</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102);">CMAKE_MODULE_PATH</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136);">this</span> project has
asked <span class="hljs-built_in" style="color: rgb(102, 0, 102);">CMake</span> to find a package configuration file provided by <span class="hljs-string" style="color: rgb(0, 136, 0);">"Qt5Core"</span>, but
<span class="hljs-built_in" style="color: rgb(102, 0, 102);">CMake</span> did not find one.</code>
另一个是ICV hash校验值不符的问题
<code class="hljs groovy" style="display: block; padding: 0.5em; color: rgb(0, 0, 0); background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">CMake Warning at <span class="hljs-number" style="color: rgb(0, 102, 102);">3</span>rdparty<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/ippicv/</span>downloader.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">54</span> (message):
<span class="hljs-symbol" style="color: rgb(0, 102, 102);"> ICV:</span> Local copy of ICV <span class="hljs-keyword" style="color: rgb(0, 0, 136);">package</span> has invalid MD5 <span class="hljs-string" style="color: rgb(0, 136, 0);">hash:</span>
<span class="hljs-number" style="color: rgb(0, 102, 102);">0103</span>b909e19ca9c6497a7ae696c16480 (<span class="hljs-string" style="color: rgb(0, 136, 0);">expected:</span>
<span class="hljs-number" style="color: rgb(0, 102, 102);">8</span>b449a536a2157bcad08a2b9f266828b)
Call Stack (most recent call first):
<span class="hljs-number" style="color: rgb(0, 102, 102);">3</span>rdparty<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/ippicv/</span>downloader.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">108</span> (_icv_downloader)
cmake/OpenCVFindIPP.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">235</span> (include)
cmake/OpenCVFindLibsPerf.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">12</span> (include)
CMakeLists.<span class="hljs-string" style="color: rgb(0, 136, 0);">txt:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">526</span> (include) -- <span class="hljs-string" style="color: rgb(0, 136, 0);">ICV:</span> Downloading ippicv_linux_20141027.tgz...
CMake Error at <span class="hljs-number" style="color: rgb(0, 102, 102);">3</span>rdparty<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/ippicv/</span>downloader.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">71</span> (file):
file DOWNLOAD HASH mismatch <span class="hljs-keyword" style="color: rgb(0, 0, 136);">for</span> <span class="hljs-string" style="color: rgb(0, 136, 0);">file:</span> [<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/home/</span>jason<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/program/</span>opencv<span class="hljs-number" style="color: rgb(0, 102, 102);">-3.0</span><span class="hljs-number" style="color: rgb(0, 102, 102);">.0</span><span class="hljs-regexp" style="color: rgb(0, 136, 0);">/3rdparty/</span>ippicv<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/downloads/</span>linux<span class="hljs-number" style="color: rgb(0, 102, 102);">-8</span>b449a536a2157bcad08a2b9f266828b/ippicv_linux_20141027.tgz]
expected <span class="hljs-string" style="color: rgb(0, 136, 0);">hash:</span> [<span class="hljs-number" style="color: rgb(0, 102, 102);">8</span>b449a536a2157bcad08a2b9f266828b]
actual <span class="hljs-string" style="color: rgb(0, 136, 0);">hash:</span> [<span class="hljs-number" style="color: rgb(0, 102, 102);">0103</span>b909e19ca9c6497a7ae696c16480] Call Stack (most recent call first):
<span class="hljs-number" style="color: rgb(0, 102, 102);">3</span>rdparty<span class="hljs-regexp" style="color: rgb(0, 136, 0);">/ippicv/</span>downloader.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">108</span> (_icv_downloader)
cmake/OpenCVFindIPP.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">235</span> (include)
cmake/OpenCVFindLibsPerf.<span class="hljs-string" style="color: rgb(0, 136, 0);">cmake:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">12</span> (include)
CMakeLists.<span class="hljs-string" style="color: rgb(0, 136, 0);">txt:</span><span class="hljs-number" style="color: rgb(0, 102, 102);">526</span> (include)</code>
之后查了很多资料也没有发现也不知道该怎么解决,后来去查了一下代码,发现这个是下载ippicv_linux_20141027.tgz时的校验和不符,查看了配置文件,发现可以自行从http://sourceforge.NET/projects/opencvlibrary/files/3rdparty/ippicv这里下载,奇怪的是编译时从这里下载的文件和自己下载的文件校验值居然不一样,也真是神奇,将下载的文件
~/opencv-3.0.0/3rdparty/ippicv/downloads/linux-8b449a536a2157bcad08a2b9f266828b ,代替原来的同名文件,ok问题解决。
另外对与cuda8.0,opencv3.0或者2.4.10都会报如下错误,使用opencv2.4.13就没有问题。(唯一一个2016年发布的版本)
Ubuntu/3.0/OpenCV/opencv-3.0.0/modules/cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppState, Npp8u* pDeviceMem);
5.建议安装Anaconda包,这个包能独立于系统自带的Python库,并且提供大部分Caffe需要的科学运算Python库。这里需要注意,在运行Caffe时,可能会报一些找不到libxxx.so的错误,而用
locate libxxx.so命令发现已经安装在anaconda中,这时首先想到的是在/etc/ld.so.conf.d/ 下面将 $your_anaconda_path/lib 加入 LD_LIBRARY_PATH中。 但是这样做可能导致登出后无法再进入桌面!!!原因(猜测)可能是anaconda的lib中有些内容于系统自带的lib产生冲突。
正确的做法是:为了不让系统在启动时就将anaconda/lib加入系统库目录,可以在用户自己的~/.bashrc 中添加library path, 比如我就在最后添加了两行
# add library path
LD_LIBRARY_PATH=your_anaconda_path/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
安装anaconda后再安装opencv会有警告
anaconda2/lib/libcurl.so.4: no version information available
此事需要先屏蔽掉以上环境变量,等编译通过以后再放开。
6.caffe编译
首先按个人需求修改Makefile.config配置文件
make runtest报错
error while loading shared libraries: libcudart.so.8.0
在bashrc中添加如下环境变量即可:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/
make时出现的问题:
(1).build_release/lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
设置环境变量:LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH,将/usr/lib/x86_64-linux-gnu/放在最前面
(2)/cudnn.hpp:8:34: fatal error: caffe/proto/caffe.pb.h: No such file or directory
make all -j8有问题,make all没问题。可能是多核编译的问题。
win7上安装,就直接按github上的说明安装,vs一定要用2013.这个我学乖了,所有版本按说明来,安装很顺畅。
win注意点:1.GPU模式下,cuda对显卡的加速能力有要求,cudnn需要加速能力3.0以上,具体要求没找到。我的显卡不太高端,所以我把cudnn禁用了。
2.cuda的在comm中的默认配置加速能力是最低3_5,如果显卡性能达不到,需要修改,我的是3.4M的显卡,所以我改成了3_0。
【神经网络与深度学习】转-caffe安装吐血总结的更多相关文章
- 深度学习框架-caffe安装-环境[Mac OSX 10.12]
深度学习框架-caffe安装 [Mac OSX 10.12] [参考资源] 1.英文原文:(使用GPU) [http://hoondy.com/2015/04/03/how-to-install-ca ...
- 深度学习框架-caffe安装-Mac OSX 10.12
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px ".PingFang SC"; color: #454545 } p.p2 ...
- 【神经网络与深度学习】Caffe部署中的几个train-test-solver-prototxt-deploy等说明
1:神经网络中,我们通过最小化神经网络来训练网络,所以在训练时最后一层是损失函数层(LOSS), 在测试时我们通过准确率来评价该网络的优劣,因此最后一层是准确率层(ACCURACY). 但是当我们真正 ...
- 【神经网络与深度学习】Caffe使用step by step:caffe框架下的基本操作和分析
caffe虽然已经安装了快一个月了,但是caffe使用进展比较缓慢,果然如刘老师说的那样,搭建起来caffe框架环境比较简单,但是完整的从数据准备->模型训练->调参数->合理结果需 ...
- 【神经网络与深度学习】Caffe使用step by step:使用自己数据对已经训练好的模型进行finetuning
在经过前面Caffe框架的搭建以及caffe基本框架的了解之后,接下来就要回到正题:使用caffe来进行模型的训练. 但如果对caffe并不是特别熟悉的话,从头开始训练一个模型会花费很多时间和精力,需 ...
- 【神经网络与深度学习】caffe+VS2013+Windows无GPU快速配置教程
首先来一波地址: happynear大神的第三方caffe:http://blog.csdn.net/happynear/article/details/45372231 Neil Z大神的第三方ca ...
- 【神经网络与深度学习】Caffe Model Zoo许多训练好的caffemodel
Caffe Model Zoo 许多的研究者和工程师已经创建了Caffe模型,用于不同的任务,使用各种种类的框架和数据.这些模型被学习和应用到许多问题上,从简单的回归到大规模的视觉分类,到Siames ...
- 【神经网络与深度学习】Caffe源码中各种依赖库的作用及简单使用
1. Boost库:它是一个可移植.跨平台,提供源代码的C++库,作为标准库的后备. 在Caffe中用到的Boost头文件包括: (1).shared_ptr.hpp:智能指针,使用它可以不 ...
- 【神经网络与深度学习】caffe静态链接库“Unknown layer type: Convolution (known types: )”和“ 磁盘空间不足”问题的解决办法
这一段时间把caffe在windows环境下编译了一下,tool里面的cpp全部编译成了exe.再用的时候有两个问题让我头疼了好长时间! 第一个问题 "db_lmdb.hpp:14] Che ...
- 【神经网络与深度学习】Caffe训练执行时爆出的Check failed: registry.count(t ype) == 1 (0 vs. 1) Unknown layer type
自己建立一个工程,希望调用libcaffe.lib ,各种配置好,也能成功编译,但是运行就会遇到报错 F0519 14:54:12.494139 14504 layer_factory.hpp:77] ...
随机推荐
- [Algorithm] Find The Vowels
// --- Directions // Write a function that returns the number of vowels // used in a string. Vowels ...
- pat 甲级 1045 ( Favorite Color Stripe ) (动态规划 )
1045 Favorite Color Stripe (30 分) Eva is trying to make her own color stripe out of a given one. She ...
- java 面试心得总结-BAT、网易
http://blog.csdn.net/sinat_26812289/article/details/50898693
- 数据结构实验之链表六:有序链表的建立(SDUT 2121)
#include <bits/stdc++.h> using namespace std; struct node { int data; struct node *next; }; in ...
- 在eclipse中查找一个类中的方法在其他哪个类中被调用了
选中你所要查看的方法名,ctrl+shift+G就可以查看所有调用过该方法的地方了.在Search视图里面可以查看得到这个样子是可以的,你也可以按Ctrl+H全文检索一下
- 整合spring boot时操作数据库时报错Caused by: java.lang.InstantiationException: tk.mybatis.mapper.provider.base.B
原文:https://blog.csdn.net/u__f_o/article/details/82756701 一般出现这种情况,应该是没有扫描到对应的mapper包,即在启动类下配置MapperS ...
- GDB之常见错误
1. dl-debug.c:74: No such file or directory. 如上图,当使用 gdb 调试执行 r 时,会出现如上打印. 解决方法如下: apt-get install e ...
- qt5之网络通信
QT5 TCP网络通讯 服务器与客户端建立连接listen() - connectToHost(); 触发newPendingConnect信号 实时数据通讯write(); read(); 触发 ...
- 一次galera cluster集群故障节点无法启动问题排查
现象 环境: Server version: 10.0.25-MariaDB-wsrep MariaDB Server, wsrep_25.13.raf7f02e 配置文件: [root@node-2 ...
- LVS集群
集群: 将许多小的,性能较低的服务器做成一个大的性能高的超级服务器 集群分为负载均衡集群,高可用集群,高性能运算集群 LVS体系结构与工作原理描述 LVS集群负载均衡器接受服务的所有入站客户端计算机请 ...