在windows 10上安裝mmdetection

 測試環境

cuda=11.1.0

GPU=3070

首先使用conda虛擬環境

安裝conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

設定MSVS C++ Compiler(只能用VS2019)

添加 `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx86\x64` 到 `PATH`


安裝mmcv時可能會有問題,可以測試修改

#!/bin/bash

SITE=/mnt/c/Users/thomas.jungblut/AppData/Local/Programs/Python/Python37/Lib/site-packages
sed -i.bak -e 's/CONSTEXPR_EXCEPT_WIN_CUDA/const/g' "${SITE}/torch/include/torch/csrc/jit/api/module.h"
sed -i.bak -e 's/return \*(this->value)/return \*((type\*)this->value)/g' "${SITE}/torch/include/pybind11/cast.h"
sed -i.bak '/static constexpr Symbol Kind/d' "${SITE}/torch/include/torch/csrc/jit/ir/ir.h"

修改SITE為自己的環境的路徑,這裡可利用linux subsystems執行

/mnt/c對應到本機C:

安裝mmcv

git clone https://github.com/open-mmlab/mmcv.git

注意:要使用conda powershell才可以執行
cd mmcv
pip install -r requirements.txt
$env:MMCV_WITH_OPS = 1 # Choose to install mmcv full
$env:MAX_JOBS = 8 # 可調整
$env:CUDA_HOME = $env:CUDA_PATH_V11_1 # 是環境而定
$env:TORCH_CUDA_ARCH_LIST="8.6" # 3070使用
python setup.py build_ext
python setup.py develop
pip list # Check whether the installation is successful

安裝mmdetection
git clone https://github.com/open-mmlab/mmdetection.git
pip install -r requirements.txt
python setup.py build_ext
python setup.py develop

完成後可使用demo/inference_demo.ipynb測試


留言

這個網誌中的熱門文章