Deeplab_v2 caffe 安装配置笔记

来源:互联网 发布:税务网络大学app 编辑:程序博客网 时间:2024/06/05 07:10

Deeplab_v2论文:https://arxiv.org/abs/1606.00915
github程序下载:https://github.com/xmojiao/deeplab_v2

安装配置参考博客(特别感谢):
1. http://blog.csdn.net/Xmo_jiao/article/details/77897109?locationNum=11
2. http://blog.csdn.net/tianrolin/article/details/71246472

一、准备工作

1. 安装Matio

下载Matio:https://sourceforge.net/projects/matio/files/matio/1.5.2/

$ tar zxf matio-1.5.2.tar.gz$ cd matio-1.5.2$ ./configure$ make$ make install$ ldconfig

2. 数据集准备

参考博客:
http://blog.csdn.net/Xmo_jiao/article/details/77897109?locationNum=11

二、caffe编译

和BVLC版本一样,对DeepLab版本的caffe进行编译

$ cd deeplab-public-ver2$ make all -j32$ make test -j32$ make pycaffe$ make runtest

*编译过程中bug解决

1.修改文件Makefile

181行

# LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

409行

# NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

2.修改文件 Makefile.config

25行:解注释:CUSTOM_CXX := g++
87行:解注释:WITH_PYTHON_LAYER := 1
90-91行:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

3.编译报错修改

(1)Makefile:590: recipe for target ‘build_release/cuda/src/caffe/layers/cudnn_sigmoid_layer.o’ failed
make:*[build_release/cuda/src/caffe/layers/cudnn_sigmoid_layer.o] Error 1

解决办法:将以下文件用电脑原来的caffe对应的文件替换并重新编译
./include/caffe/util/cudnn.hpp
./include/caffe/layers/cudnn_conv_layer.hpp
……

./src/caffe/layers/cudnn_conv_layer.c*
……

layers文件夹所有cudnn_xxx_layer.c*的文件全部替换吧。。

(2)./include/caffe/common.cuh(9): error: function “atomicAdd(double *, double)” has already been defined
……
Makefile:590: recipe for target ‘build_release/cuda/src/caffe/layers/domain_transform_layer.o’ failed

解决办法:打开./include/caffe/common.cuh文件,在atomicAdd前添加宏判断如下:

#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600#elsestatic __inline__ __device__ double atomicAdd(double *address, double val) {    unsigned long long int* address_as_ull = (unsigned long long int*)address;    unsigned long long int old = *address_as_ull, assumed;    if (val==0.0)        return __longlong_as_double(old)    do {        assumed = old;        old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val +__longlong_as_double(assumed)));    } while (assumed != old);    return __longlong_as_double(old)}#endif#endif
原创粉丝点击