caffe ubuntu16安装报错和程序总结
我最近安装安装了老版本的caffe,安装过程真是两个字“想死”,所以我的错误一般都是比较经典的。
我是使用cuda的版本,所以可能会出现undefined refference to cudnn.h。这个时候该做的就是把所有版本全都装一遍试试,而如果不追求速度的话,直接转cudnn1,最原始的版本,一般不会有问题。gpu版本一定是比cpu快n倍的,这个不用怀疑。
在编译caffe的时候,报错:
couldn't find hdf5.h
在网上很容易找到普通解决方法:
--- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
+++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ --- LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
+++ LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
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
但是老版本的caffe真的是很争气,即使已经改掉了还是找不到,当时内心是奔溃的WTF
奔溃的我在github找到了这个,大神都在github把所有的包含hdf5.h头文件的文件都改了
https://github.com/BVLC/caffe/issues/2690
diff --git a/Makefile.config.example b/Makefile.config.example
index a873502..33441b3
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -, +, @@ PYTHON_LIB := /usr/lib # Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
-LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
+LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
diff --git a/include/caffe/data_layers.hpp b/include/caffe/data_layers.hpp
index 3958cb7..2ccbaec
--- a/include/caffe/data_layers.hpp
+++ b/include/caffe/data_layers.hpp
@@ -, +, @@
#include <vector> #include "boost/scoped_ptr.hpp"
-#include "hdf5.h"
+#include "hdf5/serial/hdf5.h" #include "caffe/blob.hpp"
#include "caffe/common.hpp"
diff --git a/include/caffe/util/io.hpp b/include/caffe/util/io.hpp
index 3a62c3c..f4363f0
--- a/include/caffe/util/io.hpp
+++ b/include/caffe/util/io.hpp
@@ -, +, @@
#include <string> #include "google/protobuf/message.h"
-#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h" #include "caffe/blob.hpp"
#include "caffe/common.hpp"
diff --git a/src/caffe/layers/hdf5_data_layer.cpp b/src/caffe/layers/hdf5_data_layer.cpp
index 8a782f7..42890be
--- a/src/caffe/layers/hdf5_data_layer.cpp
+++ b/src/caffe/layers/hdf5_data_layer.cpp
@@ -, +, @@ TODO:
#include <string>
#include <vector> -#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h"
#include "stdint.h" #include "caffe/data_layers.hpp"
diff --git a/src/caffe/layers/hdf5_data_layer.cu b/src/caffe/layers/hdf5_data_layer.cu
index 5e3e4ce..23bc02a
--- a/src/caffe/layers/hdf5_data_layer.cu
+++ b/src/caffe/layers/hdf5_data_layer.cu
@@ -, +, @@ TODO:
#include <string>
#include <vector> -#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h" #include "caffe/data_layers.hpp"
#include "caffe/layer.hpp"
diff --git a/src/caffe/layers/hdf5_output_layer.cpp b/src/caffe/layers/hdf5_output_layer.cpp
index f63375c..0b57eb9
--- a/src/caffe/layers/hdf5_output_layer.cpp
+++ b/src/caffe/layers/hdf5_output_layer.cpp
@@ -, +, @@
#include <vector> -#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h" #include "caffe/blob.hpp"
#include "caffe/common.hpp"
diff --git a/src/caffe/layers/hdf5_output_layer.cu b/src/caffe/layers/hdf5_output_layer.cu
index ae497c3..ada682f
--- a/src/caffe/layers/hdf5_output_layer.cu
+++ b/src/caffe/layers/hdf5_output_layer.cu
@@ -, +, @@
#include <vector> -#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h" #include "caffe/blob.hpp"
#include "caffe/common.hpp"
然后在使用的时候出现了can't find features
之前傻不拉几的pip isntall features结果并没有卵用,于是下载了
https://github.com/cvondrick/pyvision/blob/master/vision/features.pyx
发现出现一定问题:
im=Image.fromarray(im)
width, height = im.size
cython -a features.pyx
gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing \
-I/usr/include/python2. -o features.so features.c
最后在需要的代码之前对features路径进行引用,比如我把features在vision文件中,在py文件开头加一句这个
sys.path = ['/home/hu/pyvision/vision'] + sys.path
在调用程序的时候发现narray和image对象存在不兼容,所以我就写了一个PIL与array之间的转换程序
def array2PIL(arr, size=[96,96]):
mode = 'RGBA'
arr = arr.reshape(arr.shape[0]*arr.shape[1], arr.shape[2])
if len(arr[0]) == 3:
arr = np.c_[arr, 255*np.ones((len(arr),1), np.uint8)]
return Image.frombuffer(mode, size, arr.tostring(), 'raw', mode, 0, 1)
最终程序能够跑了,代码也看的差不多了。
幸运之神总是眷顾努力的人,加油
caffe ubuntu16安装报错和程序总结的更多相关文章
- 链接Caffe,程序报错应用程序无法正常启动(0xc000007b)
目录 背景 Debug 解决办法 原因(猜想) 总结 重点是介绍了一种排查这个问题的方法. 背景 Windows 下, Caffe 单独编译成库并且安装在路径 Caffe_DIR, 动态链接库 Caf ...
- 记录laravelchina中的微信小程序教程的npm install安装报错
npm安装报错时 npm ERR! code EIOnpm ERR! syscall symlinknpm ERR! path ../@babel/parser/bin/babel-parser.js ...
- 使用pip安装报错的处理方法
在新的机子上使用pip安装程序一直报错: Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connect ...
- pydensecrf安装报错1、UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 29: invalid start byte2、 LINK : fatal error LNK1158: 无法运行“rc.exe” error: command 'D:\\software\\vs2015\\VC\\BIN
pydensecrf安装报错 1.UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 29: invalid st ...
- 【Datastage】Datastage在win10上安装报错:This Application requires one of the following versions of the .NET Framework:v1.1.4322 Do you want to install this .NET Framework version now?
Datastage在win10上安装报错如下: 这个错误的意思是:.netFramWork的版本不符合要求,于是,我在网上下载了一个版本一致的 下载地址为:http://pan.baidu.com/s ...
- linux 安装报错:pkg-config not found
linux 安装报错:pkg-config not found 使用编译安装时,在执行./configure时报如下错误: ... ... checking for pkg-config... no ...
- MSSQL 2012安装报错之0x858C001B
之前安装 Microsoft Sql Server 2012 R2 的时候总是报这样的错误: SQL Server Setup has encountered the following error: ...
- mydumper 安装报错处理
mydumper 官网:https://launchpad.net/mydumper 下载之后,安装报错: [root@localhost local]# cd mydumper-0.6.2 [roo ...
- linux -小记(2)问题:yum 安装报错"Another app is currently holding the yum lock; waiting for it to exit... ...: yum Memory : 26 M RSS (868 MB VSZ) Started: Wed Oct 26 22:48:24 2016 - 0"
yum 安装报错 "Another app is currently holding the yum lock; waiting for it to exit... The other ap ...
随机推荐
- Greenplum获取表结构
最近在折腾greenplum,遇到一个蛋疼的问题,那就是获取表结构,也就是建表语句.大家都知道在MySQL里面是非常easy的,show create table table_name 就搞定了,在g ...
- C++_static与非static成员(函数)
static与非static成员(函数) <C++ Primer>第4版399页: 对于特定类类型的全体对象而言,访问一个全局变量有时是必要的.然而,全局变量会破坏封装:对象需要支持特定 ...
- 本内容中发现无效字符。处理资源 'file:///C:/Users/XDJ/Desktop/1111/press.xml' 时出错。第 5 行,位置: 11 <author>ƽ
粘贴到编译器中, 然后在复制出即可.
- IOS第二天多线程-01-延时执行
**********延时执行 #import "HMViewController.h" @interface HMViewController () @end @implement ...
- mysql5.5手册读书日记(1)
<?php //mysql语句使用技巧 /* * 我的数据库是5.5.2 * * 查询当前用户的登陆的名字 * select user(); * * 查询当前mysql服务器时间和服务器版本 * ...
- 用Scala实现集合中相邻元素间的差值
欢迎转载,转载请注明出处,徽沪一郎. 概要 代码这东西,不写肯定不行,新学Scala不久,将实际遇到的一些问题记录下来,日后也好查找. 今天讲的是如何计算同一集合中元素两两之间的差值,即求开始集合(a ...
- bootstrap加深
1.安装: bootstrap中文网:http://www.bootcss.com/ bootstrap.css样式:http://v3.bootcss.com/css/#tables class=' ...
- 主动模式下FTP的详细工作过程(转) 挺详细
主动模式下FTP的详细工作过程 PORT FTP是常用的FTP工作方式,当客户端的连接请求到来时,FTP服务器会利用默认的21端口与客户端建立连接,该连接属于命令通道,利用该通道来下达控 制指令: ...
- Java学习-048-插件应用之 Find Bugs
FindBugs 是一个静态分析工具,它可以检查类或者 JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题,使用 FindBugs 可以在不实际运行程序的情况对软件进行分析.使用时最好将字节 ...
- SQL调优
# 问题的提出 在应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂视图的的编写等体会不出SQL语句各种写法的性能优劣,但是如果将应用 系统提交实际应用后,随着数据库中数据的增加,系 ...