摘要
- 驱动版本450.80.02
- cuda 10.1
- python 3.7
- pytorch 1.4
- mmcv 1.2
- mmdetection 2.6
安装cuda10.1
目前来看cuda10.1 是一个能屈能伸的版本,兼容性较好。安装时记得去除自带的显卡驱动。
官网下载对应版本:https://developer.nvidia.com/cuda-toolkit-archive
sudo sh cuda_10.1.243_418.87.00_linux.run
修改环境变量~/.bashrc:
export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
安装anaconda3
没啥好说的直接最新版省得很多麻烦:
官方网址:
https://www.anaconda.com/
清华备用网址:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
bash Anaconda3-5.2.0-Linux-x86_64.sh
配置环境变量:
sudo gedit ~/.bashrc
export PATH="/home/xupp/anaconda3/bin:$PATH"
source ~/.bashrc
更改为清华源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
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 --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --set show_channel_urls yes
创建conda环境
conda create -n vps python=3.7
conda activate vps
安装pytorch
直接官网下载历史版本:
https://pytorch.org/get-started/previous-versions/
我用的是1.4版本:
(e.g. 不加 -c pytorch 就可以用自己配置的源否则用的是官方源)
conda install pytorch==1.4.0 torchvision==0.5.0 cudatoolkit=10.1
安装mmcv
直接在官网找到对应版本使用命令下载:
https://mmcv.readthedocs.io/en/latest/#installation
这是我安装的版本:
pip install mmcv-full==latest+torch1.4.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html
安装mmdetection
在官网下载master版本,clone和直接下载都可以:
https://github.com/open-mmlab/mmdetection
cd mmdetection-master
pip install -r requirements.txt
pip install -v -e .
最后在检查一下是否都安装到位:
pip list
测试mmdetection
首先创建checkpoints目录在mmdetection根目录下然后下载官方训练集到该目录下:
官方训练集地址: https://mmdetection.readthedocs.io/en/latest/model_zoo.html
(e.g. 要下载与configs对应的训练集)
运行官方测试用例:
python demo/image_demo.py demo/demo.jpg configs/mask_rcnn/mask_rcnn_r101_fpn_1x_coco.py checkpoints/mask_rcnn_r101_fpn_1x_coco_20200204-1efe0ed5.pth
看到下图即为配置成功: