SelfSupModel

class packnet_sfm.models.SelfSupModel.SelfSupModel(**kwargs)[source]

Bases: packnet_sfm.models.SfmModel.SfmModel

Model that inherits a depth and pose network from SfmModel and includes the photometric loss for self-supervised training.

Parameters

kwargs (dict) – Extra parameters

forward(batch, return_logs=False, progress=0.0)[source]

Processes a batch.

Parameters
  • batch (dict) – Input batch

  • return_logs (bool) – True if logs are stored

  • progress – Training progress percentage

Returns

output – Dictionary containing a “loss” scalar and different metrics and predictions for logging and downstream usage.

Return type

dict

property logs

Return logs.

self_supervised_loss(image, ref_images, inv_depths, poses, intrinsics, return_logs=False, progress=0.0)[source]

Calculates the self-supervised photometric loss.

Parameters
  • image (torch.Tensor [B,3,H,W]) – Original image

  • ref_images (list of torch.Tensor [B,3,H,W]) – Reference images from context

  • inv_depths (torch.Tensor [B,1,H,W]) – Predicted inverse depth maps from the original image

  • poses (list of Pose) – List containing predicted poses between original and context images

  • intrinsics (torch.Tensor [B,3,3]) – Camera intrinsics

  • return_logs (bool) – True if logs are stored

  • progress – Training progress percentage

Returns

output – Dictionary containing a “loss” scalar a “metrics” dictionary

Return type

dict