概述
参考:https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md
https://github.com/pytorch/pytorch
https://pytorch.org/
安装anaconda(自行百度)
安装pytorch
1、创建环境:
conda create -n pytorch python=3.6 #detectron2要求python = 3.6
2、安装相关依赖:
pip install opencv-python
pip install pillow
pip install spyder #通过spyder3命令启动
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing
3、安装pytorch
conda install pytorch torchvision cudatoolkit=9.2 -c pytorch
我原本机器是cuda9.0,但是将上面cudatoolkit改为9.0后,默认安装的事pytorch1.11.0,但是detectron2需要pytorch1.13.0所以只能安装cuda9.2.
安装detectron2
1、下载detectron2并安装相关依赖
git clone https://github.com/facebookresearch/detectron2.git
pip install 'git+https://github.com/facebookresearch/fvcore'
pip install cython;
pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
2、开始安装:
cd detectron2
python setup.py build develop
问题
博主用的是RTX 2080ti,在编译detectron2的时候出现:
/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/yantianwang/detectron2/detectron2/layers/csrc -I/home/yantianwang/anaconda2/envs/pytorch/lib/python3.6/site-packages/torch/include -I/home/yantianwang/anaconda2/envs/pytorch/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/yantianwang/anaconda2/envs/pytorch/lib/python3.6/site-packages/torch/include/TH -I/home/yantianwang/anaconda2/envs/pytorch/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/yantianwang/anaconda2/envs/pytorch/include/python3.6m -c /home/yantianwang/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu -o build/temp.linux-x86_64-3.6/home/yantianwang/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++11 nvcc fatal : Unsupported gpu architecture 'compute_75' error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1
原因是cuda9.2不支持RTX 2080ti,需要安装cuda10.0,同时更新pytorch以匹配cuda10.0,更新代码:
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
最后
以上就是想人陪红牛为你收集整理的【detectron】ubuntu16.04配置detectron2的全部内容,希望文章能够帮你解决【detectron】ubuntu16.04配置detectron2所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复