Learnable Cost

class ezflow.similarity.learnable_cost.Conv2DMatching(config=(64, 96, 128, 64, 32, 1))[source]

Convolutional matching/filtering network for cost volume learning

Parameters

config (tuple of int or list of int) – Configuration of the convolutional layers in the network

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class ezflow.similarity.learnable_cost.Custom2DConvMatching(config=(16, 32, 16, 1), kernel_size=3, **kwargs)[source]

Convolutional matching/filtering network for cost volume learning with custom convolutions

Parameters
  • config (tuple of int or list of int) – Configuration of the convolutional layers in the network

  • kernel_size (int) – Kernel size of the convolutional layers

  • **kwargs – Additional keyword arguments for the convolutional layers

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class ezflow.similarity.learnable_cost.LearnableMatchingCost(max_u=3, max_v=3, config=(64, 96, 128, 64, 32, 1), remove_warp_hole=True, cuda_cost_compute=False, matching_net=None)[source]

Learnable matching cost network for cost volume learning. Used in DICL (https://arxiv.org/abs/2010.14851)

Parameters
  • max_u (int, optional) – Maximum displacement in the horizontal direction

  • max_v (int, optional) – Maximum displacement in the vertical direction

  • config (tuple of int or list of int, optional) – Configuration of the convolutional layers (matching net) in the network

  • remove_warp_hole (bool, optional) – Whether to remove the warp holes in the cost volume

  • cuda_cost_compute (bool, optional) – Whether to compute the cost volume on the GPU

  • matching_net (Optional[nn.Module], optional) – Custom matching network, by default None, which uses a Conv2DMatching network

forward(x, y)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.