前言
DensePose是基于caffe2和Detectron的.现在caffe2已经被并入pytorch,所以要想源码安装caffe2,只能先克隆pytorch,同时要注意的是,Detectron只适用于GPU版本的caffe2.
官方说源码安装caffe2以及detectron需要cuda8.0+cudnn6.0,经过亲自试验,cuda9.0+cudnn7.1也可以.
注意:经过多次尝试,发现只有使用python2.7版本才能编译成功gpu版本的caffe2!!!python3编译不通过!!!!
基础环境:ubuntu16.04+cuda9.0+cudnn7.1+python2.7
说明:cuda和cudnn的安装过程在此省略,过程可见我的另一篇博客:https://blog.youkuaiyun.com/weixin_40369473/article/details/82223775
源码编译安装caffe2(可参考官网https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile)
安装依赖:
sudo apt-get install -y --no-install-recommends \
libgflags-dev \
cmake
clone+build
(编译时间很长,如果之前基础环境没问题,这里应该就没问题,之前我就是用的python3,结果利用cuda9.0时候只能编译成功cpu版本的caffe2,而利用cuda8.0的时候直接编译不通过,所以再强调一遍,一定要python2.7!!)
git clone https://github.com/pytorch/pytorch.git && cd pytorch
git submodule update --init --recursive
python setup.py install
检查caffe2是否安装成功
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
Success