ImageTransform

class hybrid_learning.datasets.transforms.image_transforms.ImageTransform[source]

Bases: Transform

Transformations that can be applied to images. Images should be given as torch.Tensor version of a PIL.Image.Image instance. The transformation will iteratively descent into mappings and sequences to find tensor values to apply the transformation to (None values are left untouched). An error will be raised if values are found which are neither tensors nor None.

Public Data Attributes:

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)

Application of transformation.

Inherited from : py: class:Transform

apply_to(img)

Application of transformation.

Special Methods:

__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.


__call__(img)[source]

Application of transformation.

Parameters

img (Optional[Union[Tensor, Dict[Any, Tensor], Sequence[Tensor]]]) –

Return type

Optional[Union[Tensor, Dict[Any, Tensor], Sequence[Tensor]]]

abstract apply_to(img)[source]

Application of transformation.

Parameters

img (Tensor) –

Return type

Tensor