【神经网络与深度学习】转-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] ...
随机推荐
- 关于b站爬虫的尝试(一)
由于b站爬虫难度较小(url地址主要通过av定位),我第一的爬虫尝试就选择了b站 以下为初步的尝试. 首先,由于初步统计,b站空视频(已下架或者删除)的比例大概是百分之五十(统计样本基本在前几年的视频 ...
- offset([coordinates])
offset([coordinates]) 概述 获取匹配元素在当前视口的相对偏移. 返回的对象包含两个整型属性:top 和 left,以像素计.此方法只对可见元素有效.大理石平台价格表 参数 coo ...
- HDU - 5528Count a * b 数学公式推导
HDU - 5528Count a * b 照着这个写的,忘了哪个大佬博客里的了, 但很多初学者,像我一样可能不懂其中一些符号的意义,还有为什么可以这样推导,所以我自己又推导了一下,并用自己的观点解释 ...
- JavaWeb_(Spring框架)Spring整合Hibernate
Dao层类要继承HibernateDaoSupport.java父类 原先使用Hibernate框架hibernate.cfg.xml配置数据库 <hibernate-configuration ...
- 苹果系统OSX中Automator批量重命名
Automator,看字面意思就无比强大,[自动机器].有什么能比自动还让人着魔? 答案是没有✔ 如果你用的是mac,如果你有一堆文件要重新整理命名,如果你还在Goole什么"批量重命名软件 ...
- docker安装Elasticsearch Kibana和Cerebro
环境:win10家庭版,基于Docker Toolbox 首先先做好以下两步准备工作: ①.打开Oracle VM VirtualBox,设置虚拟机内存大小,默认不够安装,建议如下设置: ②.启动虚拟 ...
- vuex中mutation和action的详细区别
const store = new Vuex.Store({ state: { count: 0 }, mutations: { increment (state) { state.count++ } ...
- 在CSS中水平居中和垂直居中:完整的指南
这篇文章将会按照如下思路展开: 一.水平居中 1. 行内元素水平居中 2. block元素水平居中 3. 多个块级元素水平居中 二.垂直居中 1. 行内元素水平居中 2. block元素水平居中 3. ...
- CDN之Web Cache
1. Cache 的工作方式 Web Cache 作为一种网页缓存技术,可以在用户访问网站服务器的任何一个中间网元上实现.根据 HTTP 协议的定义,在一次网页访问中,用户从客户端发出请求到网站服务器 ...
- QT 多线程程序设计 -互斥
QT通过三种形式提供了对线程的支持.它们分别是,一.平台无关的线程类,二.线程安全的事件投递,三.跨线程的信号-槽连接.这使得开发轻巧的多线程Qt程序更为容易,并能充分利用多处理器机器的优势.多线程编 ...