这周安装了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安装吐血总结的更多相关文章

  1. 深度学习框架-caffe安装-环境[Mac OSX 10.12]

    深度学习框架-caffe安装 [Mac OSX 10.12] [参考资源] 1.英文原文:(使用GPU) [http://hoondy.com/2015/04/03/how-to-install-ca ...

  2. 深度学习框架-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 ...

  3. 【神经网络与深度学习】Caffe部署中的几个train-test-solver-prototxt-deploy等说明

    1:神经网络中,我们通过最小化神经网络来训练网络,所以在训练时最后一层是损失函数层(LOSS), 在测试时我们通过准确率来评价该网络的优劣,因此最后一层是准确率层(ACCURACY). 但是当我们真正 ...

  4. 【神经网络与深度学习】Caffe使用step by step:caffe框架下的基本操作和分析

    caffe虽然已经安装了快一个月了,但是caffe使用进展比较缓慢,果然如刘老师说的那样,搭建起来caffe框架环境比较简单,但是完整的从数据准备->模型训练->调参数->合理结果需 ...

  5. 【神经网络与深度学习】Caffe使用step by step:使用自己数据对已经训练好的模型进行finetuning

    在经过前面Caffe框架的搭建以及caffe基本框架的了解之后,接下来就要回到正题:使用caffe来进行模型的训练. 但如果对caffe并不是特别熟悉的话,从头开始训练一个模型会花费很多时间和精力,需 ...

  6. 【神经网络与深度学习】caffe+VS2013+Windows无GPU快速配置教程

    首先来一波地址: happynear大神的第三方caffe:http://blog.csdn.net/happynear/article/details/45372231 Neil Z大神的第三方ca ...

  7. 【神经网络与深度学习】Caffe Model Zoo许多训练好的caffemodel

    Caffe Model Zoo 许多的研究者和工程师已经创建了Caffe模型,用于不同的任务,使用各种种类的框架和数据.这些模型被学习和应用到许多问题上,从简单的回归到大规模的视觉分类,到Siames ...

  8. 【神经网络与深度学习】Caffe源码中各种依赖库的作用及简单使用

    1.      Boost库:它是一个可移植.跨平台,提供源代码的C++库,作为标准库的后备. 在Caffe中用到的Boost头文件包括: (1).shared_ptr.hpp:智能指针,使用它可以不 ...

  9. 【神经网络与深度学习】caffe静态链接库“Unknown layer type: Convolution (known types: )”和“ 磁盘空间不足”问题的解决办法

    这一段时间把caffe在windows环境下编译了一下,tool里面的cpp全部编译成了exe.再用的时候有两个问题让我头疼了好长时间! 第一个问题 "db_lmdb.hpp:14] Che ...

  10. 【神经网络与深度学习】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] ...

随机推荐

  1. MySQL剖析单条查询

    使用SHOW PROFILE SHOW PROFILE命令默认是禁用的,可以通过以下命令修改 SET profiling=1; 当一条查询提交给服务器时,,此工具会记录剖析信息到一张临时表,并且给查询 ...

  2. nginx与php之间的交互方式

    1.  2种方式 TCP的socket  跟 UNIX的socket 2.TCP的socket  首先进入容器然后修改nginx下的配置文件 3. 修改/usr/local/nginx/conf/ng ...

  3. 无法安装 Composer 怎么办?

    详细方法参见 http://pkg.phpcomposer.com/ 下载 composer.phar ,放置到项目中 在同目录中执行命令行 echo @php "%~dp0composer ...

  4. 错误调试以及debug的使用

    /*定义 .search 搜索*/ $.fn.UiSearch=function(){ var ui=$(this); //任何地方都可以使用断点调试:debugger; //调试时,可以在控制台输入 ...

  5. 快速弄清JavaScript中undefined和null的区别

    ES6的7大数据类型里面有这俩玩意:undefined和null,让接触不深的学习者常常产生混淆,这俩玩意的区别在哪呢? 字面意思上来看,undefined是未(被我们)阐明的,未说明的,null则意 ...

  6. java+上传整个文件夹的所有文件

    我们平时经常做的是上传文件,上传文件夹与上传文件类似,但也有一些不同之处,这次做了上传文件夹就记录下以备后用. 首先我们需要了解的是上传文件三要素: 1.表单提交方式:post (get方式提交有大小 ...

  7. (七)对话框,单选框(radiobox),复选框(checkbox),列表框(ListBox),组合框(CComboBox),水平滚动条(Horizontal scroll bar),微调(旋转)spincontrol,列表视图控件CListCtrl,静态控件static

    1,模态对话框和非模态对话框 // 模态对话框 void CMainFrame::OnDialogExec() { // TODO: 在此添加命令处理程序代码 // 创建对话框对象 CDialog d ...

  8. [笔记]Header V4 RSA/SHA256 Signature, key ID 4d274df2: NOKEY 解决办法

    问题描述: 原因: IUS-COMMUNITY-GPG-KEY,版本太旧 解决: 切换到rpm-gpg目录中,下载最新的IUS-COMMUNITY-GPG-KEY

  9. mysql 5.7.16 安装配置

    环境变量在path中添加一个 E:\soft\mysql-5.7.16-winx64\mysql-5.7.16-winx64\bin 查看mysql版本mysql -V 生成无密码账户进入到mysql ...

  10. UITableView动态改变Cell高度

    demo下载地址:https://github.com/smileyborg/TableViewCellWithAutoLayout 版权声明:本文为博主原创文章,未经博主允许不得转载.