How open-mmlab/mmdetection3d works
Main Components
• Core Library (mmdet3d): This is where the primary logic resides, including:
– APIs and Inference Modules (e.g., mmdet3d/apis, inferencers)
– Model definitions (models/backbones, dense_heads, decode_heads, detectors, ROI heads, etc.)
– Dataset interfaces and transforms (datasets, datasets/transforms, dataset wrappers)
– Evaluation, metrics, and utility modules (evaluation, structures, utils, visualization)
• Configuration System (configs & mmdet3d/configs): Unified config files (including _base_ directories and many nested subsets) that let users easily customize experiments.
• Projects: A separate folder for additional state-of-the-art models (BEVFusion, CENet, CenterFormer, DETR3D, DSVT, NeRF-Det, PETR, TPVFormer, TR3D, etc.) that are built on the core framework.
• Tools: Training scripts, dataset converters, benchmarking and analysis scripts, model conversion, and deployment scripts.
• CI/CD and DevOps: Directories like .circleci, .github, and dev_scripts that contain instructions for continuous integration, tests, linting, Docker configurations, etc.
• Documentation & User Guides: The docs and README files provide user and advanced guides along with model zoo, benchmarks, and tutorials.
Relationships and Interactions
– The configuration system acts as the “glue” that allows different modules to plug into the training loop (in mmdet3d/engine) and model building. The config files are composed in a hierarchical manner (base configs, model parts, dataset details, schedule, etc.)
– Models (backbones, heads, detectors) receive input from data pipelines (datasets and transforms) and produce outputs that are passed onto evaluation modules for metric calculation.
– Training and inference modules (within mmdet3d/apis and mmdet3d/engine) coordinate data loading, model forward passes, loss computation, and logging.
– Evaluation and visualization components process the model predictions, often using utility modules in mmdet3d/structures and mmdet3d/evaluation to produce metrics or visual outputs.
– External dependencies include PyTorch (as the underlying deep learning engine) and integration with other OpenMMLab projects (like MMCV and MMEngine), plus deployment tools (Docker, GitHub Actions, etc.).
Architectural Patterns & Design Choices
– Modular & Config-driven: Separation of concerns via independent components (config, dataset, model, training loop) managed through a centralized configuration system.
– Plugin-like Architecture: Many modules (e.g., custom backbone or head) can be dropped in and registered (note the registry.py file) to extend the toolbox.
– Layered Design: At the lowest layer, utility functions and data structures handle raw data; the next layer includes dataset building and augmentation; above that there are model definitions and training logic; then evaluation and deployment layers.
– CI/CD and Containerization: The presence of Dockerfiles and CI pipelines indicate a design that supports automated testing, deployment, and reproducible research.