fovi.arch.polar

class fovi.arch.polar.PolarPadder(pad)[source]

Bases: Module

Padding layer for polar coordinate representations.

Applies circular padding along the angular dimension (to handle wraparound) and zero padding along the radial dimension.

Parameters:

pad (int) – Amount of padding to apply on each side.

__init__(pad)[source]

Initialize the PolarPadder.

Parameters:

pad (int) – Amount of padding to apply on each side.

forward(inputs)[source]

Apply polar-aware padding to the input tensor.

Parameters:

inputs (torch.Tensor) – Input tensor of shape (batch, channels, height, width) where height corresponds to radial and width to angular dimension.

Returns:

Padded tensor with circular padding on angular dimension

and zero padding on radial dimension.

Return type:

torch.Tensor

fovi.arch.polar.convert_model_to_polar(model, device, dtype)[source]

convert a model to use polar coordinates

Note: this only supports replacing conv2d, maxpool2d, and avgpool2d

It notably does not support adaptiveavgpool2d, since we don’t know the padding needed. however this shouldn’t be a problem as these layers are usually used only once at the end of the network, before an FC layer which can aggregate across the angular dimension.