How vmarsocci/pangaea-bench works
Main Components
• Data Sources & Datasets: Represented by the collection of dataset configurations in the “configs/dataset” directory and the corresponding dataset loader implementations in “pangaea/datasets/”. These parts manage the ingestion and preprocessing of various geospatial datasets.
• Preprocessing Pipeline: The “configs/preprocessing” files and the code in parts of the codebase (perhaps invoked via the pangaea/engine/data_preprocessor.py) specify normalization, resizing, cropping, and other augmentations.
• Model Components – Encoders and Decoders:
• Encoders are defined in “pangaea/encoders/” and configured via “configs/encoder”. They are responsible for extracting features from the input images using various architectures (e.g., RemoteCLIP, SSL4EO variants, ViTs).
• Decoders are located in “pangaea/decoders/” and configured via “configs/decoder”. They map extracted features to outputs for segmentation, change detection, or regression tasks.
• Training & Evaluation Engine:
• The “pangaea/engine” directory implements the training, evaluation, and finetuning logic (Trainer, Evaluator, etc.). It coordinates the flow from data ingestion to model training.
• Experiment Configuration & Orchestration:
• Hydra configuration management is central throughout the repository (all config files in “configs/”). This management supports dynamic overrides at runtime.
• Utility Modules:
• Common utilities for logging, loss calculations, scheduling, and sampling are housed in “pangaea/utils/”. They are essential for training stability and reporting.
Relationships & Interactions
• Data Flow: The process starts by reading dataset configurations, loading raw geospatial data through the dataset loaders, and applying preprocessing.
• Feature Extraction & Modeling: Preprocessed data is then fed into the encoder modules, whose outputs are passed to the decoder modules. Multiple strategies (e.g., for multi-temporal processing or change detection via concatenation or differencing) lead to different configuration choices.
• Training Loop: The engine (in “pangaea/engine”) manages the training loop, integrating the model components, optimizers (from “configs/optimizer” and “pangaea/utils/optimizers.py”), learning rate schedulers (from “configs/lr_scheduler”), and criterion modules (defined in “pangaea/utils/losses.py”).
• Evaluation: After or during training, the evaluator component assesses model performance, with checkpoints and configurations stored for later inference.
• Hydra: This crucial framework allows command-line overrides, dynamically merging various configuration files (dataset, encoder, decoder, task, etc.) and orchestrating experiment runs.
Architectural Patterns
• Modular/Plug-and-Play Design: The clearly separated directories for datasets, encoders, decoders, and utilities facilitate swapping or extending components without affecting others.
• Configuration-Driven Approach: All parameters, from model architecture to dataset details, are isolated in YAML configuration files, ensuring high customizability via Hydra.
• Layered System: Data processing (input layer) → Model processing (feature extraction, intermediate representations) → Training/Evaluation logic (control and orchestration) → External integrations (Hydra, logging, external models/datasets).