depth_fm.training¶
training ¶
Training loop and Lightning module for DepthFM.
lightning_module.py—DepthFMLightningModule(train/val/test steps, EMA, checkpoint strategy).train_lightning.py— CLI entry point. Invoked viatorchrun -m depth_fm.training.train_lightning.
DepthFMLightningModule ¶
Bases: LightningModule
Lightning module for DepthFM flow matching training.
Handles: - Conditional flow matching velocity loss - Surface normals auxiliary loss with warmup - Logit-normal timestep sampling - Noise augmentation on source distribution - Multi-step Euler inference for validation - Full metric computation and logging
Source code in src/depth_fm/training/lightning_module.py
estimate_uncertainty ¶
estimate_uncertainty(z_img: Tensor, num_samples: int = 10, num_steps: int = 4) -> tuple[torch.Tensor, torch.Tensor]
Computes the epistemic uncertainty via stochastic ODE sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z_img
|
Tensor
|
(B, C, H, W) Encoded input orthoimage. |
required |
num_samples
|
int
|
Number of stochastic noise initializations (N). |
10
|
num_steps
|
int
|
Euler integration steps per sample. |
4
|
Returns:
| Name | Type | Description |
|---|---|---|
mean_dtm |
Tensor
|
(B, 1, H, W) The expected topographic surface. |
var_dtm |
Tensor
|
(B, 1, H, W) The pixel-wise epistemic variance. |
Source code in src/depth_fm/training/lightning_module.py
on_train_end ¶
Final wandb upload and vis worker shutdown.