peal.data.transformations

Callable image transformations used by PEAL datasets and generators.

The classes here are plugged into torchvision.transforms.Compose pipelines built by the datasets: geometric augmentations (RandomRotation, RandomResizeCropPad, Padding, CircularCut), channel handling (SetChannels), invertible normalization (Normalization and its no-op twin IdentityNormalization, both exposing invert so tensors can be mapped back to image space) and DiffusionAugmentation, which augments an image by encoding and re-decoding it with a PEAL generator.

Classes

CircularCut

Black out everything outside the ellipse inscribed in a PIL image.

DiffusionAugmentation

Augment images by a stochastic encode/decode round trip through a generator.

IdentityNormalization

No-op stand-in for Normalization.

Normalization

Per-channel (x - mean) / std normalization with an exact inverse.

Padding

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

RandomResizeCropPad

Random zoom augmentation that keeps the spatial size fixed.

RandomRotation

Rotate a tensor image by a random integer angle.

SetChannels

Convert a tensor image to a fixed number of channels.