Face_parsing_2016 : caffe+matlab2016b 编译

4 篇文章 0 订阅
2 篇文章 0 订阅

本文是FaceParse cvpr2015项目搭建: https://www.sifeiliu.net/face-parsing

1.命令行安装Matlab2016b,参见:https://www.cnblogs.com/Key-Ky/p/7918745.html

2. 按照官网安装caffe依赖。由于我的机器编译caffe失败,因此有必要查看所有的库是否已经安装好。没有安装好的自己手动源码安装。这里手动安装boost-1.69.0,opencv2.13.4,gflags

  1. opencv2编译见:https://blog.csdn.net/wzmsltw/article/details/52718472  特别注意要把 with-qt关闭掉。 
  2. opencv3编译见:https://www.learnopencv.com/install-opencv3-on-ubuntu/
  3. gflags编译比较简单。
  4. boost源码编译,编译时选择python版本:
./bootstrap --with-python=/usr/bin/python3
./b2 cxxflags=-fPIC cflags=-fPIC --c++11
./b2 install --prefix=/usr/local/boost-1.69.0

3. 编译官网caffe与matcaffe Ubuntu16.04+cuda8+matlab2016b,见:https://blog.csdn.net/tomato_ljl/article/details/79169028 

4. 主要把Makefile.config考到本项目中,修改相应Makefile,编译。本项目已经成功编译运行demo,参见我的 github makefile。注意的是用opencv3!Face_parsing_2016 中,重新make clean, make , make

注意:以上时编译matlab接口,不要用下面的anaconda lib,编译python接口可以用

 

遇到的错误:

1. anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用

我的解决方法是在Makefile.config加入下列信息:

LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

Makefile.config中是python3,open_cv3,加上上述语句是用anaconda的lib

 

2.在/usr/lib/x86_64-linux-gnu目录下,

sudo ln libhdf5_serial.so.10.1.0 libhdf5.so

sudo ln libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so

否则会提示:

/usr/bin/ld: 找不到 -lhdf5_hl

/usr/bin/ld: 找不到 -lhdf5

 

3. 在配置文件里找到python相关,我用的是anaconda:

# Anaconda Python distribution is quite popular. Include path:

# Verify anaconda location, sometimes it's in root.

ANACONDA_HOME := $(HOME)/anaconda3

PYTHON_INCLUDE := $(ANACONDA_HOME)/include \

                  $(ANACONDA_HOME)/include/python3.5m \

                  $(ANACONDA_HOME)/lib/python3.5/site-packages/numpy/core/include

#注意,上面打HOME变量是系统默认的/home/用户名

这一行取消注释

# Uncomment to support layers written in Python (will link against Python libs)

WITH_PYTHON_LAYER := 1

 

4. 如果是python3编译,需要取消注释

PYTHON_LIBRARIES := boost_python3 python3.5m

否则会报错:/python/caffe/_caffe.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

 

5.  有关的找不到so:

cd x86_64-linux-gnu/

sudo ln -s libboost_python-py35.so libboost_python3.so

否则会报以下错误:

/usr/bin/ld: 找不到 -lboost_python3

collect2: error: ld returned 1 exit status

 

6.undefined reference to `cv::VideoCapture::VideoCapture()

modify : LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_video

to: LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_videoio

 

运行时错误:

ImportError: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /home/dingyang/anaconda3/lib/libpng16.so.16)

Download Zlib 1.2.9 Then run those commands

tar -xvf ~/Downloads/zlib-1.2.9.tar.gz
cd zlib-1.2.9
sudo -s
./configure; make; make install
cd /lib/x86_64-linux-gnu
ln -s -f /usr/local/lib/libz.so.1.2.9/lib libz.so.1
cd ~
rm -rf zlib-1.2.9

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值