安装detectron2

安装detectron2的方法,官方教程:Installation — detectron2 0.6 documentation

第一种方法:Build Detectron2 from Source

官方大大的源码:

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
# (add --user if you don't have permission)

# Or, to install it from a local clone:
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2

# On macOS, you may need to prepend the above commands with a few environment variables:
CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install ...

注意:如果采用先下载detectron2,再安装的方法,下载之后不要  cd detectron2,否则会出现找不到“step.py”的错误。

我的环境是CUDA:11.6, pytorch:1.10.2

采用第一种方式安装,会出现CUDA与torch版本不匹配。报错如下:

第二种方法:Install Pre-Built Detectron2 (Linux only)

知道自己的CUDA版本和torch版本后,采用第二种方法更快,而且不易出错,我就是采用的这种方法安装完成的。

我的环境是CUDA:11.6, pytorch:1.10.2,我选择的是CUDA==10.2, torch==1.10。

 成功!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐