PadAndResize

class hybrid_learning.datasets.transforms.image_transforms.PadAndResize(img_size, interpolation='bilinear', force_type=False)[source]

Bases: Resize

Transformation that pads an image to a given ratio and then resizes it to fixed size. This is especially suitable if going from larger image dimensions to smaller ones. For the other way round, consider first scaling, then padding. For further details see super class.

Public Data Attributes:

Inherited from : py: class:Resize

settings

Settings to reproduce the instance.

Inherited from : py: class:Transform

IDENTITY_CLASS

The identity class or classes for composition / addition.

settings

Settings to reproduce the instance.

Public Methods:

apply_to(img)

Pad img to square, then resize it to the configured image size.

Inherited from : py: class:Resize

apply_to(img)

Pad img to square, then resize it to the configured image size.

Inherited from : py: class:ImageTransform

apply_to(img)

Pad img to square, then resize it to the configured image size.

Inherited from : py: class:Transform

apply_to(img)

Pad img to square, then resize it to the configured image size.

Special Methods:

Inherited from : py: class:Resize

__init__(img_size[, interpolation, force_type])

Init.

Inherited from : py: class:ImageTransform

__call__(img)

Application of transformation.

Inherited from : py: class:Transform

__repr__()

Return repr(self).

__eq__(other)

Return self==value.

__copy__()

Return a shallow copy of self using settings.

__add__(other)

Return a flat composition of self with other.

__radd__(other)

Return a flat composition of other and self.

__call__(img)

Application of transformation.


Parameters
apply_to(img)[source]

Pad img to square, then resize it to the configured image size. See also img_size.

Parameters

img (Tensor) –

Return type

Tensor