这周安装了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. 云主机用samba服务实现和windows共享文件

    最近刚刚入坑了百度云的云主机BCC,准备在云主机上实现samba服务,映射到本机来当硬盘使用,可是一直怎么试都不成功,后来咨询客服之后才知道samba默认使用的端口445端口被运营商封禁了,只好更改端 ...

  2. Luogu P3527 [POI2011]MET-Meteors 整体二分

    思路:整体二分 提交:4次 错因:树状数组开的$int$ 题解: 二分操作序列,将仅用$[l,md]$即可满足要求的国家递归到左半边,将仅用$[l,md]$不能满足要求的国家,把他们的要求去掉左半边的 ...

  3. centos 7配置静态IP,并配置DNS

    注意:四 个文件 cat /etc/sysconfig/network-scripts/ifcfg-eth0 cat /etc/sysconfig/network cat /etc/resolv.co ...

  4. NSObject和反射

    如何NSObject和反射 NSObject 常用方法 如何判断 某个对象是否属于某个类或子类 -(BOOL)isKindOfClass:(Class)aClass 判断是否为aClass的实例(不包 ...

  5. Zookeeper系列(十一)zookeeper的Leader选举详解(核心之一)

    作者:leesf    掌控之中,才会成功:掌控之外,注定失败. 出处:http://www.cnblogs.com/leesf456/p/6107600.html尊重原创,奇文共欣赏: 一.前言 前 ...

  6. MAC ADDRESS

    可以使用手机Wifi或蓝牙的MAC地址作为设备标识,但是并不推荐这么做,原因有以下两点:硬件限制:并不是所有的设备都有Wifi和蓝牙硬件,硬件不存在自然也就得不到这一信息.获取的限制:如果Wifi没有 ...

  7. Oracle用户被锁解决方法

    .查看用户的proifle是哪个,一般是default: sql>SELECT username,PROFILE FROM dba_users; .查看指定概要文件(如default)的密码有效 ...

  8. python中的break continue之用法

    Break break跳出循环,并且终止最小封闭循环. Continue continue跳过本次循环,继续执行下一次的循环. 二者区别就是break会终止循环,continue不终止循环.

  9. cloud toolkit同时部署多个服务器

    首先安装cloud toolkit安装完成之后重启idea 添加host主机信息: 部署到远程服务器 具体信息: 配置本地查看服务器日志信息 启动脚本信息 start.sh #! /bin/sh so ...

  10. 使用 in_memory 工作空间的注意事项

    来自:https://pro.arcgis.com/zh-cn/pro-app/tool-reference/appendices/using-the-in-memory-output-workspa ...