Deeplab_v2 caffe 安装配置笔记

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 hdf5
LIBRARIES += 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
#else
static __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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值