Ubuntu1604 配置Detectron2 cuda10.1 Driver418.56
apt 安装 显卡驱动(最好禁用 nouveau) 以及CUDA安装
- 参考这篇文章
-
添加Graphic Drivers PPA
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update
-
寻找合适的驱动版本
ubuntu-drivers devices
-
安装重启
sudo apt install nvidia- sudo nvidia-smi sudo nvidia-settings
-
安装cudu
去nvidia官网下载
.run
文件sudo sh cuda_10.1.105_418.39_linux.run
-
配置环境变量
export PATH=/usr/local/cuda-10.1/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.1
-
安装cudnn
tar -xzvf cudnn-10.***.tgz sudo cp cuda/include/cudnn.h /usr/local/cuda/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
-
检查
nvidia-smi nvcc -V
配置Detectron2环境
如果自己能力强看INSTALL.md,或者看Colab Notebook需科学上网
。
-
安装pytorch
# install dependencies: (use cu101 because colab has CUDA 10.1) pip install -U torch==1.5 torchvision==0.6 -f https://download.pytorch.org/whl/cu101/torch_stable.html pip install cython pyyaml==5.1 pip install -U 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
-
安装opencv
pip install opencv-python
-
安装Detectron2
-
编译好了,对网有要求
pip install detectron2==0.1.2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/index.html
-
从github下载编译
git clone https://github.com/facebookresearch/detectron2.git python -m pip install -e detectron2
-
遇到的问题
遇到问题先去issue搜一下。
- assert get_version(fvcore, 3) >= (0, 1, 1), “Requires fvcore>=0.1.1”
卸载fvcore,安装fvcore>=0.1.1