How another-0/dmm works
Purpose and Entry Points
This repository implements DMM, a disparity-guided multispectral Mamba detector for oriented remote-sensing object detection, built on MMRotate/MMDetection/MMEngine. Primary CLI entry points are tools/train.py and tools/test.py; single-image and huge-image inference are exposed through mmrotate/apis/inference.py, demo/image_demo.py, and demo/huge_image_demo.py.
Configuration-Driven Execution
Experiments are Python configurations that compose model, dataset, schedule, and runtime defaults. The DMM experiment is configs/dmm/dmm_s2anet_1x_dronevehicle.py; shared DroneVehicle dataset settings and standard runtime defaults are in configs/_base_/datasets/DroneVehicle.py and configs/_base_/default_runtime.py. The framework registry boundary is mmrotate/registry.py, allowing configs to instantiate local components alongside upstream OpenMMLab modules.
Data Preparation and Dataset Pipeline
DroneVehicle is the intended DMM input: source imagery is preprocessed to crop white borders by tools/data_process.py, and VOC-style labels are normalized/conveted to DOTA annotations by tools/VOC2DOTA.py. Dataset adapters load oriented annotations and samples through mmrotate/datasets/dronevehicle.py, while loading and geometric/image transforms reside in mmrotate/datasets/transforms/loading.py and mmrotate/datasets/transforms/transforms.py. This boundary converts filesystem images and polygon annotations into model-ready tensors and rotated-box data samples.
Geometric Representation and Detection Semantics
The core domain abstraction is rotated or quadrilateral bounding boxes, with conversion, transforms, and overlap operations under mmrotate/structures/bbox/rotated_boxes.py, mmrotate/structures/bbox/quadri_boxes.py, and mmrotate/structures/bbox/box_converters.py. Heads, assigners, coders, and losses consume these representations, preserving orientation throughout training, proposal assignment, decoding, NMS, and evaluation rather than treating targets as axis-aligned boxes.
DMM Model Path
DMM is implemented as a specialized S2ANet-style detector in mmrotate/models/detectors/dmm_s2anet.py. Its multispectral/disparity fusion layer is mmrotate/models/layers/dmm/rgbtmamba.py, supported by state-space utilities in mmrotate/models/layers/dmm/ssm_utils.py; the VMamba backbone implementation and selective-scan integration are under mmrotate/models/backbones/vmamba/vmamba.py and mmrotate/models/backbones/vmamba/csms6s.py. RGB/Thermal inputs are preprocessed by mmrotate/models/layers/rgbtDetDataPreprocessor.py before feature extraction, fusion, alignment, and oriented dense prediction.
General Detection Building Blocks
The repository retains MMRotate’s configurable detector ecosystem: dense oriented prediction heads include mmrotate/models/dense_heads/s2a_head.py, mmrotate/models/dense_heads/rotated_retina_head.py, and mmrotate/models/dense_heads/rotated_rtmdet_head.py; detector orchestration includes mmrotate/models/detectors/refine_single_stage.py. Training supervision is mediated by rotated assignment/coding modules such as mmrotate/models/task_modules/assigners/rotated_atss_assigner.py and mmrotate/models/task_modules/coders/delta_xywht_rbbox_coder.py, with specialized rotated losses in mmrotate/models/losses/rotated_iou_loss.py.
Evaluation, Deployment, and Runtime Dependencies
Predictions are scored using DOTA and rotated-COCO metrics in mmrotate/evaluation/metrics/dota_metric.py and mmrotate/evaluation/metrics/rotated_coco_metric.py, and can be rendered via mmrotate/visualization/local_visualizer.py. Large-image workflows can split and merge patch results through mmrotate/utils/patch/split.py and mmrotate/utils/patch/merge_results.py. The material runtime is Python/PyTorch with CUDA 11.8, MMDetection 3.3.0, MMCV 2.1.0, and MMEngine 0.10.5; DMM additionally depends on VMamba’s selective_scan==0.0.2. Optional serving integration targets TorchServe through tools/deployment/mmrotate2torchserve.py and tools/deployment/mmrotate_handler.py.
Main entry points: dmm_s2anet.py DMM S2ANet detector · dmm_s2anet_1x_dronevehicle.py DMM experiment config · transforms.py Load & geometric transforms · s2a_head.py Oriented dense heads
Components 21
Entry & Config
- Training CLI
tools/train.py - Test CLI
tools/test.py - DMM experiment config · Composes DMM, DroneVehicle, schedule, and runtime settings.
configs/dmm/dmm_s2anet_1x_dronevehicle.py - DroneVehicle config
configs/_base_/datasets/DroneVehicle.py - MMRotate registry · Instantiates local and upstream OpenMMLab components.
mmrotate/registry.py
Data & Geometry
- Dataset preparation · Crops white borders and converts VOC labels to DOTA.
tools/data_process.py - DroneVehicle dataset · Loads multispectral images and oriented annotations.
mmrotate/datasets/dronevehicle.py - Load & geometric transforms
mmrotate/datasets/transforms/transforms.py - Rotated box structures · Rotated/quadrilateral conversion and overlap semantics.
mmrotate/structures/bbox/rotated_boxes.py
DMM Model
- RGB/T data preprocessor · Prepares paired RGB and thermal inputs.
mmrotate/models/layers/rgbtDetDataPreprocessor.py - DMM S2ANet detector · Coordinates feature extraction, fusion, alignment, and prediction.
mmrotate/models/detectors/dmm_s2anet.py - VMamba backbone · State-space visual feature extractor.
mmrotate/models/backbones/vmamba/vmamba.py - Selective scan · VMamba integration backed by selective_scan.
mmrotate/models/backbones/vmamba/csms6s.py - RGBT Mamba fusion · Disparity-guided multispectral fusion.
mmrotate/models/layers/dmm/rgbtmamba.py - Oriented dense heads · S2A, rotated Retina, and RTMDet head family.
mmrotate/models/dense_heads/s2a_head.py - Rotated supervision · Assignment, rotated-box decoding, and rotated IoU loss.
mmrotate/models/task_modules/assigners/rotated_atss_assigner.py
Evaluation & Deployment
- DOTA metrics · Scores oriented detections using DOTA and rotated-COCO protocols.
mmrotate/evaluation/metrics/dota_metric.py - Inference API · Single-image and huge-image inference entry boundary.
mmrotate/apis/inference.py - Large-image patching · Splits large images and merges patch predictions.
mmrotate/utils/patch/split.py - Local visualizer
mmrotate/visualization/local_visualizer.py - TorchServe export · Optional model packaging and request handler integration.
tools/deployment/mmrotate2torchserve.py
Connections 23
- Training CLI → DMM experiment config: loads
- Test CLI → DMM experiment config: loads
- DMM experiment config → DroneVehicle config: inherits
- DMM experiment config → MMRotate registry: builds through
- DMM experiment config → DMM S2ANet detector: selects
- Dataset preparation → DroneVehicle dataset: produces normalized input for
- DroneVehicle config → DroneVehicle dataset: configures
- DroneVehicle dataset → Load & geometric transforms: feeds samples through
- Load & geometric transforms → Rotated box structures: creates and transforms
- Load & geometric transforms → RGB/T data preprocessor: delivers tensors to
- RGB/T data preprocessor → DMM S2ANet detector: prepares inputs for
- DMM S2ANet detector → VMamba backbone: extracts features with
- VMamba backbone → Selective scan: uses
- DMM S2ANet detector → RGBT Mamba fusion: fuses modalities through
- DMM S2ANet detector → Oriented dense heads: predicts through
- Oriented dense heads → Rotated supervision: trains with
- Rotated supervision → Rotated box structures: consumes oriented targets
- Test CLI → DOTA metrics: evaluates with
- Oriented dense heads → DOTA metrics: emits predictions for
- Inference API → DMM S2ANet detector: runs
- Inference API → Large-image patching: uses for huge images
- Large-image patching → Local visualizer: renders merged results
- DMM S2ANet detector → TorchServe export: optionally packaged for