1.在conda 中创建一个新的虚拟环境并打开(python版本选择3.7)
conda create -n mmdection python=3.7
conda activate mmdection
2.查看自己的nvcc版本
nvcc -V
我的版本是11.2
3.在pytorch官网选择对应的版本(如果没有选比自己版本高的)
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
4. 查看pytorch版本
python
import torch
print(torch.__version__)
exit()
5.安装mmcv
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cuda_version}/{torch_version}/index.html
我的cuda版本是11.2,torch版本是1.12.1
所以
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu112/torch1.12.1/index.html
6.安装mmdetection代码及相关包
git clone https://github.com/open-mmlab/mmdetection.git
7.最后一步,进入mmdetecion文件夹并安装相关库
cd mmdetection
pip install -r requirements.txt