Detectron2 是 Facebook AI Research 的下一代库,提供最先进的检测和分割算法。它是Detectron 和maskrcnn-benchmark的后继者 。它支持 Facebook 中的许多计算机视觉研究项目和生产应用。
了解有关 Detectron2 的更多信息
像我 5 岁一样解释:Detectron2 | 将机器学习与 Detectron2 结合使用 |
什么是新的
- 包括全景分割、Densepose、Cascade R-CNN、旋转边界框、PointRend、DeepLab、ViTDet、MViTv2 等新功能。
- 用作图书馆以支持在其之上构建研究项目。
- 模型可以导出为 TorchScript 格式或 Caffe2 格式以进行部署。
- 它训练得更快。
安装
要求
- Linux 或 macOS,Python ≥ 3.7
- PyTorch ≥ 1.8 且torchvision与 PyTorch 安装相匹配。在pytorch.org将它们安装在一起以确保这一点
- OpenCV 是可选的,但演示和可视化需要
从源代码构建 Detectron2
需要 gcc 和 g++ ≥ 5.4。ninja是可选的,但推荐用于更快的构建。获得它们后,运行:
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 ...
要重建从本地克隆构建的 detectorron2,请首先使用rm -rf build/ **/*.so清理旧版本。重新安装 PyTorch 后,您经常需要重建 detectorron2。
注意:
- 预构建的包必须与相应版本的 CUDA 和 PyTorch 官方包一起使用。否则,请从源代码构建 detectorron2。
- 每隔几个月就会发布新的软件包。因此,软件包可能不包含主分支中的最新功能,并且可能与使用 detectorron2 的研究项目的主分支不兼容(例如项目中的那些)。
特定环境下的安装:
- Colab:请参阅我们的Colab 教程 ,其中包含分步说明。【参考:https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5】
- Docker:官方Dockerfile使用一些简单的命令安装 detectorron2
引用 Detectron2
如果您在研究中使用 Detectron2 或希望参考Model Zoo中发布的基线结果,请使用以下 BibTeX 条目。
@misc{wu2019detectron2,
author = {Yuxin Wu and Alexander Kirillov and Francisco Massa and
Wan-Yen Lo and Ross Girshick},
title = {Detectron2},
howpublished = {\url{https://github.com/facebookresearch/detectron2}},
year = {2019}
}
项目地址:
https://github.com/facebookresearch/detectron2