peal.data.transformations.Padding

class peal.data.transformations.Padding[source]

Bases: object

Symmetrically pad a [C, H, W] tensor up to a fixed spatial size.

Parameters:

input_size (tuple of int) – Target (height, width). The input must not be larger than this.

Methods

__init__(input_size)[source]

Store the target size.

__call__(sample)[source]

Pad sample to input_size with grey (128) borders.

Parameters:

sample (torch.Tensor) – Image of shape [C, H, W].

Returns:

Image of shape [C, input_size[0], input_size[1]]; odd size differences put the extra pixel on the bottom/right.

Return type:

torch.Tensor