explaingit

facebookresearch/detectron2

📈 Trending34,477PythonAudience · researcherComplexity · 4/5ActiveLicenseSetup · moderate

TLDR

Python library for detecting and segmenting objects in images using deep learning. Provides pre-trained models, training code, and multiple detection architectures built on PyTorch.

Mindmap

mindmap
  root((Detectron2))
    What it does
      Object detection
      Image segmentation
      Instance segmentation
      Panoptic segmentation
    Key features
      Pre-trained models
      Multiple architectures
      Training code included
      Model export support
    Tech stack
      PyTorch
      Python
      CUDA GPU
    Use cases
      Autonomous driving
      Medical imaging
      Video surveillance
      Research experiments
    Audience
      Researchers
      ML engineers
      Computer vision teams

Things people build with this

USE CASE 1

Build autonomous vehicle perception systems that detect pedestrians, vehicles, and road signs in real-time.

USE CASE 2

Analyze medical images to automatically segment tumors, organs, or other anatomical structures for diagnosis.

USE CASE 3

Monitor retail shelves or warehouses to detect product placement and inventory levels automatically.

USE CASE 4

Process video feeds for security surveillance to identify and track people or objects of interest.

Tech stack

PythonPyTorchCUDATorchScript

Getting it running

Difficulty · moderate Time to first run · 30min

CUDA/GPU setup and PyTorch installation can be time-consuming depending on system configuration.

Use freely for any purpose, including commercial use, as long as you include the Apache 2.0 license notice and any modifications are documented.

In plain English

Detectron2 is a Python library from Meta AI Research (formerly Facebook AI Research) that provides tools for object detection, image segmentation, and related computer vision tasks. Object detection means identifying what objects are in an image and drawing bounding boxes around them, telling you there is a cat at a specific location and a chair at another. Segmentation goes further by identifying the exact pixels belonging to each object rather than just a bounding box. Detectron2 covers multiple variants of these tasks, including instance segmentation (outlining each individual object), semantic segmentation (labeling every pixel with a category), and panoptic segmentation (combining both at once). The library is built on top of PyTorch, a popular deep learning framework, and is designed to be a research platform: it implements many well-known detection architectures and provides training code, evaluation scripts, and a large model zoo, a collection of pre-trained model weights you can download and either use directly or fine-tune on your own dataset. Architectures available include Faster R-CNN, Mask R-CNN, RetinaNet, and more recent models like ViTDet. Trained models can be exported to deployment-ready formats like TorchScript. You would use Detectron2 when building or experimenting with a computer vision system that needs to locate and identify objects in images or video. Typical applications include autonomous driving perception systems, medical imaging analysis, product detection in retail, video surveillance, and academic computer vision research. It is primarily a research and prototyping tool. For production deployment, its export capabilities allow moving to optimized inference runtimes. The library is Python-based, requires a GPU for practical training speeds, and is released under the Apache 2.0 open-source license.

Copy-paste prompts

Prompt 1
Show me how to load a pre-trained Mask R-CNN model from Detectron2 and run inference on an image to detect and segment objects.
Prompt 2
How do I fine-tune a Detectron2 model on my own custom dataset of labeled images for a specific detection task?
Prompt 3
Walk me through exporting a trained Detectron2 model to TorchScript format so I can deploy it in production.
Prompt 4
What are the different segmentation tasks available in Detectron2 (instance, semantic, panoptic) and when should I use each one?
Prompt 5
Help me set up training a Faster R-CNN model in Detectron2 with my own data and evaluate its performance.
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.