相关环境和依赖:
1.CUDA10.0(即nvcc,下载安装,非conda安装!!)
2.VS2017(下载安装,支持C++编译)
3.pytorch=1.4.0=py3.7_cuda101_cudnn7_0
4.torchvision=0.5.0=py37_cu101
5.cudatoolkit=10.1.243=h74a9793_0
6.mmcv==0.2.16
#################################################################################################
安装pipeline:
1.安装CUDA10.0 (V10.0.130)
2.安装vs2017(微软官方社区版)
3.安装pytorch的GPU版本(conda安装会自动安装cudatoolkit)
conda create -n mmdet python=3.7 #创建虚拟环境
activate mmdet
conda install pytorch=1.4.0=py3.7_cuda101_cudnn7_0
conda install torchvision=0.5.0=py37_cu101
4.安装cython,pycocotools
pip install cython
Pycocotools 这个东西windows安装需要https://github.com/philferriere/cocoapi下载后进入pythonAPI文件夹内
使用python setup.py install
5.安装mmcv
pip install mmcv==0.2.16
6.安装mmdetection(我这里用的SOLO源码,基于mmdetection1.0.0)
1)下载源码(安装相关依赖)
git clone https://github.com/WXinlong/SOLO
cd SOLO
pip install -r requirements.txt
2)修改编译文件:
1.将~Lib\site-packages\torch\utils\cpp_extension.py 中 ,所有decode() 都改成了decode("utf8","ignore")
2.修改setup.py文件中extra_compile_args 相关代码,增加cxx的:"-DMS_WIN64","-MD"
也就是将def make_cuda_ext(name, module, sources) 整个函数改为
def make_cuda_ext(name, module, sources):
return CUDAExtension(
name='{}.{}'.format(module, name),
sources=[os.path.join(*module.split('.'), p) for p in sources],
extra_compile_args={
'cxx': ["-DMS_WIN64","-MD"],
'nvcc': [
'-D__CUDA_NO_HALF_OPERATORS__',
'-D__CUDA_NO_HALF_CONVERSIONS__',
'-D__CUDA_NO_HALF2_OPERATORS__',
]
})
3)编译和安装
python setup.py build_ext --inplace
python setup.py install develop
###################################################################################################
最后附上环境相关库清单(conda env export > requirements.yaml 导出),仅供参考
name: mmdet
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- defaults
dependencies:
- blas=1.0=mkl
- ca-certificates=2020.6.24=0
- certifi=2020.6.20=py37_0
- cffi=1.14.0=py37h7a1dbc1_0
- cudatoolkit=10.1.243=h74a9793_0
- cython=0.29.21=py37ha925a31_0
- freetype=2.10.2=hd328e21_0
- icc_rt=2019.0.0=h0cc432a_1
- intel-openmp=2020.1=216
- jpeg=9b=hb83a4c4_2
- libpng=1.6.37=h2a8f88b_0
- libtiff=4.1.0=h56a325e_1
- lz4-c=1.9.2=h62dcd97_1
- mkl=2020.1=216
- mkl-service=2.3.0=py37hb782905_0
- mkl_fft=1.1.0=py37h45dec08_0
- mkl_random=1.1.1=py37h47e9c7a_0
- msys2-conda-epoch=20160418=1
- ninja=1.7.2=0
- numpy=1.18.5=py37h6530119_0
- numpy-base=1.18.5=py37hc3f5095_0
- olefile=0.46=py37_0
- openssl=1.1.1g=he774522_0
- pip=20.1.1=py37_1
- pycparser=2.20=py_2
- python=3.7.7=h81c818b_4
- pytorch=1.4.0=py3.7_cuda101_cudnn7_0
- setuptools=49.2.0=py37_0
- six=1.15.0=py_0
- sqlite=3.32.3=h2a8f88b_0
- tk=8.6.10=he774522_0
- torchvision=0.5.0=py37_cu101
- vc=14.1=h0510ff6_4
- vs2015_runtime=14.16.27012=hf0eaf9b_3
- wheel=0.34.2=py37_0
- wincertstore=0.2=py37_0
- xz=5.2.5=h62dcd97_0
- zlib=1.2.11=h62dcd97_4
- zstd=1.4.5=h04227a9_0
- pip:
- addict==2.2.1
- albumentations==0.4.6
- asynctest==0.13.0
- atomicwrites==1.4.0
- attrs==19.3.0
- chardet==3.0.4
- codecov==2.1.8
- colorama==0.4.3
- coverage==5.2.1
- cycler==0.10.0
- decorator==4.4.2
- flake8==3.8.3
- idna==2.10
- imagecorruptions==1.1.0
- imageio==2.9.0
- imgaug==0.4.0
- importlib-metadata==1.7.0
- iniconfig==1.0.0
- isort==5.2.2
- jaraco-classes==3.1.0
- jaraco-collections==3.0.0
- jaraco-functools==3.0.1
- jaraco-structures==2.0
- jaraco-text==3.2.0
- jaraco-ui==2.0.1
- jaraco-windows==5.0.0
- kiwisolver==1.2.0
- kwarray==0.5.9
- matplotlib==3.3.0
- mccabe==0.6.1
- mmcv==0.2.16
- mmdet==1.0.0+unknown
- more-itertools==8.4.0
- networkx==2.4
- opencv-python==4.1.2.30
- ordered-set==4.0.2
- packaging==20.4
- pandas==1.1.0
- path==15.0.0
- path-py==12.5.0
- pillow==6.2.2
- pluggy==0.13.1
- py==1.9.0
- pycocotools==2.0
- pycodestyle==2.6.0
- pyflakes==2.2.0
- pyparsing==2.4.7
- pytest==6.0.1
- pytest-cov==2.10.0
- pytest-runner==5.2
- python-dateutil==2.8.1
- pytz==2020.1
- pywavelets==1.1.1
- pyyaml==5.3.1
- requests==2.24.0
- scikit-image==0.17.2
- scipy==1.5.2
- shapely==1.7.0
- terminaltables==3.1.0
- tifffile==2020.7.24
- toml==0.10.1
- ubelt==0.9.1
- urllib3==1.25.10
- xdoctest==0.13.0
- yapf==0.30.0
- zipp==3.1.0
prefix: D:\Miniconda3\envs\mmdet