ncalab.models.applications.depth.depthNCA

Classes

SmoothnessLoss

Initialize internal Module state, shared by both nn.Module and ScriptModule.

DepthNCAModel

NCA model for monocular depth estimation.

Module Contents

class ncalab.models.applications.depth.depthNCA.SmoothnessLoss

Bases: torch.nn.Module

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(depth_map: torch.Tensor, rgb_image: torch.Tensor)
class ncalab.models.applications.depth.depthNCA.DepthNCAModel(device: torch.device, num_image_channels: int = 3, num_hidden_channels: int = 18, fire_rate: float = 0.8, hidden_size: int = 128, num_learned_filters: int = 2, pad_noise: bool = False, **kwargs)

Bases: ncalab.models.basicNCA.AbstractNCAModel

NCA model for monocular depth estimation.

Parameters:
  • device – Pytorch device descriptor.

  • num_image_channels – Number of channels reserved for input image.

  • num_hidden_channels – Number of hidden channels (communication channels).

  • num_output_channels – Number of output channels.

  • validation_metric

  • fire_rate – Fire rate for stochastic weight update. Defaults to 0.5.

  • hidden_size – Number of neurons in hidden layer. Defaults to 128.

  • use_alive_mask – Whether to use alive masking (channel 3) during training. Defaults to False.

  • immutable_image_channels – If image channels should be fixed during inference, which is the case for most segmentation or classification problems. Defaults to True.

  • num_learned_filters – Number of learned filters. If zero, use two sobel filters instead. Defaults to 2.

  • filter_padding – Padding type to use. Might affect reliance on spatial cues. Defaults to “circular”.

  • use_laplace – Whether to use Laplace filter (only if num_learned_filters == 0)

  • kernel_size – Filter kernel size (only for learned filters)

  • pad_noise – Whether to pad input image tensor with noise in hidden / output channels

  • use_temporal_encoding

  • rule_type

  • rule_args

  • training_timesteps

  • inference_timesteps

vignette = None
loss(pred: ncalab.prediction.Prediction, label: torch.Tensor) Dict[str, torch.Tensor]
Parameters:
  • image – Input image, BCWH.

  • label – Ground truth.

Returns:

Dictionary of identifiers mapped to computed losses.