Deeplab-v2 编译过程中的问题

参考博客:
DeepLab V2安装配置
从头开始训练deeplab v2系列之一
从头开始训练deeplab v2系列之二

开源的代码:
shell版本
python版本
对应的models:DeepLab_Models
脚本文件下载:XX.sh文件、XX.txt文件、ResNet-101 model包含XX.prototxtXX.caffemodel文件、VGG-16 model

tensorflow deeplab-resnet
tensorflow deeplab-flov

1.接口错误

/usr/local/cuda-7.5//include/cudnn.h:803:27: note: declared here
cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(

这是由于所使用的cuDNN版本不一致的导致的,作者配置环境是cuDNN 4.0,但是5.0版本后的cuDNN接口有所变化。

解决方法 :将以下几个文件用最新BVLC版本的caffe对应文件替换并重新编译

./include/caffe/util/cudnn.hpp
./include/caffe/layers/cudnn_conv_layer.hpp
./include/caffe/layers/cudnn_relu_layer.hpp
./include/caffe/layers/cudnn_sigmoid_layer.hpp
./include/caffe/layers/cudnn_tanh_layer.hpp

./src/caffe/layers/cudnn_conv_layer.cpp
./src/caffe/layers/cudnn_conv_layer.cu
./src/caffe/layers/cudnn_relu_layer.cpp
./src/caffe/layers/cudnn_relu_layer.cu
./src/caffe/layers/cudnn_sigmoid_layer.cpp
./src/caffe/layers/cudnn_sigmoid_layer.cu
./src/caffe/layers/cudnn_tanh_layer.cpp
./src/caffe/layers/cudnn_tanh_layer.cu

2.CUDA8.0环境下atomicAdd错误

./include/caffe/common.cuh(9): error: function “atomicAdd(double *, double)” has already been defined

原因是CUDA 8.0 提供了对atomicAdd函数的定义,但atomicAdd在之前的CUDA toolkit中并未出现,因此一些程序自定义了atomicAdd函数。

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

#if !defined(__CUDA_ARCH__)||__CUDA_ARCH__>=600
#else

  // CUDA: atomicAdd is not defined for doubles
  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

3.opencv的错误

./include/caffe/common.hpp:73:22: error: forward declaration of ‘class cv::Mat’
namespace cv { class Mat; }

没有打开opencv的接口
解决办法:

# 在Makefile.config文件中
# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0

持续更新…

你可能感兴趣的:(DeepLab)