ProjectiveTransforms

struct defined in module FastVision


			ProjectiveTransforms(sz; [augmentations, buffered]) <: Encoding

Encoding for spatial data that resizes blocks to a common size sz and applies projective augmentations.

Encodes all spatial blocks, preserving the block type:

  • Image{N} -> Image{N}

  • Mask{N} -> Mask{N}

  • Keypoints{N} -> Keypoints{N}

The behavior differs based on the context of encoding:

  • Training:

    1. Resizes the data so the smallest side equals a side length in sz while keeping the aspect ratio.

    2. Applies augmentations.

    3. Crops a random sz-sized portion of the data

  • Validation:

    1. Resizes the data so the smallest side equals a side length in sz while keeping the aspect ratio.

    2. Crops a sz-sized portion from the center.

  • Inference:

    1. Resizes the data so the smallest side equals a side length in sz while keeping the aspect ratio. Note that in this context, the data does not have size sz, since no cropping happens and aspect ratio is preserved.

ProjectiveTransforms is not limited to 2D data, and works on 3D data as well. Note, however, that some transformations in augs_projection (rotation, warping, flipping) are 2D only so augs_projection cannot be used for 3D data.

Keyword arguments

  • augmentations:: DataAugmentation.Transform = Identity(): Projective augmentation to apply during training. See augs_projection.

  • buffered = true: Whether to use inplace transformations. Reduces memory usage.

  • sharestate = true: Whether to use the same random state and bounds for all blocks in a sample