安装densepose (make、make ops问题解决)

环境版本如下:

Ubuntu16.04
cuda 9.0
cudnn 7.1
gcc 4.9.4
cmake 3.5.1
protpbuf 3.6.1
opencv-python 4.2.0
查看cuda版本: cat /usr/local/cuda/version.txt
查看cudnn版本:cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
查看gcc版本:  gcc --version
查看cmake版本:   cmake --version
查看protobuf版本:protoc --version
查看opencv版本:  python
                import cv2
                print(cv2.__version__)

一、conda安装caffe2:

因为源码安装时,需要git submodule update --init --recursive,git被限速在20kb左右,会导致超时错误。而且更改host对我来说也不起作用,还有一种办法是将github的代码链接到码云上,速度会上升到m/s,然而子模块submodule非常多有几十个,就是全部链接到码云,在git时仍需要访问github.com,也不是可取得方法,种种原因,放弃了源码安装caffe2。

官网查看下载命令 : Pytorch

conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0

验证caffe是否装成功:

:~$ python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
    Success
:~$ python2 -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())'
    1

二、安装densepose模型:

1、make

:~$ make
:~$ python2 detectron/tests/test_spatial_narrow_as_op.py

BUG:

No handlers could be found for logger "caffe2.python.net_drawer"
net_drawer will not run correctly. Please install the correct dependencies.
[E init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
[E init_intrinsics_check.cc:43] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
[E init_intrinsics_check.cc:43] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
Traceback (most recent call last):
  File "detectron/tests/test_spatial_narrow_as_op.py", line 80, in <module>
    c2_utils.import_detectron_ops()
  File "/home/wangyuan/DENSEP/detectron/utils/c2.py", line 33, in import_detectron_ops
    detectron_ops_lib = envu.get_detectron_ops_lib()
  File "/home/wangyuan/DENSEP/detectron/utils/env.py", line 64, in get_detectron_ops_lib
    ('Detectron ops lib not found; make sure that your Caffe2 '
AssertionError: Detectron ops lib not found; make sure that your Caffe2 version includes Detectron module

解决:在下载的densepose文件夹里,CMakeLists.txt 指定pytorch路径
具体格式参考:https://github.com/Johnqczhang/densepose_installation/blob/master/CMakeLists.txt

2、make ops

:~$ make ops

BUG:

In file included from /home/wangyuan/anaconda2/envs/densep/lib/python2.7/site-packages/torch/include/caffe2/utils/filler.h:8:0,
                 from /home/wangyuan/anaconda2/envs/densep/lib/python2.7/site-packages/torch/include/caffe2/core/operator_schema.h:16,
                 from /home/wangyuan/anaconda2/envs/densep/lib/python2.7/site-packages/torch/include/caffe2/core/net.h:18,
                 from /home/wangyuan/anaconda2/envs/densep/lib/python2.7/site-packages/torch/include/caffe2/core/operator.h:17,
                 from /home/wangyuan/DENSEP/detectron/ops/pool_points_interp.h:15,
                 from /home/wangyuan/DENSEP/detectron/ops/pool_points_interp.cc:10:
/home/wangyuan/anaconda2/envs/densep/lib/python2.7/site-packages/torch/include/caffe2/utils/math.h:18:41: fatal error: caffe2/utils/math/broadcast.h: No such file or directory
compilation terminated.
CMakeFiles/caffe2_detectron_custom_ops.dir/build.make:62: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/pool_points_interp.cc.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/pool_points_interp.cc.o] Error 1
make[3]: *** Waiting for unfinished jobs....

解决办法:从github上下载pytorch的对应文件,拷贝到报错的路径下
参考:

你可能感兴趣的:(人体姿态识别,densepose安装,caffe,pytorch,深度学习,神经网络)