出现:"ImportError: cannot import name '_C'"
,请build并且install detectron2
。
安装方法:
Requirements
- Linux or macOS
- Python ≥ 3.6
- PyTorch ≥ 1.3
- torchvision that matches the PyTorch installation. You can install them together at pytorch.org to make sure of this.
- OpenCV, optional, needed by demo and visualization
- pycocotools:
pip install cython; pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
- gcc & g++ ≥ 4.9
具有以上依赖性之后,运行:
1 2 3 4 5 6 7 8 9 |
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 cd detectron2 && pip install -e . # Or if you are on macOS # MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ pip install -e . |
一般来说,重装pytorch之后,需要重新安装detectron2
.
本文最后更新于2020年1月20日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!