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

本文介绍了在Ubuntu16.04环境下,安装densepose模型过程中遇到的make和make ops问题及其解决方案,包括指定pytorch路径、解决缺失文件、gcc版本降级、库文件配置、protobuf版本冲突和GPU内存不足等问题。
摘要由CSDN通过智能技术生成

环境版本如下:

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的对应文件,拷贝到报错的路径下
参考:

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值