Detectron2: a PyTorch detection and segmentation library whose last push was in 2021
Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
At a glance
- What is it?
- Detectron2 is Facebook AI Research's PyTorch library for object detection, instance and panoptic segmentation, keypoints and dense pose. It still installs, but the last push was on 2021-11-15, so treat it as a frozen baseline rather than a moving target.
- Who is it for?
- Adopt Detectron2 when you need a documented PyTorch baseline with a published model zoo and you can pin an environment to it. Do not adopt it if you need a maintained dependency or a library that tracks current PyTorch releases.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What Detectron2 actually gives you beyond a model checkpoint
Detectron2 is a library, not an application. The repository describes it as the successor to Detectron and maskrcnn-benchmark, and its stated purpose is to support both computer vision research projects and production applications at Facebook. The distinction matters: you do not run a binary and get boxes back. You import a Python package, build a model from a config, and wire your own data loading and output handling around it.
The README lists the capabilities that separate it from a plain Mask R-CNN implementation: panoptic segmentation, DensePose, Cascade R-CNN, rotated bounding boxes, PointRend, DeepLab, ViTDet and MViTv2. Those are different task heads and backbones sharing the same training and inference scaffolding. If your work is one fixed task, this breadth is overhead. If you are comparing architectures on the same dataset, it saves you from writing a training loop per paper.
The audience is therefore narrower than the download numbers suggest. It fits a team that already writes PyTorch, wants reproducible configs, and is willing to read documentation. It does not fit someone who wants a drop-in detector behind an HTTP endpoint.
Config-driven models, a registry, and where the C++ enters
The architecture visible in the repository is a config system plus a registry. The configs/ directory holds YAML files that describe a model, its backbone, the dataset, the solver and the test-time behaviour. The detectron2/ package holds the Python implementation, and detectron2/layers/csrc holds the C++ and CUDA sources that setup.py compiles into extensions. That split is the reason installation is not a pure-Python affair.
setup.py reads the version from detectron2/__init__.py, asserts that the installed PyTorch is at least 1.8, and then builds extensions from vision.cpp and the surrounding .cpp files. It also checks for ROCm: if torch.version.hip is set and ROCM_HOME exists, the build takes the ROCm path instead of the CUDA path. So the same source tree produces different binaries depending on what your torch reports.
Data flow follows the config. A dataset is registered under a name, a config references that name, and the training or inference entry point in tools/ consumes both. Models can be exported to TorchScript or Caffe2 format for deployment, which is the documented route out of Python if you need one. The README does not describe a serving layer, a queue, or a scheduler; those are yours to build.
How to install detectron2 and run a first inference
The README does not inline install commands. It points to the installation instructions in the documentation and to GETTING_STARTED.md and INSTALL.md in the repository. What setup.py does tell you is the hard floor: the build asserts PyTorch 1.8 or newer, and it compiles C++ and CUDA extensions, so a compiler and the matching CUDA toolkit must be present.
The conventional route is to clone the repository and install from the checkout, because the build reads detectron2/layers/csrc relative to the source tree:
git clone https://github.com/facebookresearch/detectron2.git
cd detectron2
pip install -e .If the build succeeds you get an editable install of the detectron2 package. If it fails, the error usually comes from the extension compile step rather than from Python, and INSTALL.md is where the project directs you for the platform-specific details.
For a first real use, the repository ships demo/demo.py and demo/predictor.py. The demo script takes an image and a config and writes an annotated output. The exact flags are in demo/README.md; the shape of the call is a config file plus an input path plus an output path, which is why the model zoo matters. You need a config and a matching checkpoint before the demo does anything useful.
The Model Zoo is documented in MODEL_ZOO.md and is described as a large set of baseline results and trained models available for download. Pick a config from configs/ that matches the checkpoint you download. A config and a checkpoint from different entries will not load cleanly.
The maintenance question is the first thing to settle
The last push to the default branch was on 2021-11-15, which is also the date of the v0.6 release. The repository is not archived, so the code and issues remain accessible, but there has been no push since that date. Any claim that Detectron2 is actively developed is not supported by the repository itself.
What that means in practice is a dependency you pin rather than track. The setup.py assertion of PyTorch 1.8 or newer was written when 1.8 was current. Nothing in the repository guarantees that the C++ extension sources compile against later PyTorch releases, and the project is not in a position to fix it if they do not. Teams that adopt Detectron2 today are adopting a snapshot with a known date.
This is not the same as abandoned. The documentation, the model zoo, the configs and the released checkpoints all still exist, and the Apache-2.0 license does not expire. But the cost of ownership shifts to you: you own the build, the version pins and any patches needed to keep it compiling.
Where Detectron2 is the wrong tool
The clearest failure mode is a modern Python and PyTorch environment. Because installation compiles extensions against the installed torch, an environment that has moved several major versions past 1.8 is the most likely place for the build to break, and the repository has no post-2021 commits to address it. If your platform toolchain is unusual, check INSTALL.md before assuming the standard command works.
The second case is latency-bound production inference. The README mentions TorchScript and Caffe2 export for deployment, but it does not describe a serving runtime, batching strategy or quantization pipeline. Exporting a model is not the same as operating one. If your requirement is a small, fast detector on constrained hardware, the config-driven training stack is weight you will not use.
The third case is a team that wants a maintained dependency with a release cadence. Detectron2's last release was v0.6 on 2021-11-15. If your policy requires upstream fixes within a support window, this project cannot satisfy it, and no amount of documentation changes that.
Detectron2 against MMDetection and YOLO
The two comparisons people search for are MMDetection and YOLO, and they differ from Detectron2 in different directions.
MMDetection is the closer analogue. It is also a config-driven detection toolbox with a model zoo, but it is organized as part of the OpenMMLab family, with a shared config inheritance system and a broader set of sister repositories for other vision tasks. Detectron2 keeps its configs inside its own tree and its extension surface is the detectron2 package plus the projects/ directory. The practical difference for an adopter is which ecosystem's conventions you already follow and which one is still receiving releases. On that second point, the comparison is decided by maintenance, not by architecture.
YOLO is a different kind of project. It is oriented around a family of single-stage detectors with an emphasis on speed, distributed as implementations rather than as a general training framework. Detectron2's README does not position it against YOLO at all; it positions it as a research platform covering many heads. If your constraint is frames per second on modest hardware, the YOLO line is the more natural starting point. If your constraint is reproducing a two-stage or panoptic baseline from a paper, Detectron2's config and model zoo are the closer fit.
Licence and the cost of upgrading a frozen dependency
Detectron2 is released under Apache-2.0, and the LICENSE file is in the repository root. Apache-2.0 is a permissive licence with an explicit patent grant, which is generally what a commercial adopter wants to see. What the licence does not do is make the project maintained, and it does not cover the pretrained checkpoints in the Model Zoo separately; if you redistribute a model, check the terms attached to that specific checkpoint rather than assuming the repository licence settles it. This is a description of the licence text, not legal advice.
Upgrade cost is the more concrete issue. Because the package builds C++ and CUDA extensions at install time, an upgrade is not a version bump in a requirements file. Moving to a newer PyTorch means recompiling those extensions, and there is no post-2021 commit to tell you whether that will work. The realistic strategy is to freeze the whole environment (Python, PyTorch, CUDA, compiler) alongside the Detectron2 checkout, and treat any change to that set as a migration project with its own testing.
The version string itself is assembled at build time. setup.py reads __version__ from detectron2/__init__.py and appends the D2_VERSION_SUFFIX environment variable if set, and appends a date-based dev suffix when BUILD_NIGHTLY is 1. The file comments that the suffix path is for building release packages and that users should never use it. If you see an unexpected version string, that environment is why.
Editorial conclusion
Adopt Detectron2 when you need a documented PyTorch baseline with a published model zoo and you can pin an environment to it. Do not adopt it if you need a maintained dependency or a library that tracks current PyTorch releases. Before committing, check that your PyTorch version satisfies the setup.py assertion of 1.8 or newer, confirm the CUDA and compiler path on your platform, and read INSTALL.md for the exact build command rather than assuming pip will work.
Frequently asked questions
What is Detectron2?
Detectron2 is Facebook AI Research's PyTorch library for object detection, segmentation and other visual recognition tasks. The README describes it as the successor to Detectron and maskrcnn-benchmark, and it includes capabilities such as panoptic segmentation, DensePose, Cascade R-CNN, rotated bounding boxes, PointRend, DeepLab, ViTDet and MViTv2.
What is Detectron2 used for?
It is used as a library to build computer vision research projects and production applications, and the repository's projects/ directory holds examples built on top of it. Models can also be exported to TorchScript or Caffe2 format for deployment.
How to install Detectron2?
The README points to the installation instructions in the documentation and to INSTALL.md in the repository rather than listing commands inline. setup.py requires PyTorch 1.8 or newer and compiles C++ and CUDA extensions from detectron2/layers/csrc, so the build needs a working compiler and CUDA toolkit.
How to pip install Detectron2?
The repository is set up to be installed from a source checkout, since the build reads detectron2/layers/csrc relative to the source tree. The pattern shown by the repository layout is cloning the repo, entering the directory, and running pip install -e . against that checkout.
Is Detectron2 still maintained?
The last push to the default branch was on 2021-11-15, which is also the date of the v0.6 release, and there have been no pushes since. The repository is not archived, but the commit history does not support describing it as actively developed.
How to use Detectron2?
The README directs you to Getting Started with Detectron2 in the documentation and to a Colab notebook for basic usage. The repository also ships demo/demo.py and demo/predictor.py, which take a config and an input image, and the configs come from configs/ with matching checkpoints from MODEL_ZOO.md.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/facebookresearch-detectron2)
Community notes