以
python3.9 + torch1.10.0 + torchvision0.11.0 + cuda11.3
为例
1. 配置虚拟环境
conda create -n mmdet python=3.9
conda activate mmdet
2. 安装torch
到 https://download.pytorch.org/whl/torch_stable.html 下载如下包:
torch-1.10.0%2Bcu113-cp310-cp310-linux_x86_64.whl
torchvision-0.11.0%2Bcu113-cp39-cp39-linux_x86_64.whl
然后将其scp上传到服务器
scp torch-1.10.0%2Bcu113-cp310-cp310-linux_x86_64.whl 用户名@host:/服务器路径
scp torchvision-0.11.0%2Bcu113-cp39-cp39-linux_x86_64.whl 用户名@host:/服务器路径
通过pip安装
pip install torch-1.10.0%2Bcu113-cp310-cp310-linux_x86_64.whl
pip install torchvision-0.11.0%2Bcu113-cp39-cp39-linux_x86_64.whl
3. 安装mmdet+mmcv
3.1 通过编译源码安装
mmdet
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements/build.txt
pip install -v -e .
mmcv
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
MMCV_WITH_OPS=1 pip install -e .
3.2 通过pip安装
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html
pip install mmdet