How chenhongruixuan/mambacd works
Core project purpose and main components
• ChangeMamba is designed for remote sensing change detection. It supports multiple tasks such as binary change detection (MambaBCD), semantic change detection (MambaSCD) and building damage assessment (MambaBDA).
• The overall purpose is to take paired remote sensing imagery (such as T1 and T2 images), process them with a deep learning pipeline built upon a pre-trained backbone (via VMamba and various mmpretrain configurations), and then produce change maps or damage assessment results.
Break down the architecture into main modules/components
a. Data Ingestion and Preprocessing:
• Data loaders and utility functions. In “changedetection/datasets,” you have routines to handle different dataset formats (SYSU, LEVIR-CD+, SECOND, xBD).
• Structure for reading “train_list.txt” and “test_list.txt” files, as well as image pre-processing (cropping, resizing, etc.).
b. Configuration and Model Setup:
• Configuration layer which is heavily modularized under both “analyze/mmpretrain_configs” and “changedetection/configs”. These files define dataset parameters, the backbone (encoder) configuration and task-specific settings.
• That the project utilizes pre-trained weight modules (extracted from VMamba) and custom configurations for change detection.
c. Core Model Components:
• Backbone (encoder) module, which is part of the “analysis” folder’s mmpretrain configs and pretrained weight routines. This is responsible for image feature extraction.
• Dedicated changedetection models in the “changedetection/models” folder (e.g., MambaBCD, Mamba_backbone, SemanticDecoder, STMambaBDA/SCD variants). These collectively create the spatio-temporal state space model architecture.
d. Custom GPU Kernels:
• “kernels/selective_scan” folder as a component that provides compiled CUDA extensions for custom operations (for example, forward and backward passes of selective scan operations) that are integrated with the deep learning backend.
e. Training and Inference Pipelines:
• Clearly separate scripts for training and inference. Show that training scripts (under “changedetection/script”) call the appropriate model (Tiny, Small, Base versions) along with the configuration files.
f. Analysis and Evaluation:
• The “analyze” folder contains scripts for evaluating various aspects like loss, FLOPs, model scales and checkpoint extraction. These components are useful for benchmarking and may be embedded as a separate analysis module.
Flow and relationships
• Input remote sensing paired images from datasets moving into a Data Loader module.
• The extracted features then circulate into the “state space” change detection head (and possibly semantic decoder for multi-label outputs).
• Flow then proceeds into the loss computation and evaluation modules under training, with parallel routes for inference.
• Use labels for each module (for example “Data Loader”, “Preprocessing”, “Backbone Encoder (VMamba)”, “Change Detection Head”, “Custom GPU Kernels”, “Training Script”, “Inference Engine”, “Evaluation & Analysis”).
• Rectangles for processing modules,
• Rounded rectangles or ellipses for input/output endpoints,
• Hexagons for custom library kernels,
Architectural Patterns & Design Principles
• Separation of concerns: configuration files (mmpretrain_configs, changedetection/configs) are abstracted away from the core model definition and training/inference scripts.
• That the system is highly modular – it supports plug-and-play architecture where one can easily swap different backbone models or change detection heads.
• Mention the integration of custom CUDA kernels to accelerate specific operations—a design choice to boost performance.