Multimodal Pipeline¶
Training and evaluation pipeline for multimodal late fusion of aerial and Sentinel-2 models.
pipeline.multimodal_pipeline
¶
Training and evaluation pipeline for multimodal fusion experiments.
This pipeline handles training with both aerial and Sentinel-2 data for the MultimodalLateFusion model architecture.
MultimodalTrainEvalPipeline(run_name: str | None = None, logs_dir: str | None = None)
¶
Pipeline for multimodal fusion training and evaluation.
Initialize the multimodal pipeline.
Source code in src/pipeline/multimodal_pipeline.py
run(config: dict[str, Any], *, no_stdout_logs: bool = False) -> None
¶
Execute the multimodal training and evaluation pipeline.
Source code in src/pipeline/multimodal_pipeline.py
add_train_eval_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser
¶
Add arguments for the multimodal pipeline.
Source code in src/pipeline/multimodal_pipeline.py
main() -> None
¶
Run the multimodal training/evaluation CLI entrypoint.
Source code in src/pipeline/multimodal_pipeline.py
run_train_eval(args: argparse.Namespace) -> None
¶
Run the multimodal pipeline with the provided configuration.
Source code in src/pipeline/multimodal_pipeline.py
train_multimodal(model: nn.Module, train_loader: DataLoader, val_loader: DataLoader, criterion: nn.Module, optimizer: torch.optim.Optimizer, device: torch.device, scheduler: LRScheduler | None = None, epochs: int = 100, patience: int = 20, num_classes: int = 13, other_class_index: int | None = None, accumulation_steps: int = 1, early_stopping_criterion: str = 'miou', *, use_amp: bool = False, log_evaluation_metrics: bool = True, log_model: bool = True, max_grad_norm: float | None = None) -> dict[str, Any]
¶
Train a multimodal fusion model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
MultimodalLateFusion model. |
required |
train_loader
|
DataLoader
|
DataLoader for training data. |
required |
val_loader
|
DataLoader
|
DataLoader for validation data. |
required |
criterion
|
Module
|
Loss function. |
required |
optimizer
|
Optimizer
|
Optimizer. |
required |
device
|
device
|
Training device. |
required |
scheduler
|
LRScheduler | None
|
Optional learning rate scheduler. |
None
|
epochs
|
int
|
Maximum epochs. |
100
|
patience
|
int
|
Early stopping patience. |
20
|
num_classes
|
int
|
Number of classes. |
13
|
other_class_index
|
int | None
|
Index of "other" class to ignore. |
None
|
accumulation_steps
|
int
|
Gradient accumulation steps. |
1
|
early_stopping_criterion
|
str
|
'loss' or 'miou'. |
'miou'
|
use_amp
|
bool
|
Whether to use AMP. |
False
|
log_evaluation_metrics
|
bool
|
Whether to log to MLflow. |
True
|
log_model
|
bool
|
Whether to log model to MLflow. |
True
|
max_grad_norm
|
float | None
|
Optional gradient clipping. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with training history and best metrics. |