padding_for_ratio

hybrid_learning.datasets.transforms.image_transforms.padding_for_ratio(from_size, to_ratio)[source]

Return the int padding for an image of size (height, width) to get a (width / height) ratio of ratio. Output can be used for torch.nn.functional.pad() pad argument.

Returns

padding as (left, right, top, bottom)

Parameters
Return type

Tuple[int, int, int, int]