概述
Open-MMLab开源了一个不错的3D点云的目标检测开源库OpenPCDet,但是其中有个依赖库spconv的安装需要小心匹配版本,否则编译不通过。现有的很多教程都是UBUNTU系统的,我找了很久也没找到几个Debian系统的教程。
折腾了很久之后,终于在Debian系统中把所有库全部安装成功!!记录以下过程防止走弯路!!!
亲测有效,如无效请把你电脑给我,博主亲自给你演示安装!
安装过程Ubuntu应该和Debian系统差不多,有些许不同。
原创不易,请尊重原创!转载请注明出处!
本文使用的各种库的版本如下:
库 | 版本 |
---|---|
显卡型号 | GTX1080 |
Nvidia驱动 | 460 |
cuda | 10.2 |
cndnn | 7.6.5 |
pytorch | 1.9.0 |
spconv | 1.2 |
cmake | 3.21.0 |
下面开始!!!
0.下载
cd /home
下载:
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/460.84/NVIDIA-Linux-x86_64-460.84.run
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
wget https://developer.download.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-linux-x64-v7.6.5.32.tgz?ULLKdlsuJOpWJcHk63flk4-ZzKwDR_LSCxqhddmDqqObMDtcGavhBXvK_tDU9Hzy0FlNIEg6G-79EgidA8g1yaVN12ZqvnsLP5oRwtJP3QGuL034PmzFztLjjzNCVxIJ0Aemm98pouKWw_wRPlALH-xUx5_gVzGDQpRLy2NOSz1E5Yec3zKmvwBkcGpRc23YXZj2u0Ha8NYEjScjm0Xyg1yI8RwUjjlCPQ
wget https://github.com/Kitware/CMake/releases/download/v3.21.0-rc2/cmake-3.21.0-rc2.tar.gz
1. Nvidia驱动安装
查看显卡是否为Nvidia
lspci | grep -E "VGA|3D"
换源
sudo gedit /etc/apt/source.list
加入:
deb https://mirrors.aliyun.com/debian/ buster main contrib non-free
deb https://mirrors.aliyun.com/debian/ buster-backports main contrib non-free
deb https://mirrors.aliyun.com/debian/ buster-updates main contrib non-free
deb https://mirrors.aliyun.com/debian-security/ buster/updates main contrib non-free
输入
sudo apt-get update
sudo reboot
卸载以前的驱动:
sudo apt-get remove --purge nvidia*
sudo chmod +x *.run
sudo ./NVIDIA-Linux-x86_64-460.84.run --uninstall
接下来需要禁用nouveau,打开/etc/modprobe.d/blacklist.conf在文本最后一行添加blacklist nouveau
sudo gedit /etc/modprobe.d/blacklist.conf
加入:
blacklist nouveau
options nouveau modeset=0
然后输入,重新生成ramfs。
sudo update-initramfs -u
sudo reboot
电脑重启之后执行下面的代码,没有输出,即说明安装成功
lsmod | grep nouveau
按Ctrl-Alt+F1,输入用户名和密码登录,进入驱动文件目录,为文件赋权。
sudo chmod a+x NVIDIA-Linux-x86_64-460.84.run
查询并锁定内核版本:
uname -a
sudo apt-mark hold linux-image-4.19.0-8-amd64
安装Nvidia460驱动(注意此时应在tty环境中执行)
sudo sh NVIDIA-Linux-x86_64-460.84.run
按Ctrl-Alt+F1,
yes
ok
ls
sudo reboot
输入以下代码,若出现驱动信息则安装成功
sudo nvidia-smi
2. 安装cuda10.2
这里官网没有Debian的cuda10.2版本,所以我们可以下载Ubuntu18.04的cuda10.2版本,亲测安装成功!!
(注意此命令需要按Ctrl-Alt+F1进入tty环境执行)
sudo service lightdm stop
ls
sudo sh ./cuda_10.2.89_440.33.01_linux.run
accept
把驱动的框选取消掉,我们已经提前安装了显卡驱动。
Install
进入图形界面
方法1
按Ctrl-Alt+F1
方法2
sudo reboot
输入
sudo gedit ~/.bashrc
加入
export PATH=/usr/local/cuda-10.2/bin:/usr/local/cuda-10.2/nsight-compute-2019.5.0/${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64
source ~/.bashrc
之后检测安装是否成功
cd /usr/local/cuda-10.2/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
nvcc -V
正常输出Result=Pass,则证明安装成功。
3. 安装cudnn7.6.5
下载cuda10.2版本对应的cudnn7.6.5
tar -xzvf cudnn-10.2-linux-x64-v7.6.5.32.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda-10.2/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-10.2/lib64
sudo chmod a+r /usr/local/cuda-10.2/include/cudnn.h
sudo chmod a+r /usr/local/cuda-10.2/lib64/libcudnn*
检测是否安装成功
cat /usr/local/cuda-10.2/include/cudnn.h | grep CUDNN_MAJOR -A 2
4.安装pytorch1.9.0
新建一个conda虚拟环境
conda create -n OpenPCDet python=3.7
conda activate OpenPCDet
输入
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
5.编译spconv
安装编译环境
sudo apt-get install libboost-dev libboost-all-dev
sudo apt-get install libssl-dev
安装cmake3.21.0
tar -xzvf cmake-3.21.0-rc2.tar.gz
cd cmake-3.21.0-rc2
sudo ./configure
sudo make
sudo make install
查看版本:
cmake -version
创建软链接
sudo ln -sf /usr/local/bin/* /usr/bin/
拉取源码并编译spconv
git clone https://github.com/traveller59/spconv.git --recursive
cd spconv
python setup.py bdist_wheel
cd ./dist
pip install *
检验spconv是否安装成功,无报错即可
python
import spconv
6.安装pcdet v0.3
拉取源码
git clone https://github.com/open-mmlab/OpenPCDet.git
cd OpenPCDet
gedit requirements.txt
注释torch>=1.1
pip install -r requirements.txt
python setup.py develop
测试pcdet
直接安装vtk, mayavi, pyqt5
cd tools
pip install vtk==8.1.2
pip install mayavi=4.7.1
pip install pyqt5==5.15.0
python demo.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --ckpt pv_rcnn_8369.pth --data_path ../data/kitti/testing/velodyne/000008.bin
曲线安装mayavi, pyqt5
添加anaconda清华源
conda config --remove-key channels
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
曲线安装安装
conda install mayavi
conda remove --force vtk
pip install vtk==8.1.2
pip install pyqt5==5.15.0
python demo.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --ckpt pv_rcnn_8369.pth --data_path ../data/kitti/testing/velodyne/000008.bin
至此,OpenPCDet的环境配置结束!
[参考]:
https://linoxide.com/install-nvidia-driver-debian/
https://amagi.yukisaki.io/article/6e82f743-6cec-49d0-bc73-4d1469a601f5/
https://www.codenong.com/cs109267381/
http://www.siyuanblog.com/?p=915
https://blog.csdn.net/W1995S/article/details/114597797
https://zhuanlan.zhihu.com/p/373668000
https://zhuanlan.zhihu.com/p/215932478
https://blog.csdn.net/weixin_45377028/article/details/112406076
https://blog.csdn.net/hughlee815/article/details/107226257
https://github.com/tyjiang1997/spconv1.0
最后
以上就是整齐电源为你收集整理的【OpenPCDet图文安装教程】Debian安装Nvidia460驱动+cuda10.2+cudnn7.6.5+pytorch1.9.0+spconv+OpenPCDet全过程(亲测有效)的全部内容,希望文章能够帮你解决【OpenPCDet图文安装教程】Debian安装Nvidia460驱动+cuda10.2+cudnn7.6.5+pytorch1.9.0+spconv+OpenPCDet全过程(亲测有效)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复