ubuntu18.04,cuda11.4编译安装caffe工程时报错,跟opencv版本有关

编译安装caffe工程时报错

编译caffe

环境:cuda11.4,opencv4.5
报错:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)

报错内容参考:https://blog.csdn.net/u014613745/article/details/78310916

发现caffe无法引用opencv中各个函数,推测opencv版本较新,与caffe工程里引用的函数名有改变。

重新安装opencv

进入到之前编译的opencv目录,卸载安装

cd opencv
cd build
sudo make uninstall

重新编译低版本opencv
参考:https://blog.csdn.net/chentianting/article/details/85677166

因cuda版本太高,cmake无法成功,因此选择编译时不使用CUDA,
cmake时增加参数:

-D WITH_NVCUVID=OFF

低版本opencv编译成功。

再次对caffe工程进行编译,并编译pycaffe:

sudo make clean
sudo make -j24
sudo make pycaffe -j24

pycaffe编译成功后将caffe文件下的python文件夹加入环境变量。

sudo gedit ~/.bashrc

添加: export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH

source ~/.bashrc

安装一些python文件夹会用到的依赖,在python/requirments.txt里,随后进入python文件夹,import caffe成功

参考链接

https://blog.csdn.net/chentianting/article/details/85677166
https://blog.csdn.net/u014613745/article/details/78310916
https://blog.csdn.net/yllifesong/article/details/80980338

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值